Use drop instead of the toilet closure |_| ()

This commit is contained in:
Lzu Tao
2020-01-02 08:56:12 +00:00
parent 5095101528
commit dd8f072233
25 changed files with 35 additions and 35 deletions

View File

@@ -23,7 +23,7 @@ impl B {
async fn can_error(some_string: &str) -> Result<(), String> {
let a = A { inner: vec![some_string, "foo"] };
let mut b = B {};
Ok(b.something_with_a(a).await.map(|_| ())?)
Ok(b.something_with_a(a).await.map(drop)?)
}
fn main() {

View File

@@ -3,6 +3,6 @@
#![deny(unused_mut)]
fn main() {
vec![42].iter().map(|_| ()).count();
vec![42].iter().map(drop).count();
vec![(42, 22)].iter().map(|(_x, _y)| ()).count();
}

View File

@@ -17,7 +17,7 @@ fn assert_invalid_input<T>(on: &str, result: io::Result<T>) {
"{} returned a strange {:?} on a path with NUL", on, e.kind()),
}
}
inner(on, result.map(|_| ()))
inner(on, result.map(drop))
}
fn main() {