about summary refs log tree commit diff
path: root/src/tools/clippy/tests
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-05-22 16:46:05 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2024-05-23 04:08:35 +0200
commit06bc4fc67145e3a7be9b5a2cf2b5968cef36e587 (patch)
treee1a7e22564518a44d73943359309ad3c460fe67a /src/tools/clippy/tests
parent366ef954073bdaebe83e6619430ae0e8d17b9850 (diff)
downloadrust-06bc4fc67145e3a7be9b5a2cf2b5968cef36e587.tar.gz
rust-06bc4fc67145e3a7be9b5a2cf2b5968cef36e587.zip
Remove `LintDiagnostic::msg`
* instead simply set the primary message inside the lint decorator functions
* it used to be this way before [#]101986 which introduced `msg` to prevent
  good path delayed bugs (which no longer exist) from firing under certain
  circumstances when lints were suppressed / silenced
* this is no longer necessary for various reasons I presume
* it shaves off complexity and makes further changes easier to implement
Diffstat (limited to 'src/tools/clippy/tests')
-rw-r--r--src/tools/clippy/tests/ui-internal/disallow_span_lint.rs4
-rw-r--r--src/tools/clippy/tests/ui-internal/disallow_span_lint.stderr8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/clippy/tests/ui-internal/disallow_span_lint.rs b/src/tools/clippy/tests/ui-internal/disallow_span_lint.rs
index 5a2a868ed3e..b91a83308b5 100644
--- a/src/tools/clippy/tests/ui-internal/disallow_span_lint.rs
+++ b/src/tools/clippy/tests/ui-internal/disallow_span_lint.rs
@@ -11,11 +11,11 @@ use rustc_lint::{Lint, LintContext};
 use rustc_middle::ty::TyCtxt;
 
 pub fn a(cx: impl LintContext, lint: &'static Lint, span: impl Into<MultiSpan>, msg: impl Into<DiagMessage>) {
-    cx.span_lint(lint, span, msg, |_| {});
+    cx.span_lint(lint, span, |lint| { lint.primary_message(msg); });
 }
 
 pub fn b(tcx: TyCtxt<'_>, lint: &'static Lint, hir_id: HirId, span: impl Into<MultiSpan>, msg: impl Into<DiagMessage>) {
-    tcx.node_span_lint(lint, hir_id, span, msg, |_| {});
+    tcx.node_span_lint(lint, hir_id, span, |lint| { lint.primary_message(msg); });
 }
 
 fn main() {}
diff --git a/src/tools/clippy/tests/ui-internal/disallow_span_lint.stderr b/src/tools/clippy/tests/ui-internal/disallow_span_lint.stderr
index cfc590bed36..1cfbc8efc8e 100644
--- a/src/tools/clippy/tests/ui-internal/disallow_span_lint.stderr
+++ b/src/tools/clippy/tests/ui-internal/disallow_span_lint.stderr
@@ -1,8 +1,8 @@
 error: use of a disallowed method `rustc_lint::context::LintContext::span_lint`
   --> tests/ui-internal/disallow_span_lint.rs:14:5
    |
-LL |     cx.span_lint(lint, span, msg, |_| {});
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     cx.span_lint(lint, span, |lint| { lint.primary_message(msg); });
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint*` functions instead (from clippy.toml)
    = note: `-D clippy::disallowed-methods` implied by `-D warnings`
@@ -11,8 +11,8 @@ LL |     cx.span_lint(lint, span, msg, |_| {});
 error: use of a disallowed method `rustc_middle::ty::context::TyCtxt::node_span_lint`
   --> tests/ui-internal/disallow_span_lint.rs:18:5
    |
-LL |     tcx.node_span_lint(lint, hir_id, span, msg, |_| {});
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     tcx.node_span_lint(lint, hir_id, span, |lint| { lint.primary_message(msg); });
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint_hir*` functions instead (from clippy.toml)