Fix clippy tests that trigger `for_loop_over_fallibles` lint

This commit is contained in:
Maybe Waffle 2022-08-25 14:03:13 +04:00
parent 4013d367fe
commit 3fc903eb95
3 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@
clippy::for_kv_map
)]
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
#[allow(for_loop_over_fallibles)]
fn main() {
let vec = vec![1, 2, 3, 4];

View File

@ -1,5 +1,5 @@
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
--> $DIR/for_loop_unfixable.rs:14:15
--> $DIR/for_loop_unfixable.rs:15:15
|
LL | for _v in vec.iter().next() {}
| ^^^^^^^^^^^^^^^^^

View File

@ -1,5 +1,6 @@
#![warn(clippy::for_loops_over_fallibles)]
#![allow(clippy::uninlined_format_args)]
#![allow(for_loop_over_fallibles)]
fn for_loops_over_fallibles() {
let option = Some(1);