diff options
| author | Jacherr <jwc2002@outlook.com> | 2023-11-15 01:10:20 +0000 |
|---|---|---|
| committer | Jacherr <jwc2002@outlook.com> | 2023-11-15 01:10:20 +0000 |
| commit | 11881bee6bd99852ed7777ecfa1bee241fdd4c73 (patch) | |
| tree | 2390c4ef646bd5d669e36e15186a0892cd614110 | |
| parent | a86a57079dcbd5144343a4dbc3dd318702a12ea5 (diff) | |
| download | rust-11881bee6bd99852ed7777ecfa1bee241fdd4c73.tar.gz rust-11881bee6bd99852ed7777ecfa1bee241fdd4c73.zip | |
also move `module_style` to `span_lint_x` functions
| -rw-r--r-- | clippy_lints/src/module_style.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/clippy_lints/src/module_style.rs b/clippy_lints/src/module_style.rs index b49a5614329..cd45467407e 100644 --- a/clippy_lints/src/module_style.rs +++ b/clippy_lints/src/module_style.rs @@ -1,3 +1,4 @@ +use clippy_utils::diagnostics::span_lint_and_help; use rustc_ast::ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_lint::{EarlyContext, EarlyLintPass, Level, LintContext}; @@ -124,11 +125,13 @@ impl EarlyLintPass for ModStyle { correct.pop(); correct.push(folder); correct.push("mod.rs"); - cx.struct_span_lint( + span_lint_and_help( + cx, SELF_NAMED_MODULE_FILES, Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None), - format!("`mod.rs` files are required, found `{}`", path.display()), - |lint| lint.help(format!("move `{}` to `{}`", path.display(), correct.display(),)), + &format!("`mod.rs` files are required, found `{}`", path.display()), + None, + &format!("move `{}` to `{}`", path.display(), correct.display(),), ); } } @@ -162,11 +165,13 @@ fn check_self_named_mod_exists(cx: &EarlyContext<'_>, path: &Path, file: &Source mod_file.pop(); mod_file.set_extension("rs"); - cx.struct_span_lint( + span_lint_and_help( + cx, MOD_MODULE_FILES, Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None), - format!("`mod.rs` files are not allowed, found `{}`", path.display()), - |lint| lint.help(format!("move `{}` to `{}`", path.display(), mod_file.display())), + &format!("`mod.rs` files are not allowed, found `{}`", path.display()), + None, + &format!("move `{}` to `{}`", path.display(), mod_file.display()), ); } } |
