Skip to content

#[allow(clippy::...)] no longer propagates to submodules in 1.44.0 #5723

@sfackler

Description

@sfackler

Consider this simple project:

lib.rs:

#![allow(clippy::redundant_field_names)]

pub mod inner;

inner.rs:

pub struct Foo {
    pub field: i32,
}

pub fn bar() -> Foo {
    let field = 0;
    Foo {
        field: field,
    }
}

Running cargo clippy using stable 1.44.0 results in a redundant field name lint even though that lint has been disabled at the crate level:

    Checking foo v0.1.0 (/Users/sfackler/foo)
warning: redundant field names in struct initialization
 --> src/inner.rs:8:9
  |
8 |         field: field,
  |         ^^^^^^^^^^^^ help: replace it with: `field`
  |
  = 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

This does not happen with earlier 1.43.1 or other earlier releases.

If the module definition is inlined into lib.rs, the lint does not trigger:

#![allow(clippy::redundant_field_names)]

pub mod inner {
    pub struct Foo {
        pub field: i32,
    }

    pub fn bar() -> Foo {
        let field = 0;
        Foo {
            field: field,
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions