From 7c755e6025e439cec7f8331a5c013acf532415b8 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 20 Feb 2021 14:49:12 -0700 Subject: [PATCH 1/3] Fix a non_fmt_panic warning with Rustc 1.52.0 --- test/test_poll.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_poll.rs b/test/test_poll.rs index a5e2d254b5..acfaad8bea 100644 --- a/test/test_poll.rs +++ b/test/test_poll.rs @@ -11,7 +11,7 @@ macro_rules! loop_while_eintr { match $poll_expr { Ok(nfds) => break nfds, Err(Error::Sys(Errno::EINTR)) => (), - Err(e) => panic!(e) + Err(e) => panic!("{}", e) } } } From b708b747317b4cd35c49b8779db09120139707c7 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 20 Feb 2021 14:50:58 -0700 Subject: [PATCH 2/3] Update tempfile dev dependency This eliminates the need to build multiple versions of cfg-if --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 885fa10075..f165da71e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ cc = "1" bytes = "0.4.8" lazy_static = "1.2" rand = "0.6" -tempfile = "3.0.5" +tempfile = "3.2.0" semver = "0.9.0" [target.'cfg(any(target_os = "android", target_os = "linux"))'.dev-dependencies] From 04504295a6fbe4a0a29eaade7faf1f9847dfe8c8 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 20 Feb 2021 14:56:36 -0700 Subject: [PATCH 3/3] Update rand to 0.8 This eliminates some duplicate dependencies --- Cargo.toml | 2 +- test/sys/test_sockopt.rs | 2 +- test/sys/test_uio.rs | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f165da71e1..c6a8dd25c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ cc = "1" [dev-dependencies] bytes = "0.4.8" lazy_static = "1.2" -rand = "0.6" +rand = "0.8" tempfile = "3.2.0" semver = "0.9.0" diff --git a/test/sys/test_sockopt.rs b/test/sys/test_sockopt.rs index 5606593132..d151cf554a 100644 --- a/test/sys/test_sockopt.rs +++ b/test/sys/test_sockopt.rs @@ -20,7 +20,7 @@ fn is_so_mark_functional() { fn test_so_buf() { let fd = socket(AddressFamily::Inet, SockType::Datagram, SockFlag::empty(), SockProtocol::Udp) .unwrap(); - let bufsize: usize = thread_rng().gen_range(4096, 131_072); + let bufsize: usize = thread_rng().gen_range(4096..131_072); setsockopt(fd, sockopt::SndBuf, &bufsize).unwrap(); let actual = getsockopt(fd, sockopt::SndBuf).unwrap(); assert!(actual >= bufsize); diff --git a/test/sys/test_uio.rs b/test/sys/test_uio.rs index 8d22bf1755..aede530a38 100644 --- a/test/sys/test_uio.rs +++ b/test/sys/test_uio.rs @@ -14,7 +14,11 @@ use tempfile::tempdir; fn test_writev() { let mut to_write = Vec::with_capacity(16 * 128); for _ in 0..16 { - let s: String = thread_rng().sample_iter(&Alphanumeric).take(128).collect(); + let s: String = thread_rng() + .sample_iter(&Alphanumeric) + .map(char::from) + .take(128) + .collect(); let b = s.as_bytes(); to_write.extend(b.iter().cloned()); } @@ -23,7 +27,7 @@ fn test_writev() { let mut consumed = 0; while consumed < to_write.len() { let left = to_write.len() - consumed; - let slice_len = if left <= 64 { left } else { thread_rng().gen_range(64, cmp::min(256, left)) }; + let slice_len = if left <= 64 { left } else { thread_rng().gen_range(64..cmp::min(256, left)) }; let b = &to_write[consumed..consumed+slice_len]; iovecs.push(IoVec::from_slice(b)); consumed += slice_len; @@ -57,13 +61,17 @@ fn test_writev() { #[test] #[cfg(not(target_os = "redox"))] fn test_readv() { - let s:String = thread_rng().sample_iter(&Alphanumeric).take(128).collect(); + let s:String = thread_rng() + .sample_iter(&Alphanumeric) + .map(char::from) + .take(128) + .collect(); let to_write = s.as_bytes().to_vec(); let mut storage = Vec::new(); let mut allocated = 0; while allocated < to_write.len() { let left = to_write.len() - allocated; - let vec_len = if left <= 64 { left } else { thread_rng().gen_range(64, cmp::min(256, left)) }; + let vec_len = if left <= 64 { left } else { thread_rng().gen_range(64..cmp::min(256, left)) }; let v: Vec = iter::repeat(0u8).take(vec_len).collect(); storage.push(v); allocated += vec_len;