This is my project: https://github.com/matthiaskrgr/cargo-cache
With clippy, I was getting for example
warning: pub(crate) function inside private module
--> src/test_helpers.rs:38:1
|
38 | pub(crate) fn assert_path_end(path: &PathBuf, wanted_vector: &[&str]) {
| ----------^^^^^^^^^^^^^^^^^^^
| |
| help: consider using: `pub`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
However, when I make the function pub
pub fn assert_path_end(path: &PathBuf, wanted_vector: &[&str]) {
rustc warns:
```
Checking cargo-cache v0.4.1 (/home/matthias/vcs/github/cargo-cache)
warning: unreachablepubitem
--> src/test_helpers.rs:38:1
|
38 | pub fn assert_path_end(path: &PathBuf, wanted_vector: &[&str]) {
| ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| help: consider restricting its visibility:pub(crate)`
|
note: the lint level is defined here
--> src/main.rs:19:5
|
19 | unreachable_pub,
| ^^^^^^^^^^^^^^^
= help: or consider exporting it for use by other crates
Finished dev [unoptimized + debuginfo] target(s) in 0.40s
````
We should move this lint to nursery until this is fixed.
cc @1tgr I think this lint needs some more work.
IMO the lint shouldn't move out of the nursery until rust-lang/rust#74970 is fixed as well. Like it or not, behavior _is_ different currently.
Honestly, I'd prefer the lint be removed outright, but that's obviously my opinion.
#![deny(unreachable_pub)]
#![deny(clippy::redundant_pub_crate)]
pub(crate) mod utils {
mod foo {
/* error: pub(crate) import inside private module */
pub(crate) fn print_foo() {
println!("foo")
}
}
/* error: pub(crate) import inside private module */
pub(crate) use self::foo::print_foo;
mod bar {
/* error: unreachable `pub` item */
pub fn print_bar() {
println!("bar")
}
}
/* error: unreachable `pub` item */
pub use self::bar::print_bar;
}
fn main() {}
Most helpful comment
IMO the lint shouldn't move out of the nursery until rust-lang/rust#74970 is fixed as well. Like it or not, behavior _is_ different currently.
Honestly, I'd prefer the lint be removed outright, but that's obviously my opinion.