From c9342d01213ca1663d2cdf23289bae024823ae6a Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 4 Jan 2016 09:56:12 +0530 Subject: fmt clippy --- src/map_clone.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/map_clone.rs') diff --git a/src/map_clone.rs b/src/map_clone.rs index ef992ad086c..9db97a1b9f2 100644 --- a/src/map_clone.rs +++ b/src/map_clone.rs @@ -65,10 +65,13 @@ impl LateLintPass for MapClonePass { ExprPath(_, ref path) => { if match_path(path, &CLONE_PATH) { let type_name = get_type_name(cx, expr, &args[0]).unwrap_or("_"); - span_help_and_lint(cx, MAP_CLONE, expr.span, &format!( - "you seem to be using .map() to clone the contents of an {}, consider \ - using `.cloned()`", type_name), - &format!("try\n{}.cloned()", snippet(cx, args[0].span, ".."))); + span_help_and_lint(cx, + MAP_CLONE, + expr.span, + &format!("you seem to be using .map() to clone the contents of an \ + {}, consider using `.cloned()`", + type_name), + &format!("try\n{}.cloned()", snippet(cx, args[0].span, ".."))); } } _ => (), @@ -81,7 +84,10 @@ impl LateLintPass for MapClonePass { fn expr_eq_ident(expr: &Expr, id: Ident) -> bool { match expr.node { ExprPath(None, ref path) => { - let arg_segment = [PathSegment { identifier: id, parameters: PathParameters::none() }]; + let arg_segment = [PathSegment { + identifier: id, + parameters: PathParameters::none(), + }]; !path.global && path.segments[..] == arg_segment } _ => false, @@ -108,9 +114,7 @@ fn get_arg_name(pat: &Pat) -> Option { fn only_derefs(cx: &LateContext, expr: &Expr, id: Ident) -> bool { match expr.node { - ExprUnary(UnDeref, ref subexpr) if !is_adjusted(cx, subexpr) => { - only_derefs(cx, subexpr, id) - } + ExprUnary(UnDeref, ref subexpr) if !is_adjusted(cx, subexpr) => only_derefs(cx, subexpr, id), _ => expr_eq_ident(expr, id), } } -- cgit 1.4.1-3-g733a5