File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
crates/ide_assists/src/handlers Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,10 @@ fn inline_usage(ctx: &AssistContext) -> Option<InlineData> {
182
182
PathResolution :: Local ( local) => local,
183
183
_ => return None ,
184
184
} ;
185
+ if local. is_mut ( ctx. sema . db ) {
186
+ cov_mark:: hit!( test_not_inline_mut_variable_use) ;
187
+ return None ;
188
+ }
185
189
186
190
let bind_pat = match local. source ( ctx. db ( ) ) . value {
187
191
Either :: Left ( ident) => ident,
@@ -426,6 +430,19 @@ fn foo() {
426
430
) ;
427
431
}
428
432
433
+ #[ test]
434
+ fn test_not_inline_mut_variable_use ( ) {
435
+ cov_mark:: check!( test_not_inline_mut_variable_use) ;
436
+ check_assist_not_applicable (
437
+ inline_local_variable,
438
+ r"
439
+ fn foo() {
440
+ let mut a = 1 + 1;
441
+ a$0 + 1;
442
+ }" ,
443
+ ) ;
444
+ }
445
+
429
446
#[ test]
430
447
fn test_call_expr ( ) {
431
448
check_assist (
You can’t perform that action at this time.
0 commit comments