2
0
Fork 0
mirror of https://github.com/rust-lang/rust-clippy synced 2025-03-06 16:27:35 +00:00
rust-clippy/tests/ui/map_collect_result_unit.fixed

16 lines
407 B
Rust
Raw Normal View History

#![warn(clippy::map_collect_result_unit)]
fn main() {
{
let _ = (0..3).try_for_each(|t| Err(t + 1));
let _: Result<(), _> = (0..3).try_for_each(|t| Err(t + 1));
let _ = (0..3).try_for_each(|t| Err(t + 1));
}
}
fn _ignore() {
let _ = (0..3).map(|t| Err(t + 1)).collect::<Result<Vec<i32>, _>>();
let _ = (0..3).map(|t| Err(t + 1)).collect::<Vec<Result<(), _>>>();
}