Skip to content

Commit 37be44e

Browse files
committed
Update toolchain to alleviate downstream rust-lang/rust#80691
Also removes expect_none usages as it has been removed and recommended to be replaced with asserts by the compiler devs
1 parent 93e696c commit 37be44e

File tree

6 files changed

+35
-37
lines changed

6 files changed

+35
-37
lines changed

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "nightly-2021-03-15"
2+
channel = "nightly-2021-04-17"

snocat-cli/src/client.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,12 @@ pub async fn client_main(config: ClientArgs) -> Result<()> {
151151
let add_new_connection = move |pair: BoxedTunnelPair<'static>| -> u32 {
152152
let connection_id = current_connection_id;
153153
current_connection_id += 1;
154-
connections
155-
.attach_stream(connection_id, stream::once(future::ready(pair)).boxed())
156-
.expect_none("Connection IDs must be unique");
154+
assert!(
155+
connections
156+
.attach_stream(connection_id, stream::once(future::ready(pair)).boxed())
157+
.is_none(),
158+
"Connection IDs must be unique"
159+
);
157160
connection_id
158161
};
159162
(add_new_connection, connections_handle)

snocat-cli/src/main.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
#![feature(nll)]
44
#![feature(async_closure)]
55
#![feature(backtrace)]
6-
#![feature(debug_non_exhaustive)]
76
#![feature(label_break_value)]
8-
#![feature(option_expect_none)]
97
#![allow(dead_code)]
108
#![warn(unused_imports)]
119

snocat/src/common/protocol/traits.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,19 @@ impl TunnelRegistry for InMemoryTunnelRegistry {
217217
if name.is_some() && tunnels.iter().any(|(_id, record)| record.name == name) {
218218
return Err(TunnelRegistrationError::NameOccupied(name.unwrap()));
219219
}
220-
tunnels
221-
.insert(
222-
tunnel_id,
223-
TunnelRecord {
224-
id: tunnel_id,
225-
name: name,
226-
tunnel,
227-
},
228-
)
229-
.expect_none("TunnelId overlap despite locked map where contains_key returned false");
220+
assert!(
221+
tunnels
222+
.insert(
223+
tunnel_id,
224+
TunnelRecord {
225+
id: tunnel_id,
226+
name: name,
227+
tunnel,
228+
},
229+
)
230+
.is_none(),
231+
"TunnelId overlap despite locked map where contains_key returned false"
232+
);
230233
Ok(())
231234
}
232235
.boxed()

snocat/src/common/tunnel_source/mod.rs

+15-18
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,11 @@ mod tests {
251251
let a = stream::iter(vec!['a']).boxed();
252252
let b = stream::iter(vec!['b']).boxed();
253253
let c = stream::iter(vec!['c']).boxed();
254-
set
255-
.attach_stream(1u32, a)
256-
.expect_none("Must attach to blank");
257-
set
258-
.attach_stream(2u32, b)
259-
.expect_none("Must attach to non-blank with new key");
254+
assert!(set.attach_stream(1u32, a).is_none(), "Must attach to blank");
255+
assert!(
256+
set.attach_stream(2u32, b).is_none(),
257+
"Must attach to non-blank with new key"
258+
);
260259
let mut replaced_b = set
261260
.attach_stream(2u32, c)
262261
.expect("Must overwrite keys and return an old one");
@@ -288,12 +287,11 @@ mod tests {
288287
let a = stream::iter(vec!['a']).boxed();
289288
let b = stream::iter(vec!['b']).boxed();
290289
let c = stream::iter(vec!['c']).boxed();
291-
set
292-
.attach_stream(1u32, a)
293-
.expect_none("Must attach to blank");
294-
set
295-
.attach_stream(2u32, b)
296-
.expect_none("Must attach to non-blank with new key");
290+
assert!(set.attach_stream(1u32, a).is_none(), "Must attach to blank");
291+
assert!(
292+
set.attach_stream(2u32, b).is_none(),
293+
"Must attach to non-blank with new key"
294+
);
297295
set
298296
.attach_stream(2u32, c)
299297
.expect("Must replace existing keys");
@@ -311,13 +309,12 @@ mod tests {
311309
use std::sync::Arc;
312310
let set = Arc::new(DynamicStreamSet::<u32, i32>::new());
313311
let a = stream::iter(vec![1, 2, 3]).boxed();
314-
set
315-
.attach_stream(1u32, a)
316-
.expect_none("Must attach to blank");
312+
assert!(set.attach_stream(1u32, a).is_none(), "Must attach to blank");
317313
let collected = set.handle().collect::<Vec<_>>().await;
318314
assert_eq!(collected.as_slice(), &[(1, 1), (1, 2), (1, 3)]);
319-
set
320-
.detach(&1u32)
321-
.expect_none("Must have already detached if polled to empty");
315+
assert!(
316+
set.detach(&1u32).is_none(),
317+
"Must have already detached if polled to empty"
318+
);
322319
}
323320
}

snocat/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
#![feature(nll)]
44
#![feature(async_closure)]
55
#![feature(backtrace)]
6-
#![feature(debug_non_exhaustive)]
76
#![feature(drain_filter)]
87
#![feature(label_break_value)]
98
#![feature(never_type)]
10-
#![feature(option_expect_none)]
11-
#![feature(or_patterns)]
129
#![feature(try_blocks)]
1310
#![feature(type_ascription)]
1411
#![allow(dead_code)]

0 commit comments

Comments
 (0)