Skip to content

Clippy ignores crate wide warn/deny #6610

Closed
@tcharding

Description

@tcharding

I put this code in main.rs

#![deny(clippy::print_stdout)]

mod foo;

#[allow(clippy::print_stdout)]
fn main() {
    println!("Hello, world!");
}

And this code in foo.rs

pub fn foo() {
    println!("This should trigger clippy");
}

I expected to see clippy warn something like


error: use of `println!`
 --> src/foo.rs:2:5
  |
6 |     println!("This should trigger clippy");
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^

Instead all I get is

warning: function is never used: `foo`

Meta

cargo clippy -V                                                                                                            ✘ 101 
clippy 0.1.51 (4253153 2021-01-17)
rustc -Vv
rustc 1.51.0-nightly (4253153db 2021-01-17)
binary: rustc
commit-hash: 4253153db205251f72ea4493687a31e04a2a8ca0
commit-date: 2021-01-17
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions