-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thing
Description
Encountered something like that in the wild:
loop {
let (e, l) = match s.split_whitespace().next() {
Some(word) => (word.is_empty(), word.len()),
None => break
};
let _ = (e, l);
}produces:
foo.rs:46:5: 53:6 error: this loop could be written as a `while let` loop
foo.rs:46 loop {
foo.rs:47 let (e, l) = match s.split_whitespace().next() {
foo.rs:48 Some(word) => (word.is_empty(), word.len()),
foo.rs:49 None => break
foo.rs:50 };
foo.rs:51
...
foo.rs:4:9: 4:23 note: lint level defined here
foo.rs:4 #![deny(while_let_loop)]
^~~~~~~~~~~~~~
foo.rs:46:5: 53:6 help: try
while let Some(word) = s.split_whitespace().next() {
let _ = (e, l);
}Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thing