diff options
| author | Dezhi Wu <wu543065657@163.com> | 2021-09-22 18:48:47 +0800 |
|---|---|---|
| committer | Dezhi Wu <wu543065657@163.com> | 2021-10-13 09:06:47 +0800 |
| commit | f888e85f79627cf05eca66b01aaf09c9d3906df5 (patch) | |
| tree | b205090e70c74db902869898d93620bdc7e62e55 | |
| parent | 971a2718402dcf73c969490f51473b438f328dd9 (diff) | |
| download | rust-f888e85f79627cf05eca66b01aaf09c9d3906df5.tar.gz rust-f888e85f79627cf05eca66b01aaf09c9d3906df5.zip | |
use `ControlFlow::Break(_)` pattern
| -rw-r--r-- | crates/ide_assists/src/handlers/extract_function.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs index 59f0a786afd..dfedc4a4870 100644 --- a/crates/ide_assists/src/handlers/extract_function.rs +++ b/crates/ide_assists/src/handlers/extract_function.rs @@ -1185,13 +1185,12 @@ impl FlowHandler { let stmt = make::expr_stmt(action); let block = make::block_expr(iter::once(stmt.into()), None); let controlflow_break_path = make::path_from_text("ControlFlow::Break"); - let tuple_pat = make::tuple_pat(iter::empty()); let condition = make::condition( call_expr, Some( make::tuple_struct_pat( controlflow_break_path, - iter::once(tuple_pat.into()), + iter::once(make::wildcard_pat().into()), ) .into(), ), @@ -3301,7 +3300,7 @@ fn foo() { fn foo() { loop { let mut n = 1; - if let ControlFlow::Break(()) = fun_name(&mut n) { + if let ControlFlow::Break(_) = fun_name(&mut n) { break; } let h = 1 + n; @@ -3338,7 +3337,7 @@ fn foo() { fn foo() { loop { let mut n = 1; - if let ControlFlow::Break(()) = fun_name(n) { + if let ControlFlow::Break(_) = fun_name(n) { break; } let h = 1; |
