-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
Let's say you have a project:
api/
|- foo/
|- src/
|- lib.rs
|- Cargo.toml
src/
|- foo.rs
|- lib.rs
Cargo.toml
# /Cargo.toml
[package]
name = "false_positive"
version = "0.1.0"
edition = "2021"
[workspace]
members = ["api/*"]
[dependencies]
renamed_foo = { path = "api/foo" }// /src/lib.rs
mod foo;
pub use foo::*;
pub use renamed_foo::*;# /api/foo/Cargo.toml
[package]
name = "renamed_foo" # Not the same name as the dir
version = "0.1.0"
edition = "2021"
[dependencies]// /api/foo/src/lib.rs
// Note: This is important that this file is not empty.
pub fn function() {}Lint Name
clippy::self-named-module-files
Reproducer
I tried to run with:
cargo clippy -- --deny=clippy::self_named_module_filesI saw this happen:
error: `mod.rs` files are required, found `src/foo.rs`
--> src/foo.rs:0:1
|
|
= help: move `src/foo.rs` to `src/foo/mod.rs`
= note: requested on the command line with `-D clippy::self-named-module-files`
error: could not compile `false_positive` due to previous errorI expected to see this happen:
no error
Version
rustc 1.66.1 (90743e729 2023-01-10)
binary: rustc
commit-hash: 90743e7298aca107ddaa0c202a4d3604e29bfeb6
commit-date: 2023-01-10
host: x86_64-unknown-linux-gnu
release: 1.66.1
LLVM version: 15.0.2
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have