We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a91e96 commit 5c0c317Copy full SHA for 5c0c317
compiler/rustc_lint/src/unused.rs
@@ -914,12 +914,8 @@ trait UnusedDelimLint {
914
Closure(ref closure)
915
if matches!(closure.fn_decl.output, FnRetTy::Default(_))
916
// skip `#[core::contracts::requires(...)]` and `#[core::contracts::ensures(...)]` which generate closure
917
- && !cx
918
- .sess()
919
- .source_map()
920
- .span_to_snippet(closure.fn_decl_span)
921
- .unwrap_or_default()
922
- .contains("core::contracts") =>
+ // with span that is same as the closure body span
+ && e.span != closure.body.span =>
923
{
924
(&[closure.body.clone()][..], UnusedDelimsCtx::ClosureBody)
925
}
0 commit comments