diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-16 16:14:33 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-23 08:09:01 +1100 |
| commit | 6b359b7e1ba5ac4352f81564dc5739bb96fbaf7c (patch) | |
| tree | c229b1edd97c5ef414163de4ad2375be02d2a842 | |
| parent | cf355c6e9d9cae11cfd3ab2359a44c47d4417940 (diff) | |
| download | rust-6b359b7e1ba5ac4352f81564dc5739bb96fbaf7c.tar.gz rust-6b359b7e1ba5ac4352f81564dc5739bb96fbaf7c.zip | |
Rename `TyCtxt::struct_span_lint_hir` as `TyCtxt::node_span_lint`.
| -rw-r--r-- | clippy.toml | 2 | ||||
| -rw-r--r-- | clippy_utils/src/diagnostics.rs | 4 | ||||
| -rw-r--r-- | tests/ui-internal/disallow_span_lint.rs | 2 | ||||
| -rw-r--r-- | tests/ui-internal/disallow_span_lint.stderr | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/clippy.toml b/clippy.toml index afadbb032b7..8c405ac6a4e 100644 --- a/clippy.toml +++ b/clippy.toml @@ -3,5 +3,5 @@ avoid-breaking-exported-api = false # use the various `span_lint_*` methods instead, which also add a link to the docs disallowed-methods = [ "rustc_lint::context::LintContext::span_lint", - "rustc_middle::ty::context::TyCtxt::struct_span_lint_hir" + "rustc_middle::ty::context::TyCtxt::node_span_lint" ] diff --git a/clippy_utils/src/diagnostics.rs b/clippy_utils/src/diagnostics.rs index 86a43cb367f..56978eb2ee8 100644 --- a/clippy_utils/src/diagnostics.rs +++ b/clippy_utils/src/diagnostics.rs @@ -154,7 +154,7 @@ where pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) { #[expect(clippy::disallowed_methods)] - cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| { + cx.tcx.node_span_lint(lint, hir_id, sp, msg.to_string(), |diag| { docs_link(diag, lint); }); } @@ -168,7 +168,7 @@ pub fn span_lint_hir_and_then( f: impl FnOnce(&mut Diagnostic), ) { #[expect(clippy::disallowed_methods)] - cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| { + cx.tcx.node_span_lint(lint, hir_id, sp, msg.to_string(), |diag| { f(diag); docs_link(diag, lint); }); diff --git a/tests/ui-internal/disallow_span_lint.rs b/tests/ui-internal/disallow_span_lint.rs index 8b605b5a7e1..b9b4a07d29d 100644 --- a/tests/ui-internal/disallow_span_lint.rs +++ b/tests/ui-internal/disallow_span_lint.rs @@ -21,7 +21,7 @@ pub fn b( span: impl Into<MultiSpan>, msg: impl Into<DiagnosticMessage>, ) { - tcx.struct_span_lint_hir(lint, hir_id, span, msg, |_| {}); + tcx.node_span_lint(lint, hir_id, span, msg, |_| {}); } fn main() {} diff --git a/tests/ui-internal/disallow_span_lint.stderr b/tests/ui-internal/disallow_span_lint.stderr index 9b1010a1b6d..03556823a8f 100644 --- a/tests/ui-internal/disallow_span_lint.stderr +++ b/tests/ui-internal/disallow_span_lint.stderr @@ -7,10 +7,10 @@ LL | cx.span_lint(lint, span, msg, |_| {}); = note: `-D clippy::disallowed-methods` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::disallowed_methods)]` -error: use of a disallowed method `rustc_middle::ty::context::TyCtxt::struct_span_lint_hir` +error: use of a disallowed method `rustc_middle::ty::context::TyCtxt::node_span_lint` --> $DIR/disallow_struct_span_lint.rs:24:5 | -LL | tcx.struct_span_lint_hir(lint, hir_id, span, msg, |_| {}); +LL | tcx.node_span_lint(lint, hir_id, span, msg, |_| {}); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors |
