Skip to content

Commit 263ed2c

Browse files
author
Bryant Mairs
committed
Remove elided 'static lifetime
As of Rust 1.17 'static lifetimes are implied when declaring consts.
1 parent 0d493f3 commit 263ed2c

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

test/sys/test_aio.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn test_aio_cancel_all() {
9898
#[test]
9999
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
100100
fn test_fsync() {
101-
const INITIAL: &'static [u8] = b"abcdef123456";
101+
const INITIAL: &[u8] = b"abcdef123456";
102102
let mut f = tempfile().unwrap();
103103
f.write_all(INITIAL).unwrap();
104104
let mut aiocb = AioCb::from_fd( f.as_raw_fd(),
@@ -119,7 +119,7 @@ fn test_fsync() {
119119
fn test_fsync_error() {
120120
use std::mem;
121121

122-
const INITIAL: &'static [u8] = b"abcdef123456";
122+
const INITIAL: &[u8] = b"abcdef123456";
123123
// Create an invalid AioFsyncMode
124124
let mode = unsafe { mem::transmute(666) };
125125
let mut f = tempfile().unwrap();
@@ -134,8 +134,8 @@ fn test_fsync_error() {
134134
#[test]
135135
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
136136
fn test_aio_suspend() {
137-
const INITIAL: &'static [u8] = b"abcdef123456";
138-
const WBUF: &'static [u8] = b"CDEF";
137+
const INITIAL: &[u8] = b"abcdef123456";
138+
const WBUF: &[u8] = b"CDEF";
139139
let timeout = TimeSpec::seconds(10);
140140
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
141141
let mut f = tempfile().unwrap();
@@ -176,9 +176,9 @@ fn test_aio_suspend() {
176176
#[test]
177177
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
178178
fn test_read() {
179-
const INITIAL: &'static [u8] = b"abcdef123456";
179+
const INITIAL: &[u8] = b"abcdef123456";
180180
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
181-
const EXPECT: &'static [u8] = b"cdef";
181+
const EXPECT: &[u8] = b"cdef";
182182
let mut f = tempfile().unwrap();
183183
f.write_all(INITIAL).unwrap();
184184
{
@@ -205,7 +205,7 @@ fn test_read() {
205205
#[test]
206206
#[cfg(any(target_os = "freebsd", target_os = "macos"))]
207207
fn test_read_error() {
208-
const INITIAL: &'static [u8] = b"abcdef123456";
208+
const INITIAL: &[u8] = b"abcdef123456";
209209
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
210210
let mut f = tempfile().unwrap();
211211
f.write_all(INITIAL).unwrap();
@@ -222,9 +222,9 @@ fn test_read_error() {
222222
#[test]
223223
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
224224
fn test_read_into_mut_slice() {
225-
const INITIAL: &'static [u8] = b"abcdef123456";
225+
const INITIAL: &[u8] = b"abcdef123456";
226226
let mut rbuf = vec![0; 4];
227-
const EXPECT: &'static [u8] = b"cdef";
227+
const EXPECT: &[u8] = b"cdef";
228228
let mut f = tempfile().unwrap();
229229
f.write_all(INITIAL).unwrap();
230230
{
@@ -267,10 +267,10 @@ fn test_read_immutable_buffer() {
267267
#[test]
268268
#[cfg_attr(all(target_env = "musl", target_arch = "x86_64"), ignore)]
269269
fn test_write() {
270-
const INITIAL: &'static [u8] = b"abcdef123456";
270+
const INITIAL: &[u8] = b"abcdef123456";
271271
let wbuf = "CDEF".to_string().into_bytes();
272272
let mut rbuf = Vec::new();
273-
const EXPECT: &'static [u8] = b"abCDEF123456";
273+
const EXPECT: &[u8] = b"abCDEF123456";
274274

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

333-
const INITIAL: &'static [u8] = b"abcdef123456";
334-
const WBUF: &'static [u8] = b"CDEF";
333+
const INITIAL: &[u8] = b"abcdef123456";
334+
const WBUF: &[u8] = b"CDEF";
335335
let mut rbuf = Vec::new();
336-
const EXPECT: &'static [u8] = b"abCDEF123456";
336+
const EXPECT: &[u8] = b"abCDEF123456";
337337

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

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

417417
f.write_all(INITIAL).unwrap();
@@ -455,11 +455,11 @@ fn test_lio_listio_nowait() {
455455
fn test_lio_listio_signal() {
456456
#[allow(unused_variables)]
457457
let m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
458-
const INITIAL: &'static [u8] = b"abcdef123456";
459-
const WBUF: &'static [u8] = b"CDEF";
458+
const INITIAL: &[u8] = b"abcdef123456";
459+
const WBUF: &[u8] = b"CDEF";
460460
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
461461
let mut rbuf2 = Vec::new();
462-
const EXPECT: &'static [u8] = b"abCDEF123456";
462+
const EXPECT: &[u8] = b"abCDEF123456";
463463
let mut f = tempfile().unwrap();
464464
let sa = SigAction::new(SigHandler::Handler(sigfunc),
465465
SaFlags::SA_RESETHAND,

test/sys/test_aio_drop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use tempfile::tempfile;
1313
#[should_panic(expected = "Dropped an in-progress AioCb")]
1414
#[cfg(not(target_env = "musl"))]
1515
fn test_drop() {
16-
const WBUF: &'static [u8] = b"CDEF";
16+
const WBUF: &[u8] = b"CDEF";
1717

1818
let f = tempfile().unwrap();
1919
f.set_len(6).unwrap();

test/test_fcntl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::os::unix::fs;
88

99
#[test]
1010
fn test_openat() {
11-
const CONTENTS: &'static [u8] = b"abcd";
11+
const CONTENTS: &[u8] = b"abcd";
1212
let mut tmp = NamedTempFile::new().unwrap();
1313
tmp.write_all(CONTENTS).unwrap();
1414

@@ -62,7 +62,7 @@ mod linux_android {
6262

6363
#[test]
6464
fn test_splice() {
65-
const CONTENTS: &'static [u8] = b"abcdef123456";
65+
const CONTENTS: &[u8] = b"abcdef123456";
6666
let mut tmp = tempfile().unwrap();
6767
tmp.write_all(CONTENTS).unwrap();
6868

test/test_net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use nix::net::if_::*;
22

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

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

99
#[test]
1010
fn test_if_nametoindex() {

test/test_sendfile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use nix::sys::sendfile::sendfile;
1010

1111
#[test]
1212
fn test_sendfile() {
13-
const CONTENTS: &'static [u8] = b"abcdef123456";
13+
const CONTENTS: &[u8] = b"abcdef123456";
1414
let mut tmp = tempfile().unwrap();
1515
tmp.write_all(CONTENTS).unwrap();
1616

test/test_unistd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ fn test_getcwd() {
318318

319319
#[test]
320320
fn test_lseek() {
321-
const CONTENTS: &'static [u8] = b"abcdef123456";
321+
const CONTENTS: &[u8] = b"abcdef123456";
322322
let mut tmp = tempfile().unwrap();
323323
tmp.write_all(CONTENTS).unwrap();
324324
let tmpfd = tmp.into_raw_fd();
@@ -336,7 +336,7 @@ fn test_lseek() {
336336
#[cfg(any(target_os = "linux", target_os = "android"))]
337337
#[test]
338338
fn test_lseek64() {
339-
const CONTENTS: &'static [u8] = b"abcdef123456";
339+
const CONTENTS: &[u8] = b"abcdef123456";
340340
let mut tmp = tempfile().unwrap();
341341
tmp.write_all(CONTENTS).unwrap();
342342
let tmpfd = tmp.into_raw_fd();

0 commit comments

Comments
 (0)