From 28bb8ed9cb0aa9f1efad252748ea189716355157 Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Tue, 2 Jun 2020 19:09:51 -0400 Subject: Cleanup changes leftover from previous tracking attempt --- crates/ra_hir_def/src/body/lower.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index fdd2be843..c6bc85e2f 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -313,20 +313,20 @@ impl ExprCollector<'_> { } else { Vec::new() }; - self.alloc_expr(Expr::Call { callee, args: args.clone() }, syntax_ptr) + self.alloc_expr(Expr::Call { callee, args }, syntax_ptr) } ast::Expr::MethodCallExpr(e) => { let receiver = self.collect_expr_opt(e.expr()); let args = if let Some(arg_list) = e.arg_list() { arg_list.args().map(|e| self.collect_expr(e)).collect() } else { - vec![] + Vec::new() }; let method_name = e.name_ref().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); let generic_args = e.type_arg_list().and_then(|it| GenericArgs::from_ast(&self.ctx(), it)); self.alloc_expr( - Expr::MethodCall { receiver, method_name, args: args.clone(), generic_args }, + Expr::MethodCall { receiver, method_name, args, generic_args }, syntax_ptr, ) } @@ -345,7 +345,7 @@ impl ExprCollector<'_> { }) .collect() } else { - vec![] + Vec::new() }; self.alloc_expr(Expr::Match { expr, arms }, syntax_ptr) } @@ -392,15 +392,17 @@ impl ExprCollector<'_> { } let name = field.field_name()?.as_name(); - let expr = match field.expr() { - Some(e) => self.collect_expr(e), - None => self.missing_expr(), - }; - Some(RecordLitField { name, expr }) + Some(RecordLitField { + name, + expr: match field.expr() { + Some(e) => self.collect_expr(e), + None => self.missing_expr(), + }, + }) }) .collect(); let spread = nfl.spread().map(|s| self.collect_expr(s)); - Expr::RecordLit { path, fields, spread: spread } + Expr::RecordLit { path, fields, spread } } else { Expr::RecordLit { path, fields: Vec::new(), spread: None } }; @@ -484,8 +486,8 @@ impl ExprCollector<'_> { self.alloc_expr(Expr::BinaryOp { lhs, rhs, op }, syntax_ptr) } ast::Expr::TupleExpr(e) => { - let exprs = e.exprs().map(|expr| self.collect_expr(expr)).collect::>(); - self.alloc_expr(Expr::Tuple { exprs: exprs.clone() }, syntax_ptr) + let exprs = e.exprs().map(|expr| self.collect_expr(expr)).collect(); + self.alloc_expr(Expr::Tuple { exprs }, syntax_ptr) } ast::Expr::BoxExpr(e) => { let expr = self.collect_expr_opt(e.expr()); @@ -497,8 +499,8 @@ impl ExprCollector<'_> { match kind { ArrayExprKind::ElementList(e) => { - let exprs = e.map(|expr| self.collect_expr(expr)).collect::>(); - self.alloc_expr(Expr::Array(Array::ElementList(exprs.clone())), syntax_ptr) + let exprs = e.map(|expr| self.collect_expr(expr)).collect(); + self.alloc_expr(Expr::Array(Array::ElementList(exprs)), syntax_ptr) } ArrayExprKind::Repeat { initializer, repeat } => { let initializer = self.collect_expr_opt(initializer); -- cgit v1.2.3