rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Conflicting with rustc lints

Open uselessgoddess opened this issue 2 years ago • 0 comments

I tried use unreachable_pub from rustc and redundant_pub_crate from clippy. I get a cyclical contradiction.

#![deny(unreachable_pub)]
#![deny(clippy::redundant_pub_crate)]

pub(crate) mod internal1 {
    pub(crate) fn foo() {}
}

pub(crate) mod internal2 {
    pub fn foo() {}
}
error: pub(crate) function inside private module
 --> src\main.rs:5:5
  |
5 |     pub(crate) fn foo() {}
  |     ----------^^^^^^^
  |     |
  |     help: consider using: `pub`
  |

error: unreachable `pub` item
 --> src\main.rs:9:5
  |
9 |     pub fn foo() {}
  |     ---^^^^^^^^^
  |     |
  |     help: consider restricting its visibility: `pub(crate)`
  |

rustc suggest use pub fn foo clippy suggest use pub(crate) fn foo

Who should I believe?

Version

rustc 1.65.0-nightly (f03ce3096 2022-08-08)
binary: rustc
commit-hash: f03ce30962cf1b2a5158667eabae8bf6e8d1cb03
commit-date: 2022-08-08
host: x86_64-pc-windows-msvc
release: 1.65.0-nightly
LLVM version: 14.0.6

uselessgoddess avatar Aug 09 '22 17:08 uselessgoddess