mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
macros: add #[allow(unused_mut)] to select! (#2858)
This commit is contained in:
parent
cb8f2ceb2e
commit
e09b90ea32
@ -404,6 +404,7 @@ macro_rules! select {
|
|||||||
// The future returned a value, check if matches
|
// The future returned a value, check if matches
|
||||||
// the specified pattern.
|
// the specified pattern.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
|
#[allow(unused_mut)]
|
||||||
match &out {
|
match &out {
|
||||||
$bind => {}
|
$bind => {}
|
||||||
_ => continue,
|
_ => continue,
|
||||||
|
@ -462,3 +462,20 @@ async fn async_never() -> ! {
|
|||||||
tokio::time::delay_for(Duration::from_millis(10)).await;
|
tokio::time::delay_for(Duration::from_millis(10)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From https://github.com/tokio-rs/tokio/issues/2857
|
||||||
|
#[tokio::test]
|
||||||
|
async fn mut_on_left_hand_side() {
|
||||||
|
let v = async move {
|
||||||
|
let ok = async { 1 };
|
||||||
|
tokio::pin!(ok);
|
||||||
|
tokio::select! {
|
||||||
|
mut a = &mut ok => {
|
||||||
|
a += 1;
|
||||||
|
a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.await;
|
||||||
|
assert_eq!(v, 2);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user