diff options
Diffstat (limited to 'crates/ra_assists/src/handlers/move_guard.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/move_guard.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/move_guard.rs b/crates/ra_assists/src/handlers/move_guard.rs index a61a2ba3e..1cc498638 100644 --- a/crates/ra_assists/src/handlers/move_guard.rs +++ b/crates/ra_assists/src/handlers/move_guard.rs | |||
@@ -44,7 +44,7 @@ pub(crate) fn move_guard_to_arm_body(ctx: AssistCtx) -> Option<Assist> { | |||
44 | edit.target(guard.syntax().text_range()); | 44 | edit.target(guard.syntax().text_range()); |
45 | let offseting_amount = match space_before_guard.and_then(|it| it.into_token()) { | 45 | let offseting_amount = match space_before_guard.and_then(|it| it.into_token()) { |
46 | Some(tok) => { | 46 | Some(tok) => { |
47 | if let Some(_) = ast::Whitespace::cast(tok.clone()) { | 47 | if ast::Whitespace::cast(tok.clone()).is_some() { |
48 | let ele = tok.text_range(); | 48 | let ele = tok.text_range(); |
49 | edit.delete(ele); | 49 | edit.delete(ele); |
50 | ele.len() | 50 | ele.len() |
@@ -98,11 +98,11 @@ pub(crate) fn move_arm_cond_to_match_guard(ctx: AssistCtx) -> Option<Assist> { | |||
98 | let then_block = if_expr.then_branch()?; | 98 | let then_block = if_expr.then_branch()?; |
99 | 99 | ||
100 | // Not support if with else branch | 100 | // Not support if with else branch |
101 | if let Some(_) = if_expr.else_branch() { | 101 | if if_expr.else_branch().is_some() { |
102 | return None; | 102 | return None; |
103 | } | 103 | } |
104 | // Not support moving if let to arm guard | 104 | // Not support moving if let to arm guard |
105 | if let Some(_) = cond.pat() { | 105 | if cond.pat().is_some() { |
106 | return None; | 106 | return None; |
107 | } | 107 | } |
108 | 108 | ||