Skip to content

Commit 6b359b7

Browse files
committed
Rename TyCtxt::struct_span_lint_hir as TyCtxt::node_span_lint.
1 parent cf355c6 commit 6b359b7

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

clippy.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ avoid-breaking-exported-api = false
33
# use the various `span_lint_*` methods instead, which also add a link to the docs
44
disallowed-methods = [
55
"rustc_lint::context::LintContext::span_lint",
6-
"rustc_middle::ty::context::TyCtxt::struct_span_lint_hir"
6+
"rustc_middle::ty::context::TyCtxt::node_span_lint"
77
]

clippy_utils/src/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ where
154154

155155
pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, msg: &str) {
156156
#[expect(clippy::disallowed_methods)]
157-
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| {
157+
cx.tcx.node_span_lint(lint, hir_id, sp, msg.to_string(), |diag| {
158158
docs_link(diag, lint);
159159
});
160160
}
@@ -168,7 +168,7 @@ pub fn span_lint_hir_and_then(
168168
f: impl FnOnce(&mut Diagnostic),
169169
) {
170170
#[expect(clippy::disallowed_methods)]
171-
cx.tcx.struct_span_lint_hir(lint, hir_id, sp, msg.to_string(), |diag| {
171+
cx.tcx.node_span_lint(lint, hir_id, sp, msg.to_string(), |diag| {
172172
f(diag);
173173
docs_link(diag, lint);
174174
});

tests/ui-internal/disallow_span_lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn b(
2121
span: impl Into<MultiSpan>,
2222
msg: impl Into<DiagnosticMessage>,
2323
) {
24-
tcx.struct_span_lint_hir(lint, hir_id, span, msg, |_| {});
24+
tcx.node_span_lint(lint, hir_id, span, msg, |_| {});
2525
}
2626

2727
fn main() {}

tests/ui-internal/disallow_span_lint.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ LL | cx.span_lint(lint, span, msg, |_| {});
77
= note: `-D clippy::disallowed-methods` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::disallowed_methods)]`
99

10-
error: use of a disallowed method `rustc_middle::ty::context::TyCtxt::struct_span_lint_hir`
10+
error: use of a disallowed method `rustc_middle::ty::context::TyCtxt::node_span_lint`
1111
--> $DIR/disallow_struct_span_lint.rs:24:5
1212
|
13-
LL | tcx.struct_span_lint_hir(lint, hir_id, span, msg, |_| {});
13+
LL | tcx.node_span_lint(lint, hir_id, span, msg, |_| {});
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515

1616
error: aborting due to 2 previous errors

0 commit comments

Comments
 (0)