aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-02 10:25:24 +0100
committerAleksey Kladov <[email protected]>2019-04-02 10:25:24 +0100
commitf3a82c372ccaa079842f151b749fbe9b8b9eb004 (patch)
treee7dab9896f9ddfa0af3c880375d8408c7db758e6
parent5287a2506c19b7f886556f8a73510f57dd234857 (diff)
remove flavor
-rw-r--r--crates/ra_assists/src/replace_if_let_with_match.rs4
-rw-r--r--crates/ra_hir/src/expr.rs8
-rw-r--r--crates/ra_syntax/src/ast.rs8
3 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_assists/src/replace_if_let_with_match.rs b/crates/ra_assists/src/replace_if_let_with_match.rs
index 230573499..2b451f08d 100644
--- a/crates/ra_assists/src/replace_if_let_with_match.rs
+++ b/crates/ra_assists/src/replace_if_let_with_match.rs
@@ -11,8 +11,8 @@ pub(crate) fn replace_if_let_with_match(mut ctx: AssistCtx<impl HirDatabase>) ->
11 let expr = cond.expr()?; 11 let expr = cond.expr()?;
12 let then_block = if_expr.then_branch()?; 12 let then_block = if_expr.then_branch()?;
13 let else_block = match if_expr.else_branch()? { 13 let else_block = match if_expr.else_branch()? {
14 ast::ElseBranchFlavor::Block(it) => it, 14 ast::ElseBranch::Block(it) => it,
15 ast::ElseBranchFlavor::IfExpr(_) => return None, 15 ast::ElseBranch::IfExpr(_) => return None,
16 }; 16 };
17 17
18 ctx.add_action(AssistId("replace_if_let_with_match"), "replace with match", |edit| { 18 ctx.add_action(AssistId("replace_if_let_with_match"), "replace with match", |edit| {
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index 946c9faf2..ee2c4475c 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -516,8 +516,8 @@ impl ExprCollector {
516 let else_branch = e 516 let else_branch = e
517 .else_branch() 517 .else_branch()
518 .map(|b| match b { 518 .map(|b| match b {
519 ast::ElseBranchFlavor::Block(it) => self.collect_block(it), 519 ast::ElseBranch::Block(it) => self.collect_block(it),
520 ast::ElseBranchFlavor::IfExpr(elif) => { 520 ast::ElseBranch::IfExpr(elif) => {
521 let expr: &ast::Expr = ast::Expr::cast(elif.syntax()).unwrap(); 521 let expr: &ast::Expr = ast::Expr::cast(elif.syntax()).unwrap();
522 self.collect_expr(expr) 522 self.collect_expr(expr)
523 } 523 }
@@ -533,8 +533,8 @@ impl ExprCollector {
533 let condition = self.collect_expr_opt(e.condition().and_then(|c| c.expr())); 533 let condition = self.collect_expr_opt(e.condition().and_then(|c| c.expr()));
534 let then_branch = self.collect_block_opt(e.then_branch()); 534 let then_branch = self.collect_block_opt(e.then_branch());
535 let else_branch = e.else_branch().map(|b| match b { 535 let else_branch = e.else_branch().map(|b| match b {
536 ast::ElseBranchFlavor::Block(it) => self.collect_block(it), 536 ast::ElseBranch::Block(it) => self.collect_block(it),
537 ast::ElseBranchFlavor::IfExpr(elif) => { 537 ast::ElseBranch::IfExpr(elif) => {
538 let expr: &ast::Expr = ast::Expr::cast(elif.syntax()).unwrap(); 538 let expr: &ast::Expr = ast::Expr::cast(elif.syntax()).unwrap();
539 self.collect_expr(expr) 539 self.collect_expr(expr)
540 } 540 }
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index beef2c6e2..b0e0f8bf9 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -164,7 +164,7 @@ impl LetStmt {
164} 164}
165 165
166#[derive(Debug, Clone, PartialEq, Eq)] 166#[derive(Debug, Clone, PartialEq, Eq)]
167pub enum ElseBranchFlavor<'a> { 167pub enum ElseBranch<'a> {
168 Block(&'a Block), 168 Block(&'a Block),
169 IfExpr(&'a IfExpr), 169 IfExpr(&'a IfExpr),
170} 170}
@@ -173,12 +173,12 @@ impl IfExpr {
173 pub fn then_branch(&self) -> Option<&Block> { 173 pub fn then_branch(&self) -> Option<&Block> {
174 self.blocks().nth(0) 174 self.blocks().nth(0)
175 } 175 }
176 pub fn else_branch(&self) -> Option<ElseBranchFlavor> { 176 pub fn else_branch(&self) -> Option<ElseBranch> {
177 let res = match self.blocks().nth(1) { 177 let res = match self.blocks().nth(1) {
178 Some(block) => ElseBranchFlavor::Block(block), 178 Some(block) => ElseBranch::Block(block),
179 None => { 179 None => {
180 let elif: &IfExpr = child_opt(self)?; 180 let elif: &IfExpr = child_opt(self)?;
181 ElseBranchFlavor::IfExpr(elif) 181 ElseBranch::IfExpr(elif)
182 } 182 }
183 }; 183 };
184 Some(res) 184 Some(res)