diff options
author | Aleksey Kladov <[email protected]> | 2020-07-31 19:07:21 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-31 19:07:21 +0100 |
commit | 6791eb9685375da94556bb910ea71f78b08be5ec (patch) | |
tree | 5b1b11a96815d381e366685bb641185e81a1c9c4 /crates/ra_assists/src/handlers/fill_match_arms.rs | |
parent | d7f75db90d99216c13000681ff2c4a887451c4b2 (diff) |
Rename PalceholderPat -> WildcardPat
Diffstat (limited to 'crates/ra_assists/src/handlers/fill_match_arms.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/fill_match_arms.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs index 708e1bc6c..36658f104 100644 --- a/crates/ra_assists/src/handlers/fill_match_arms.rs +++ b/crates/ra_assists/src/handlers/fill_match_arms.rs | |||
@@ -43,7 +43,7 @@ pub(crate) fn fill_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option< | |||
43 | 43 | ||
44 | let mut arms: Vec<MatchArm> = match_arm_list.arms().collect(); | 44 | let mut arms: Vec<MatchArm> = match_arm_list.arms().collect(); |
45 | if arms.len() == 1 { | 45 | if arms.len() == 1 { |
46 | if let Some(Pat::PlaceholderPat(..)) = arms[0].pat() { | 46 | if let Some(Pat::WildcardPat(..)) = arms[0].pat() { |
47 | arms.clear(); | 47 | arms.clear(); |
48 | } | 48 | } |
49 | } | 49 | } |
@@ -116,17 +116,15 @@ pub(crate) fn fill_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option< | |||
116 | match (first_new_arm, ctx.config.snippet_cap) { | 116 | match (first_new_arm, ctx.config.snippet_cap) { |
117 | (Some(first_new_arm), Some(cap)) => { | 117 | (Some(first_new_arm), Some(cap)) => { |
118 | let extend_lifetime; | 118 | let extend_lifetime; |
119 | let cursor = match first_new_arm | 119 | let cursor = |
120 | .syntax() | 120 | match first_new_arm.syntax().descendants().find_map(ast::WildcardPat::cast) |
121 | .descendants() | 121 | { |
122 | .find_map(ast::PlaceholderPat::cast) | 122 | Some(it) => { |
123 | { | 123 | extend_lifetime = it.syntax().clone(); |
124 | Some(it) => { | 124 | Cursor::Replace(&extend_lifetime) |
125 | extend_lifetime = it.syntax().clone(); | 125 | } |
126 | Cursor::Replace(&extend_lifetime) | 126 | None => Cursor::Before(first_new_arm.syntax()), |
127 | } | 127 | }; |
128 | None => Cursor::Before(first_new_arm.syntax()), | ||
129 | }; | ||
130 | let snippet = render_snippet(cap, new_arm_list.syntax(), cursor); | 128 | let snippet = render_snippet(cap, new_arm_list.syntax(), cursor); |
131 | builder.replace_snippet(cap, old_range, snippet); | 129 | builder.replace_snippet(cap, old_range, snippet); |
132 | } | 130 | } |