Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sfackler opened this issue Jun 16, 2020 · 2 comments
Closed

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

sfackler opened this issue Jun 16, 2020 · 2 comments

Comments

@sfackler
Copy link
Member

sfackler commented Jun 16, 2020

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,
        }
    }
}
@flip1995
Copy link
Member

Duplicate of #5356

@flip1995 flip1995 marked this as a duplicate of #5356 Jun 16, 2020
@flip1995
Copy link
Member

Fixed in #5651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants