summaryrefslogtreecommitdiffstats
path: root/tokio/tests
diff options
context:
space:
mode:
authorbdonlan <bdonlan@gmail.com>2020-10-08 17:14:39 -0700
committerGitHub <noreply@github.com>2020-10-08 17:14:39 -0700
commitb704c53b9cc76eaf8c9c6585f8444c4515d27728 (patch)
tree45d8037ebcd0c1a51b5afa5c0486752aebe103e3 /tokio/tests
parent066965cd59d01fd9d999152e32169a24dfe434fa (diff)
chore: Fix clippy lints (#2931)
Closes: #2929 Co-authored-by: Bryan Donlan <bdonlan@amazon.com>
Diffstat (limited to 'tokio/tests')
-rw-r--r--tokio/tests/macros_select.rs2
-rw-r--r--tokio/tests/rt_common.rs4
-rw-r--r--tokio/tests/stream_stream_map.rs14
-rw-r--r--tokio/tests/sync_broadcast.rs5
4 files changed, 10 insertions, 15 deletions
diff --git a/tokio/tests/macros_select.rs b/tokio/tests/macros_select.rs
index f971409b..f77f3f01 100644
--- a/tokio/tests/macros_select.rs
+++ b/tokio/tests/macros_select.rs
@@ -152,7 +152,7 @@ async fn select_streams() {
}
}
- msgs.sort();
+ msgs.sort_unstable();
assert_eq!(&msgs[..], &[1, 2, 3]);
}
diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs
index 93d6a44e..56ab840d 100644
--- a/tokio/tests/rt_common.rs
+++ b/tokio/tests/rt_common.rs
@@ -206,7 +206,7 @@ rt_test! {
out.push(i);
}
- out.sort();
+ out.sort_unstable();
out
});
@@ -265,7 +265,7 @@ rt_test! {
out.push(i);
}
- out.sort();
+ out.sort_unstable();
out
}).await.unwrap()
});
diff --git a/tokio/tests/stream_stream_map.rs b/tokio/tests/stream_stream_map.rs
index 6b498032..38bb0c5d 100644
--- a/tokio/tests/stream_stream_map.rs
+++ b/tokio/tests/stream_stream_map.rs
@@ -115,7 +115,7 @@ async fn multiple_entries() {
assert_pending!(map.poll_next());
- v.sort();
+ v.sort_unstable();
assert_eq!(v[0].0, "bar");
assert_eq!(v[0].1, 4);
assert_eq!(v[1].0, "foo");
@@ -213,8 +213,7 @@ fn new_capacity_zero() {
let map = StreamMap::<&str, stream::Pending<()>>::new();
assert_eq!(0, map.capacity());
- let keys = map.keys().collect::<Vec<_>>();
- assert!(keys.is_empty());
+ assert!(map.keys().next().is_none());
}
#[test]
@@ -222,8 +221,7 @@ fn with_capacity() {
let map = StreamMap::<&str, stream::Pending<()>>::with_capacity(10);
assert!(10 <= map.capacity());
- let keys = map.keys().collect::<Vec<_>>();
- assert!(keys.is_empty());
+ assert!(map.keys().next().is_none());
}
#[test]
@@ -235,7 +233,7 @@ fn iter_keys() {
map.insert("c", pending());
let mut keys = map.keys().collect::<Vec<_>>();
- keys.sort();
+ keys.sort_unstable();
assert_eq!(&keys[..], &[&"a", &"b", &"c"]);
}
@@ -250,7 +248,7 @@ fn iter_values() {
let mut size_hints = map.values().map(|s| s.size_hint().0).collect::<Vec<_>>();
- size_hints.sort();
+ size_hints.sort_unstable();
assert_eq!(&size_hints[..], &[1, 2, 3]);
}
@@ -268,7 +266,7 @@ fn iter_values_mut() {
.map(|s: &mut _| s.size_hint().0)
.collect::<Vec<_>>();
- size_hints.sort();
+ size_hints.sort_unstable();
assert_eq!(&size_hints[..], &[1, 2, 3]);
}
diff --git a/tokio/tests/sync_broadcast.rs b/tokio/tests/sync_broadcast.rs
index d7e77e9d..7960eb85 100644
--- a/tokio/tests/sync_broadcast.rs
+++ b/tokio/tests/sync_broadcast.rs
@@ -492,8 +492,5 @@ fn lagging_receiver_recovers_after_wrap_open() {
}
fn is_closed(err: broadcast::RecvError) -> bool {
- match err {
- broadcast::RecvError::Closed => true,
- _ => false,
- }
+ matches!(err, broadcast::RecvError::Closed)
}