mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
semies after break&continue
This commit is contained in:
parent
55b57227e4
commit
822abb3e62
@ -32,9 +32,14 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
||||
acc.add(keyword("else if", "else if $0 {}"));
|
||||
}
|
||||
if is_in_loop_body(ctx.leaf) {
|
||||
if ctx.can_be_stmt {
|
||||
acc.add(keyword("continue", "continue;"));
|
||||
acc.add(keyword("break", "break;"));
|
||||
} else {
|
||||
acc.add(keyword("continue", "continue"));
|
||||
acc.add(keyword("break", "break"));
|
||||
}
|
||||
}
|
||||
acc.add_all(complete_return(fn_def, ctx.can_be_stmt));
|
||||
}
|
||||
|
||||
@ -201,8 +206,8 @@ mod tests {
|
||||
match "match $0 {}"
|
||||
while "while $0 {}"
|
||||
loop "loop {$0}"
|
||||
continue "continue"
|
||||
break "break"
|
||||
continue "continue;"
|
||||
break "break;"
|
||||
return "return $0;"
|
||||
"#,
|
||||
);
|
||||
@ -222,4 +227,28 @@ mod tests {
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_semi_after_break_continue_in_expr() {
|
||||
check_keyword_completion(
|
||||
r"
|
||||
fn f() {
|
||||
loop {
|
||||
match () {
|
||||
() => br<|>
|
||||
}
|
||||
}
|
||||
}
|
||||
",
|
||||
r#"
|
||||
if "if $0 {}"
|
||||
match "match $0 {}"
|
||||
while "while $0 {}"
|
||||
loop "loop {$0}"
|
||||
continue "continue"
|
||||
break "break"
|
||||
return "return"
|
||||
"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user