-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-unused_mutLint: unused_mutLint: unused_mutT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code:
fn main() {
let mut point = &mut Point { x: 10, y: 20};
point.x = 30;
println!("{:?}", point);
}
#[derive(Debug)]
struct Point {
x: i32,
y: i32,
}
Current behavior:
no warning
Expected behavior:
warning: variable does not need to be mutable
--> src/main.rs:2:13
|
2 | let mut point = &mut Point { x: 10, y: 20};
| ----^^^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
leonardo-m
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-unused_mutLint: unused_mutLint: unused_mutT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.