Skip to content

Commit 11881be

Browse files
committed
also move module_style to span_lint_x functions
1 parent a86a570 commit 11881be

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

clippy_lints/src/module_style.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use clippy_utils::diagnostics::span_lint_and_help;
12
use rustc_ast::ast;
23
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
34
use rustc_lint::{EarlyContext, EarlyLintPass, Level, LintContext};
@@ -124,11 +125,13 @@ impl EarlyLintPass for ModStyle {
124125
correct.pop();
125126
correct.push(folder);
126127
correct.push("mod.rs");
127-
cx.struct_span_lint(
128+
span_lint_and_help(
129+
cx,
128130
SELF_NAMED_MODULE_FILES,
129131
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(),),
132135
);
133136
}
134137
}
@@ -162,11 +165,13 @@ fn check_self_named_mod_exists(cx: &EarlyContext<'_>, path: &Path, file: &Source
162165
mod_file.pop();
163166
mod_file.set_extension("rs");
164167

165-
cx.struct_span_lint(
168+
span_lint_and_help(
169+
cx,
166170
MOD_MODULE_FILES,
167171
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()),
170175
);
171176
}
172177
}

0 commit comments

Comments
 (0)