mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
use ControlFlow::Break(_)
pattern
This commit is contained in:
parent
971a271840
commit
f888e85f79
1 changed files with 3 additions and 4 deletions
|
@ -1185,13 +1185,12 @@ impl FlowHandler {
|
||||||
let stmt = make::expr_stmt(action);
|
let stmt = make::expr_stmt(action);
|
||||||
let block = make::block_expr(iter::once(stmt.into()), None);
|
let block = make::block_expr(iter::once(stmt.into()), None);
|
||||||
let controlflow_break_path = make::path_from_text("ControlFlow::Break");
|
let controlflow_break_path = make::path_from_text("ControlFlow::Break");
|
||||||
let tuple_pat = make::tuple_pat(iter::empty());
|
|
||||||
let condition = make::condition(
|
let condition = make::condition(
|
||||||
call_expr,
|
call_expr,
|
||||||
Some(
|
Some(
|
||||||
make::tuple_struct_pat(
|
make::tuple_struct_pat(
|
||||||
controlflow_break_path,
|
controlflow_break_path,
|
||||||
iter::once(tuple_pat.into()),
|
iter::once(make::wildcard_pat().into()),
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
),
|
),
|
||||||
|
@ -3301,7 +3300,7 @@ fn foo() {
|
||||||
fn foo() {
|
fn foo() {
|
||||||
loop {
|
loop {
|
||||||
let mut n = 1;
|
let mut n = 1;
|
||||||
if let ControlFlow::Break(()) = fun_name(&mut n) {
|
if let ControlFlow::Break(_) = fun_name(&mut n) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let h = 1 + n;
|
let h = 1 + n;
|
||||||
|
@ -3338,7 +3337,7 @@ fn foo() {
|
||||||
fn foo() {
|
fn foo() {
|
||||||
loop {
|
loop {
|
||||||
let mut n = 1;
|
let mut n = 1;
|
||||||
if let ControlFlow::Break(()) = fun_name(n) {
|
if let ControlFlow::Break(_) = fun_name(n) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let h = 1;
|
let h = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue