File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/tools/rust-analyzer/crates/ide-assists/src/handlers Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ fn let_stmt_to_guarded_return(
182182 let cursor_in_range =
183183 let_token_range. cover ( let_pattern_range) . contains_range ( ctx. selection_trimmed ( ) ) ;
184184
185- if !cursor_in_range {
185+ if !cursor_in_range || let_stmt . let_else ( ) . is_some ( ) {
186186 return None ;
187187 }
188188
@@ -911,6 +911,19 @@ fn main() {
911911 ) ;
912912 }
913913
914+ #[ test]
915+ fn ignore_let_else_branch ( ) {
916+ check_assist_not_applicable (
917+ convert_to_guarded_return,
918+ r#"
919+ //- minicore: option
920+ fn main() {
921+ let$0 Some(x) = Some(2) else { return };
922+ }
923+ "# ,
924+ ) ;
925+ }
926+
914927 #[ test]
915928 fn ignore_statements_after_if ( ) {
916929 check_assist_not_applicable (
You can’t perform that action at this time.
0 commit comments