-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mod_module_files does nothing #8123
Comments
After further investigation, I'm a bit confused. In an attempt to debug this somewhat I cloned and edited clippy to put in some diagnostics, and followed the steps in basics.md (linked from CONTRIBUTING.md) to install clippy from source. For some reason running I may (?) have found the source of the issue:
I don't have a way to verify whether this is also true when clippy is run as |
The purpose of that match guard is to prevent it from warning on dependencies, basically, it was a way of filtering out paths like I can also confirm on a new lib/bin with a module folder and a |
Summary
TL;DR: clippy::mod_module_files seems to do absolutely nothing, whether as a crate attribute or as a command line arg.
I'm using clippy via rustup
This occurs both on my laptop (WSL, Ubuntu 18.04) as well as a remote server (Ubuntu 20.04), but most of this was done on my laptop, I just checked the command line option on the remote to rule out this being WSL related.
cargo clippy -V
: clippy 0.1.57 (f1edd04 2021-11-29)EDIT:
In case this is useful: I cloned the clippy repo, and ran the tests (which passed) but if I manually
cd
into the test directories and runcargo clippy
(or nightly) the results did not match up with what the relevantsrc/main.stderr
contained.i.e.
vs
^ would expect an error based on the contents of
tests/ui-cargo/module_style/fail_mod/src/main.stderr
(unless I'm misunderstanding how these tests work...)Reproducer
I used
cargo new my_project
to start a new project.I created a file
my_project/src/my_module/mod.rs
with the (presumably unimportant) contents:my_project/src/main.rs
:running
cargo clippy
correctly gives an error for the use of.expect
but no module errorsI expected to see an error due to a
mod.rs
file (I included self_named as well in case I somehow mixed the two up. - in a larger project that has both mod.rs and self named modules, neither lint seems to do anything.)I thought this could be related to #6610 so I added a
.cargo/config.toml
:( I tried it with just expect, just module_files, both, neither)
and then I tried running
cargo clippy -- -W clippy::mod_module_files
to no availall three of these methods worked with a variety of other lints I tried, and all three give an error if the named lint does not exist (or if the name is misspelled), I tried them each individually and in concert. I think this rules out e.g. accidentally using the wrong clippy version or a typo on my part (as there would have been an error that the lint does not exist, which did happen when I first tested on another machine, until I ran
rustup update
).I also initially ran
mod_module_files
(and self named) on a larger project (the above was to redo it on a minimal example to make sure it wasn't some weird configuration issue or something on the larger project). I cannot getmod_module_files
to give a warning/error on anything at all.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: