|
| 1 | +use clippy_utils::diagnostics::span_lint_and_help; |
1 | 2 | use rustc_ast::ast; |
2 | 3 | use rustc_data_structures::fx::{FxHashMap, FxHashSet}; |
3 | 4 | use rustc_lint::{EarlyContext, EarlyLintPass, Level, LintContext}; |
@@ -124,11 +125,13 @@ impl EarlyLintPass for ModStyle { |
124 | 125 | correct.pop(); |
125 | 126 | correct.push(folder); |
126 | 127 | correct.push("mod.rs"); |
127 | | - cx.struct_span_lint( |
| 128 | + span_lint_and_help( |
| 129 | + cx, |
128 | 130 | SELF_NAMED_MODULE_FILES, |
129 | 131 | Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None), |
130 | | - format!("`mod.rs` files are required, found `{}`", path.display()), |
131 | | - |lint| lint.help(format!("move `{}` to `{}`", path.display(), correct.display(),)), |
| 132 | + &format!("`mod.rs` files are required, found `{}`", path.display()), |
| 133 | + None, |
| 134 | + &format!("move `{}` to `{}`", path.display(), correct.display(),), |
132 | 135 | ); |
133 | 136 | } |
134 | 137 | } |
@@ -162,11 +165,13 @@ fn check_self_named_mod_exists(cx: &EarlyContext<'_>, path: &Path, file: &Source |
162 | 165 | mod_file.pop(); |
163 | 166 | mod_file.set_extension("rs"); |
164 | 167 |
|
165 | | - cx.struct_span_lint( |
| 168 | + span_lint_and_help( |
| 169 | + cx, |
166 | 170 | MOD_MODULE_FILES, |
167 | 171 | Span::new(file.start_pos, file.start_pos, SyntaxContext::root(), None), |
168 | | - format!("`mod.rs` files are not allowed, found `{}`", path.display()), |
169 | | - |lint| lint.help(format!("move `{}` to `{}`", path.display(), mod_file.display())), |
| 172 | + &format!("`mod.rs` files are not allowed, found `{}`", path.display()), |
| 173 | + None, |
| 174 | + &format!("move `{}` to `{}`", path.display(), mod_file.display()), |
170 | 175 | ); |
171 | 176 | } |
172 | 177 | } |
0 commit comments