We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b93180b commit 7509d80Copy full SHA for 7509d80
crates/ide-assists/src/handlers/convert_to_guarded_return.rs
@@ -182,7 +182,7 @@ fn let_stmt_to_guarded_return(
182
let cursor_in_range =
183
let_token_range.cover(let_pattern_range).contains_range(ctx.selection_trimmed());
184
185
- if !cursor_in_range {
+ if !cursor_in_range || let_stmt.let_else().is_some() {
186
return None;
187
}
188
@@ -911,6 +911,19 @@ fn main() {
911
);
912
913
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
+
927
#[test]
928
fn ignore_statements_after_if() {
929
check_assist_not_applicable(
0 commit comments