Auto merge of #12515 - bend-n:🦀, r=llogiq

fix `for x in y unsafe { }`

fixes #12514

----

changelog: [`needless_for_each`]: unsafe block in for loop body suggestion
This commit is contained in:
bors 2024-05-02 12:36:42 +00:00
commit a2bd02b57e
3 changed files with 22 additions and 2 deletions

View file

@ -113,6 +113,10 @@ fn should_not_lint() {
let _ = v.iter().for_each(|elem| {
acc += elem;
});
// `for_each` has a closure with an unsafe block.
v.iter().for_each(|elem| unsafe {
acc += elem;
});
}
fn main() {}

View file

@ -113,6 +113,10 @@ fn should_not_lint() {
let _ = v.iter().for_each(|elem| {
acc += elem;
});
// `for_each` has a closure with an unsafe block.
v.iter().for_each(|elem| unsafe {
acc += elem;
});
}
fn main() {}