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:
commit
a2bd02b57e
3 changed files with 22 additions and 2 deletions
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue