Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/mutability_errors.rs')
| -rw-r--r-- | crates/ide-diagnostics/src/handlers/mutability_errors.rs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/crates/ide-diagnostics/src/handlers/mutability_errors.rs b/crates/ide-diagnostics/src/handlers/mutability_errors.rs index e0c3bedce4..d056e5c85c 100644 --- a/crates/ide-diagnostics/src/handlers/mutability_errors.rs +++ b/crates/ide-diagnostics/src/handlers/mutability_errors.rs @@ -76,7 +76,7 @@ pub(crate) fn unused_mut(ctx: &DiagnosticsContext<'_>, d: &hir::UnusedMut) -> Di "variable does not need to be mutable", ast, ) - .experimental() // Not supporting `#[allow(unused_mut)]` leads to false positive. + .experimental() // Not supporting `#[allow(unused_mut)]` in proc macros leads to false positive. .with_fixes(fixes) } @@ -1173,4 +1173,27 @@ fn f() { "#, ); } + + #[test] + fn regression_15623() { + check_diagnostics( + r#" +//- minicore: fn + +struct Foo; + +impl Foo { + fn needs_mut(&mut self) {} +} + +fn foo(mut foo: Foo) { + let mut call_me = || { + let 0 = 1 else { return }; + foo.needs_mut(); + }; + call_me(); +} +"#, + ); + } } |