Skip to content

Commit

Permalink
Remove elided 'static lifetime
Browse files Browse the repository at this point in the history
As of Rust 1.17 'static lifetimes are implied when
declaring consts.
  • Loading branch information
Bryant Mairs committed Dec 15, 2017
1 parent 0d493f3 commit 263ed2c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
46 changes: 23 additions & 23 deletions test/sys/test_aio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fn test_aio_cancel_all() {
#[test]
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
fn test_fsync() {
const INITIAL: &'static [u8] = b"abcdef123456";
const INITIAL: &[u8] = b"abcdef123456";
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
let mut aiocb = AioCb::from_fd( f.as_raw_fd(),
Expand All @@ -119,7 +119,7 @@ fn test_fsync() {
fn test_fsync_error() {
use std::mem;

const INITIAL: &'static [u8] = b"abcdef123456";
const INITIAL: &[u8] = b"abcdef123456";
// Create an invalid AioFsyncMode
let mode = unsafe { mem::transmute(666) };
let mut f = tempfile().unwrap();
Expand All @@ -134,8 +134,8 @@ fn test_fsync_error() {
#[test]
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
fn test_aio_suspend() {
const INITIAL: &'static [u8] = b"abcdef123456";
const WBUF: &'static [u8] = b"CDEF";
const INITIAL: &[u8] = b"abcdef123456";
const WBUF: &[u8] = b"CDEF";
let timeout = TimeSpec::seconds(10);
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
let mut f = tempfile().unwrap();
Expand Down Expand Up @@ -176,9 +176,9 @@ fn test_aio_suspend() {
#[test]
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
fn test_read() {
const INITIAL: &'static [u8] = b"abcdef123456";
const INITIAL: &[u8] = b"abcdef123456";
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
const EXPECT: &'static [u8] = b"cdef";
const EXPECT: &[u8] = b"cdef";
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
{
Expand All @@ -205,7 +205,7 @@ fn test_read() {
#[test]
#[cfg(any(target_os = "freebsd", target_os = "macos"))]
fn test_read_error() {
const INITIAL: &'static [u8] = b"abcdef123456";
const INITIAL: &[u8] = b"abcdef123456";
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
Expand All @@ -222,9 +222,9 @@ fn test_read_error() {
#[test]
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
fn test_read_into_mut_slice() {
const INITIAL: &'static [u8] = b"abcdef123456";
const INITIAL: &[u8] = b"abcdef123456";
let mut rbuf = vec![0; 4];
const EXPECT: &'static [u8] = b"cdef";
const EXPECT: &[u8] = b"cdef";
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
{
Expand Down Expand Up @@ -267,10 +267,10 @@ fn test_read_immutable_buffer() {
#[test]
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
fn test_write() {
const INITIAL: &'static [u8] = b"abcdef123456";
const INITIAL: &[u8] = b"abcdef123456";
let wbuf = "CDEF".to_string().into_bytes();
let mut rbuf = Vec::new();
const EXPECT: &'static [u8] = b"abCDEF123456";
const EXPECT: &[u8] = b"abCDEF123456";

let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
Expand Down Expand Up @@ -330,10 +330,10 @@ fn test_write_sigev_signal() {
SIGNALED.store(false, Ordering::Relaxed);
unsafe { sigaction(Signal::SIGUSR2, &sa) }.unwrap();

const INITIAL: &'static [u8] = b"abcdef123456";
const WBUF: &'static [u8] = b"CDEF";
const INITIAL: &[u8] = b"abcdef123456";
const WBUF: &[u8] = b"CDEF";
let mut rbuf = Vec::new();
const EXPECT: &'static [u8] = b"abCDEF123456";
const EXPECT: &[u8] = b"abCDEF123456";

let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
Expand Down Expand Up @@ -364,11 +364,11 @@ fn test_write_sigev_signal() {
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
fn test_lio_listio_wait() {
const INITIAL: &'static [u8] = b"abcdef123456";
const WBUF: &'static [u8] = b"CDEF";
const INITIAL: &[u8] = b"abcdef123456";
const WBUF: &[u8] = b"CDEF";
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
let mut rbuf2 = Vec::new();
const EXPECT: &'static [u8] = b"abCDEF123456";
const EXPECT: &[u8] = b"abCDEF123456";
let mut f = tempfile().unwrap();

f.write_all(INITIAL).unwrap();
Expand Down Expand Up @@ -407,11 +407,11 @@ fn test_lio_listio_wait() {
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
fn test_lio_listio_nowait() {
const INITIAL: &'static [u8] = b"abcdef123456";
const WBUF: &'static [u8] = b"CDEF";
const INITIAL: &[u8] = b"abcdef123456";
const WBUF: &[u8] = b"CDEF";
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
let mut rbuf2 = Vec::new();
const EXPECT: &'static [u8] = b"abCDEF123456";
const EXPECT: &[u8] = b"abCDEF123456";
let mut f = tempfile().unwrap();

f.write_all(INITIAL).unwrap();
Expand Down Expand Up @@ -455,11 +455,11 @@ fn test_lio_listio_nowait() {
fn test_lio_listio_signal() {
#[allow(unused_variables)]
let m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
const INITIAL: &'static [u8] = b"abcdef123456";
const WBUF: &'static [u8] = b"CDEF";
const INITIAL: &[u8] = b"abcdef123456";
const WBUF: &[u8] = b"CDEF";
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
let mut rbuf2 = Vec::new();
const EXPECT: &'static [u8] = b"abCDEF123456";
const EXPECT: &[u8] = b"abCDEF123456";
let mut f = tempfile().unwrap();
let sa = SigAction::new(SigHandler::Handler(sigfunc),
SaFlags::SA_RESETHAND,
Expand Down
2 changes: 1 addition & 1 deletion test/sys/test_aio_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tempfile::tempfile;
#[should_panic(expected = "Dropped an in-progress AioCb")]
#[cfg(not(target_env = "musl"))]
fn test_drop() {
const WBUF: &'static [u8] = b"CDEF";
const WBUF: &[u8] = b"CDEF";

let f = tempfile().unwrap();
f.set_len(6).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions test/test_fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::os::unix::fs;

#[test]
fn test_openat() {
const CONTENTS: &'static [u8] = b"abcd";
const CONTENTS: &[u8] = b"abcd";
let mut tmp = NamedTempFile::new().unwrap();
tmp.write_all(CONTENTS).unwrap();

Expand Down Expand Up @@ -62,7 +62,7 @@ mod linux_android {

#[test]
fn test_splice() {
const CONTENTS: &'static [u8] = b"abcdef123456";
const CONTENTS: &[u8] = b"abcdef123456";
let mut tmp = tempfile().unwrap();
tmp.write_all(CONTENTS).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions test/test_net.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use nix::net::if_::*;

#[cfg(any(target_os = "android", target_os = "linux"))]
const LOOPBACK: &'static [u8] = b"lo";
const LOOPBACK: &[u8] = b"lo";

#[cfg(not(any(target_os = "android", target_os = "linux")))]
const LOOPBACK: &'static [u8] = b"lo0";
const LOOPBACK: &[u8] = b"lo0";

#[test]
fn test_if_nametoindex() {
Expand Down
2 changes: 1 addition & 1 deletion test/test_sendfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use nix::sys::sendfile::sendfile;

#[test]
fn test_sendfile() {
const CONTENTS: &'static [u8] = b"abcdef123456";
const CONTENTS: &[u8] = b"abcdef123456";
let mut tmp = tempfile().unwrap();
tmp.write_all(CONTENTS).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions test/test_unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ fn test_getcwd() {

#[test]
fn test_lseek() {
const CONTENTS: &'static [u8] = b"abcdef123456";
const CONTENTS: &[u8] = b"abcdef123456";
let mut tmp = tempfile().unwrap();
tmp.write_all(CONTENTS).unwrap();
let tmpfd = tmp.into_raw_fd();
Expand All @@ -336,7 +336,7 @@ fn test_lseek() {
#[cfg(any(target_os = "linux", target_os = "android"))]
#[test]
fn test_lseek64() {
const CONTENTS: &'static [u8] = b"abcdef123456";
const CONTENTS: &[u8] = b"abcdef123456";
let mut tmp = tempfile().unwrap();
tmp.write_all(CONTENTS).unwrap();
let tmpfd = tmp.into_raw_fd();
Expand Down

0 comments on commit 263ed2c

Please sign in to comment.