Skip to content

Commit

Permalink
Reword help message for both module_style lints
Browse files Browse the repository at this point in the history
  • Loading branch information
DevinR528 committed Aug 18, 2021
1 parent 86a7f28 commit 1bc9d5c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
12 changes: 2 additions & 10 deletions clippy_lints/src/module_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@ impl EarlyLintPass for ModStyle {
|build| {
let mut lint =
build.build(&format!("`mod.rs` files are required, found `{}`", path.display()));
lint.help(&format!(
"create a `{}` file and remove `{}`",
correct.display(),
path.display(),
));
lint.help(&format!("move `{}` to `{}`", path.display(), correct.display(),));
lint.emit();
},
);
Expand Down Expand Up @@ -166,11 +162,7 @@ fn check_self_named_mod_exists(cx: &EarlyContext<'_>, path: &Path, file: &Source
Span::new(file.start_pos, file.start_pos, SyntaxContext::root()),
|build| {
let mut lint = build.build(&format!("`mod.rs` files are not allowed, found `{}`", path.display()));
lint.help(&format!(
"create a `{}` file and remove `{}`",
mod_file.display(),
path.display(),
));
lint.help(&format!("move `{}` to `{}`", path.display(), mod_file.display(),));
lint.emit();
},
);
Expand Down
4 changes: 2 additions & 2 deletions tests/ui-cargo/module_style/fail_mod/src/main.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ LL | pub mod stuff;
| ^
|
= note: `-D clippy::self-named-module-files` implied by `-D warnings`
= help: create a `/bad/inner/mod.rs` file and remove `/bad/inner.rs`
= help: move `/bad/inner.rs` to `/bad/inner/mod.rs`

error: `mod.rs` files are required, found `/bad/inner/stuff.rs`
--> $DIR/bad/inner/stuff.rs:1:1
|
LL | pub mod most;
| ^
|
= help: create a `/bad/inner/stuff/mod.rs` file and remove `/bad/inner/stuff.rs`
= help: move `/bad/inner/stuff.rs` to `/bad/inner/stuff/mod.rs`

error: aborting due to 2 previous errors

2 changes: 1 addition & 1 deletion tests/ui-cargo/module_style/fail_no_mod/src/main.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | pub struct Thing;
| ^
|
= note: `-D clippy::mod-module-files` implied by `-D warnings`
= help: create a `/bad.rs` file and remove `/bad/mod.rs`
= help: move `/bad/mod.rs` to `/bad.rs`

error: aborting due to previous error

0 comments on commit 1bc9d5c

Please sign in to comment.