Skip to content

Regression in lint level attributes taking effect across files #5356

Closed
@dtolnay

Description

@dtolnay

In nightly-2020-03-19, an allow attribute correctly suppresses clippy lints in out-of-line child modules. In nightly-2020-03-23 it no longer does.

src/lib.rs

#![allow(clippy::redundant_field_names)]

pub mod m;

pub struct S {
    pub x: u8,
}

src/m.rs

pub fn f(x: u8) {
    let _ = crate::S { x: x };
}
$ cargo +nightly-2020-03-19 clippy
    Checking testing v0.0.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.24s

$ cargo +nightly-2020-03-23 clippy
    Checking testing v0.0.0
warning: redundant field names in struct initialization
 --> src/m.rs:2:24
  |
2 |     let _ = crate::S { x: x };
  |                        ^^^^ help: replace it with: `x`
  |
  = note: `#[warn(clippy::redundant_field_names)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

    Finished dev [unoptimized + debuginfo] target(s) in 0.23s

Inline modules (pub mod m { ... }) do not appear to be affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions