rust-lang / rust-lang/rust-clippy
clippy::redundant_pub_crate conflicts with rustc::unreachable_pub
Open
Nobody has claimed this yet.
C-bug
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
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: unreachable `pub` item
--> 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the conflict using the example in src/test_helpers.rs, with unreachable_pub enabled from src/main.rs. Read the redundant_pub_crate lint and its existing regression tests to determine how the two visibility diagnostics interact. Done means the conflicting warnings are handled consistently without regressing either lint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100