Skip to content

Commit 58353fa

Browse files
Rollup merge of #118727 - compiler-errors:lint-decorate, r=WaffleLapkin
Don't pass lint back out of lint decorator Change the decorator function in the signature of the `emit_lint`/`span_lint`/etc family of methods from `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` to `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>)`. I consider it easier to read this way, especially when there's control flow involved. r? nnethercote though feel free to reassign
2 parents 1d54949 + 252d99a commit 58353fa

File tree

38 files changed

+53
-153
lines changed

38 files changed

+53
-153
lines changed

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,9 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
578578
hir_id,
579579
no_sanitize_span,
580580
"`no_sanitize` will have no effect after inlining",
581-
|lint| lint.span_note(inline_span, "inlining requested here"),
581+
|lint| {
582+
lint.span_note(inline_span, "inlining requested here");
583+
},
582584
)
583585
}
584586
}

compiler/rustc_hir_analysis/src/astconv/generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ pub(crate) fn prohibit_explicit_late_bound_lifetimes(
661661
args.args[0].hir_id(),
662662
multispan,
663663
msg,
664-
|lint| lint,
664+
|_| {},
665665
);
666666
}
667667

compiler/rustc_hir_analysis/src/astconv/lint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
122122
Applicability::MachineApplicable,
123123
);
124124
self.maybe_lint_blanket_trait_impl(self_ty, lint);
125-
lint
126125
},
127126
);
128127
}

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,8 +1434,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
14341434
format!("<{} as {}>::{}", qself_ty, tcx.item_name(trait_did), assoc_ident),
14351435
Applicability::MachineApplicable,
14361436
);
1437-
1438-
lint
14391437
},
14401438
);
14411439
}

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Abi) {
5151
hir_id,
5252
span,
5353
"use of calling convention not supported on this target",
54-
|lint| lint,
54+
|_| {},
5555
);
5656
}
5757
}
@@ -190,7 +190,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
190190
"static of uninhabited type",
191191
|lint| {
192192
lint
193-
.note("uninhabited statics cannot be initialized, and any access would be an immediate error")
193+
.note("uninhabited statics cannot be initialized, and any access would be an immediate error");
194194
},
195195
);
196196
}
@@ -1093,7 +1093,7 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
10931093
"this {descr} contains `{field_ty}`, which {note}, \
10941094
and makes it not a breaking change to become \
10951095
non-zero-sized in the future."
1096-
))
1096+
));
10971097
},
10981098
)
10991099
} else {

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@ fn emit_implied_wf_lint<'tcx>(
574574
Applicability::MaybeIncorrect,
575575
);
576576
}
577-
lint
578577
},
579578
);
580579
}

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
276276
lint.help(format!(
277277
"or use `{{{idx}:{default_modifier}}}` to keep the default formatting of `{default_result}`",
278278
));
279-
lint
280279
},
281280
);
282281
}

compiler/rustc_hir_analysis/src/check_unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) {
4545
item.hir_id(),
4646
path.span,
4747
msg,
48-
|lint| lint,
48+
|_| {},
4949
);
5050
}
5151
}

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ fn lint_auto_trait_impl<'tcx>(
522522
format!(
523523
"try using the same sequence of generic parameters as the {self_descr} definition",
524524
),
525-
)
525+
);
526526
},
527527
);
528528
}

compiler/rustc_hir_analysis/src/collect/generics_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
279279
param.hir_id,
280280
param.span,
281281
TYPE_DEFAULT_NOT_ALLOWED,
282-
|lint| lint,
282+
|_| {},
283283
);
284284
}
285285
Defaults::Deny => {

0 commit comments

Comments
 (0)