about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/noop_method_call.rs
diff options
context:
space:
mode:
authorRejyr <jerrylwang123@gmail.com>2022-09-05 12:42:58 -0400
committerRejyr <jerrylwang123@gmail.com>2023-01-09 17:07:25 -0500
commit56fc66d196378a1af26631cbedabdcd07883bf3f (patch)
tree7add9af5cc2b556e63916be8420c100ea8444083 /compiler/rustc_lint/src/noop_method_call.rs
parent6fb3a38f9b27b328c6209147793602545d291b85 (diff)
downloadrust-56fc66d196378a1af26631cbedabdcd07883bf3f.tar.gz
rust-56fc66d196378a1af26631cbedabdcd07883bf3f.zip
migrate: `noop_method_call.rs`
Diffstat (limited to 'compiler/rustc_lint/src/noop_method_call.rs')
-rw-r--r--compiler/rustc_lint/src/noop_method_call.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs
index 2ef425a1093..3fba95f0750 100644
--- a/compiler/rustc_lint/src/noop_method_call.rs
+++ b/compiler/rustc_lint/src/noop_method_call.rs
@@ -1,7 +1,10 @@
+#![deny(rustc::untranslatable_diagnostic)]
+#![deny(rustc::diagnostic_outside_of_impl)]
 use crate::context::LintContext;
+use crate::lints::NoopMethodCallDiag;
+use crate::rustc_middle::ty::TypeVisitable;
 use crate::LateContext;
 use crate::LateLintPass;
-use rustc_errors::fluent;
 use rustc_hir::def::DefKind;
 use rustc_hir::{Expr, ExprKind};
 use rustc_middle::ty;
@@ -85,11 +88,10 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
         }
         let expr_span = expr.span;
         let span = expr_span.with_lo(receiver.span.hi());
-        cx.struct_span_lint(NOOP_METHOD_CALL, span, fluent::lint_noop_method_call, |lint| {
-            lint.set_arg("method", call.ident.name)
-                .set_arg("receiver_ty", receiver_ty)
-                .span_label(span, fluent::label)
-                .note(fluent::note)
-        });
+        cx.emit_spanned_lint(
+            NOOP_METHOD_CALL,
+            span,
+            NoopMethodCallDiag { method: call.ident.name, receiver_ty, label: span },
+        );
     }
 }