Skip to content

allow unused_mut ignored #40491

Closed
Closed
@Cxarli

Description

@Cxarli

#[allow(unused_mut)] seems to be ignored

For example:

fn main() {
    #[allow(unused_mut)]
    let mut a = 10;

    println!("{}", a);
}

I expected to see no warning about the mut flag of a

Instead, this happened:

warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
 --> TEST.rs:3:9
  |
3 |     let mut a = 10;
  |         ^^^^^

Meta

This currently happens on all 3 major branches: stable, beta, nightly:

rustc 1.15.1 (021bd294c 2017-02-08)
binary: rustc
commit-hash: 021bd294c039bd54aa5c4aa85bcdffb0d24bc892
commit-date: 2017-02-08
host: x86_64-unknown-linux-gnu
release: 1.15.1
LLVM version: 3.9
rustc 1.16.0 (30cf806ef 2017-03-10)
binary: rustc
commit-hash: 30cf806ef8881c41821fbd43e5cf3699c5290c16
commit-date: 2017-03-10
host: x86_64-unknown-linux-gnu
release: 1.16.0
LLVM version: 3.9
rustc 1.17.0-nightly (824c9ebbd 2017-03-12)
binary: rustc
commit-hash: 824c9ebbd5f0611e326648d90ee3e50caf04bb7f
commit-date: 2017-03-12
host: x86_64-unknown-linux-gnu
release: 1.17.0-nightly
LLVM version: 3.9

Backtrace: RUST_BACKTRACE=full does not give more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions