mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 13:33:31 +00:00
Make return a snippet
This commit is contained in:
parent
57934ac47a
commit
51d57b9bb6
1 changed files with 3 additions and 3 deletions
|
@ -95,7 +95,7 @@ pub(crate) fn complete_postfix(
|
||||||
&if in_loop {
|
&if in_loop {
|
||||||
format!("let Ok($1) = {receiver_text} else {{\n ${{2|continue,break,return|}};\n}};\n$0")
|
format!("let Ok($1) = {receiver_text} else {{\n ${{2|continue,break,return|}};\n}};\n$0")
|
||||||
} else {
|
} else {
|
||||||
format!("let Ok($1) = {receiver_text} else {{\n return;\n}};\n$0")
|
format!("let Ok($1) = {receiver_text} else {{\n ${{2:return}};\n}};\n$0")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.add_to(acc, ctx.db);
|
.add_to(acc, ctx.db);
|
||||||
|
@ -121,7 +121,7 @@ pub(crate) fn complete_postfix(
|
||||||
&if in_loop {
|
&if in_loop {
|
||||||
format!("let Some($1) = {receiver_text} else {{\n ${{2|continue,break,return|}};\n}};\n$0")
|
format!("let Some($1) = {receiver_text} else {{\n ${{2|continue,break,return|}};\n}};\n$0")
|
||||||
} else {
|
} else {
|
||||||
format!("let Some($1) = {receiver_text} else {{\n return;\n}};\n$0")
|
format!("let Some($1) = {receiver_text} else {{\n ${{2:return}};\n}};\n$0")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.add_to(acc, ctx.db);
|
.add_to(acc, ctx.db);
|
||||||
|
@ -511,7 +511,7 @@ fn main() {
|
||||||
fn main() {
|
fn main() {
|
||||||
let bar = Some(true);
|
let bar = Some(true);
|
||||||
let Some($1) = bar else {
|
let Some($1) = bar else {
|
||||||
return;
|
${2:return};
|
||||||
};
|
};
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue