Skip to content

Commit 1419ac2

Browse files
authored
Suggest using #[expect] to check lint positioning (rust-lang#14327)
Using `#[allow]` will also apply to child HIR nodes, while `#[expect]` will ensure that the proper HIR node has been used for positioning the lint. changelog: none
2 parents 8178530 + e15b9a0 commit 1419ac2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clippy_utils/src/diagnostics.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn validate_diag(diag: &Diag<'_, impl EmissionGuarantee>) {
8585
/// This is needed for `#[allow]` and `#[expect]` attributes to work on the node
8686
/// highlighted in the displayed warning.
8787
///
88-
/// If you're unsure which function you should use, you can test if the `#[allow]` attribute works
88+
/// If you're unsure which function you should use, you can test if the `#[expect]` attribute works
8989
/// where you would expect it to.
9090
/// If it doesn't, you likely need to use [`span_lint_hir`] instead.
9191
///
@@ -128,7 +128,7 @@ pub fn span_lint<T: LintContext>(cx: &T, lint: &'static Lint, sp: impl Into<Mult
128128
/// This is needed for `#[allow]` and `#[expect]` attributes to work on the node
129129
/// highlighted in the displayed warning.
130130
///
131-
/// If you're unsure which function you should use, you can test if the `#[allow]` attribute works
131+
/// If you're unsure which function you should use, you can test if the `#[expect]` attribute works
132132
/// where you would expect it to.
133133
/// If it doesn't, you likely need to use [`span_lint_hir_and_then`] instead.
134134
///
@@ -183,7 +183,7 @@ pub fn span_lint_and_help<T: LintContext>(
183183
/// This is needed for `#[allow]` and `#[expect]` attributes to work on the node
184184
/// highlighted in the displayed warning.
185185
///
186-
/// If you're unsure which function you should use, you can test if the `#[allow]` attribute works
186+
/// If you're unsure which function you should use, you can test if the `#[expect]` attribute works
187187
/// where you would expect it to.
188188
/// If it doesn't, you likely need to use [`span_lint_hir_and_then`] instead.
189189
///
@@ -241,7 +241,7 @@ pub fn span_lint_and_note<T: LintContext>(
241241
/// This is needed for `#[allow]` and `#[expect]` attributes to work on the node
242242
/// highlighted in the displayed warning.
243243
///
244-
/// If you're unsure which function you should use, you can test if the `#[allow]` attribute works
244+
/// If you're unsure which function you should use, you can test if the `#[expect]` attribute works
245245
/// where you would expect it to.
246246
/// If it doesn't, you likely need to use [`span_lint_hir_and_then`] instead.
247247
pub fn span_lint_and_then<C, S, M, F>(cx: &C, lint: &'static Lint, sp: S, msg: M, f: F)
@@ -358,7 +358,7 @@ pub fn span_lint_hir_and_then(
358358
/// This is needed for `#[allow]` and `#[expect]` attributes to work on the node
359359
/// highlighted in the displayed warning.
360360
///
361-
/// If you're unsure which function you should use, you can test if the `#[allow]` attribute works
361+
/// If you're unsure which function you should use, you can test if the `#[expect]` attribute works
362362
/// where you would expect it to.
363363
/// If it doesn't, you likely need to use [`span_lint_hir_and_then`] instead.
364364
///

0 commit comments

Comments
 (0)