From 6657d4e7ffac84cb51d3a7d9137132480992817e Mon Sep 17 00:00:00 2001 From: Zaki Manian <zaki@manian.org> Date: Sun, 3 Sep 2017 12:50:02 -0700 Subject: [PATCH] Remove direct call for Deref Remove "assigns" from the lint --- clippy_lints/src/is_unit_expr.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/is_unit_expr.rs b/clippy_lints/src/is_unit_expr.rs index c3860d2b92a..ad55d0b0973 100644 --- a/clippy_lints/src/is_unit_expr.rs +++ b/clippy_lints/src/is_unit_expr.rs @@ -1,6 +1,5 @@ use rustc::lint::*; use syntax::ast::*; -use std::ops::Deref; use syntax::ext::quote::rt::Span; use utils::span_note_and_lint; @@ -43,7 +42,7 @@ impl EarlyLintPass for UnitExpr { cx, UNIT_EXPR, expr.span, - "This expression assigns the Unit type ()", + "This expression evaluates to the Unit type ()", span, "Consider removing the trailing semicolon", ); @@ -56,7 +55,7 @@ impl EarlyLintPass for UnitExpr { cx, UNIT_EXPR, expr.span, - "This expression assigns the Unit type ()", + "This expression evaluates to the Unit type ()", span, "Consider removing the trailing semicolon", ); @@ -70,7 +69,7 @@ impl EarlyLintPass for UnitExpr { cx, UNIT_EXPR, expr.span, - "This expression assigns the Unit type ()", + "This expression evaluates to the Unit type ()", span, "Consider removing the trailing semicolon", ); @@ -90,7 +89,7 @@ impl EarlyLintPass for UnitExpr { cx, UNIT_EXPR, expr.span, - "This expression assigns the Unit type ()", + "This expression evaluates to the Unit type ()", span, "Consider removing the trailing semicolon", ); @@ -109,7 +108,7 @@ fn is_unit_expr(expr: &Expr) -> Option<Span> { ExprKind::If(_, ref then, ref else_) => { let check_then = check_last_stmt_in_block(then); if let Some(ref else_) = *else_ { - let check_else = is_unit_expr(else_.deref()); + let check_else = is_unit_expr(&else_); if let Some(ref expr_else) = check_else { return Some(expr_else.clone()); }