about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/methods.rs
diff options
context:
space:
mode:
authorRejyr <jerrylwang123@gmail.com>2022-09-05 15:37:30 -0400
committerRejyr <jerrylwang123@gmail.com>2023-01-09 17:07:25 -0500
commit95d3e0cb782016d7e360741a590cb07cc6413d27 (patch)
treed6109049746a9fff3e3ef890f895c9d583d50a98 /compiler/rustc_lint/src/methods.rs
parent3f69c1b523b4606d09dfdb3c8d9cb7d05e239595 (diff)
downloadrust-95d3e0cb782016d7e360741a590cb07cc6413d27.tar.gz
rust-95d3e0cb782016d7e360741a590cb07cc6413d27.zip
migrate: `methods.rs`
Diffstat (limited to 'compiler/rustc_lint/src/methods.rs')
-rw-r--r--compiler/rustc_lint/src/methods.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_lint/src/methods.rs b/compiler/rustc_lint/src/methods.rs
index e2d7d5b49f6..06d4d2d2340 100644
--- a/compiler/rustc_lint/src/methods.rs
+++ b/compiler/rustc_lint/src/methods.rs
@@ -1,7 +1,9 @@
+#![deny(rustc::untranslatable_diagnostic)]
+#![deny(rustc::diagnostic_outside_of_impl)]
+use crate::lints::CStringPtr;
 use crate::LateContext;
 use crate::LateLintPass;
 use crate::LintContext;
-use rustc_errors::fluent;
 use rustc_hir::{Expr, ExprKind, PathSegment};
 use rustc_middle::ty;
 use rustc_span::{symbol::sym, ExpnKind, Span};
@@ -90,16 +92,10 @@ fn lint_cstring_as_ptr(
         if cx.tcx.is_diagnostic_item(sym::Result, def.did()) {
             if let ty::Adt(adt, _) = substs.type_at(0).kind() {
                 if cx.tcx.is_diagnostic_item(sym::cstring_type, adt.did()) {
-                    cx.struct_span_lint(
+                    cx.emit_spanned_lint(
                         TEMPORARY_CSTRING_AS_PTR,
                         as_ptr_span,
-                        fluent::lint_cstring_ptr,
-                        |diag| {
-                            diag.span_label(as_ptr_span, fluent::as_ptr_label)
-                                .span_label(unwrap.span, fluent::unwrap_label)
-                                .note(fluent::note)
-                                .help(fluent::help)
-                        },
+                        CStringPtr { as_ptr: as_ptr_span, unwrap: unwrap.span },
                     );
                 }
             }