about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDezhi Wu <wu543065657@163.com>2021-09-22 18:48:47 +0800
committerDezhi Wu <wu543065657@163.com>2021-10-13 09:06:47 +0800
commitf888e85f79627cf05eca66b01aaf09c9d3906df5 (patch)
treeb205090e70c74db902869898d93620bdc7e62e55
parent971a2718402dcf73c969490f51473b438f328dd9 (diff)
downloadrust-f888e85f79627cf05eca66b01aaf09c9d3906df5.tar.gz
rust-f888e85f79627cf05eca66b01aaf09c9d3906df5.zip
use `ControlFlow::Break(_)` pattern
-rw-r--r--crates/ide_assists/src/handlers/extract_function.rs7
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;