mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Detect "bound more than once" error and suppress need-mut
for it.
This commit is contained in:
parent
08f89193b5
commit
71f3e4b08c
4 changed files with 84 additions and 8 deletions
|
@ -620,6 +620,19 @@ fn f((x, y): (i32, i32)) {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_diagnostics_in_case_of_multiple_bounds() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
fn f() {
|
||||
let (b, a, b) = (2, 3, 5);
|
||||
a = 8;
|
||||
//^^^^^ 💡 error: cannot mutate immutable variable `a`
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn for_loop() {
|
||||
check_diagnostics(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue