Refactor rustc lint API
This commit is contained in:
@@ -253,13 +253,12 @@ fn late_report_deprecation(
|
||||
return;
|
||||
}
|
||||
let method_span = method_span.unwrap_or(span);
|
||||
tcx.struct_span_lint_hir(lint, hir_id, method_span, |lint| {
|
||||
let mut diag = lint.build(message);
|
||||
tcx.struct_span_lint_hir(lint, hir_id, method_span, message, |diag| {
|
||||
if let hir::Node::Expr(_) = tcx.hir().get(hir_id) {
|
||||
let kind = tcx.def_kind(def_id).descr(def_id);
|
||||
deprecation_suggestion(&mut diag, kind, suggestion, method_span);
|
||||
deprecation_suggestion(diag, kind, suggestion, method_span);
|
||||
}
|
||||
diag.emit();
|
||||
diag
|
||||
});
|
||||
}
|
||||
|
||||
@@ -621,9 +620,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
unmarked: impl FnOnce(Span, DefId),
|
||||
) -> bool {
|
||||
let soft_handler = |lint, span, msg: &_| {
|
||||
self.struct_span_lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, |lint| {
|
||||
lint.build(msg).emit();
|
||||
})
|
||||
self.struct_span_lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, msg, |lint| lint)
|
||||
};
|
||||
let eval_result =
|
||||
self.eval_stability_allow_unstable(def_id, id, span, method_span, allow_unstable);
|
||||
|
||||
Reference in New Issue
Block a user