From ae8e4a4ba0a2c3300624b5ed560ac95ed6244005 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Fri, 15 Dec 2017 14:41:37 -0800 Subject: Remove elided 'static lifetime As of Rust 1.17 'static lifetimes are implied when declaring consts. --- test/sys/test_aio.rs | 46 +++++++++++++++++++++++----------------------- test/sys/test_aio_drop.rs | 2 +- test/test_fcntl.rs | 4 ++-- test/test_net.rs | 4 ++-- test/test_sendfile.rs | 2 +- test/test_unistd.rs | 4 ++-- 6 files changed, 31 insertions(+), 31 deletions(-) (limited to 'test') diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs index 7cfc313d..4f151458 100644 --- a/test/sys/test_aio.rs +++ b/test/sys/test_aio.rs @@ -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(), @@ -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(); @@ -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(); @@ -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(); { @@ -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(); @@ -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(); { @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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, diff --git a/test/sys/test_aio_drop.rs b/test/sys/test_aio_drop.rs index ef0f5041..9214957f 100644 --- a/test/sys/test_aio_drop.rs +++ b/test/sys/test_aio_drop.rs @@ -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(); diff --git a/test/test_fcntl.rs b/test/test_fcntl.rs index 6c232258..57b35837 100644 --- a/test/test_fcntl.rs +++ b/test/test_fcntl.rs @@ -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(); @@ -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(); diff --git a/test/test_net.rs b/test/test_net.rs index 24bd411a..b8940e71 100644 --- a/test/test_net.rs +++ b/test/test_net.rs @@ -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() { diff --git a/test/test_sendfile.rs b/test/test_sendfile.rs index 689f5a60..7b51a1a6 100644 --- a/test/test_sendfile.rs +++ b/test/test_sendfile.rs @@ -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(); diff --git a/test/test_unistd.rs b/test/test_unistd.rs index e8f9b448..7c26210c 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -319,7 +319,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(); @@ -337,7 +337,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(); -- cgit v1.2.3