Skip to content

clippy::redundant_pub_crate conflicts with rustc::unreachable_pub #5369

@matthiaskrgr

Description

@matthiaskrgr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions