Skip to content

Regression in lint level attributes taking effect across files #5356

Closed
@dtolnay

Description

@dtolnay
Member

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.

Activity

added
C-bugCategory: Clippy is not doing the correct thing
on Mar 23, 2020
flip1995

flip1995 commented on Mar 23, 2020

@flip1995
Member

Is this specific for the redundant_field_names lint or does this issue apply to other lints, too?

dtolnay

dtolnay commented on Apr 23, 2020

@dtolnay
MemberAuthor

Based on #5515, possibly specific to redundant_field_names. I haven't tested every other lint but I haven't noticed it for others.

added a commit that references this issue on Apr 25, 2020

Rollup merge of rust-lang#5518 - flip1995:less_pre_expansion, r=phansch

c532d66
added a commit that references this issue on May 26, 2020

Auto merge of #5651 - ebroto:names_as_early_passes, r=flip1995

fca76de
added a commit that references this issue on Jun 17, 2020

Auto merge of rust-lang#73424 - Mark-Simulacrum:stable-next, r=Mark-S…

added a commit that references this issue on Jul 7, 2020
added
I-false-positiveIssue: The lint was triggered on code it shouldn't have
on Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Participants

      @dtolnay@flip1995@rustbot

      Issue actions

        Regression in lint level attributes taking effect across files · Issue #5356 · rust-lang/rust-clippy