We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22f57ff commit a356785Copy full SHA for a356785
clippy_lints/src/needless_for_each.rs
@@ -68,7 +68,8 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessForEach {
68
// e.g. `v.iter().for_each(f)` is simpler and clearer than using `for` loop.
69
&& let ExprKind::Closure(&Closure { body, .. }) = for_each_arg.kind
70
&& let body = cx.tcx.hir().body(body)
71
- // Skip the lint if the body is not safe.
+ // Skip the lint if the body is not safe, so as not to suggest `for … in … unsafe {}`
72
+ // and suggesting `for … in … { unsafe { } }` is a little ugly.
73
&& let ExprKind::Block(Block { rules: BlockCheckMode::DefaultBlock, .. }, ..) = body.value.kind
74
{
75
let mut ret_collector = RetCollector::default();
0 commit comments