Replace all format!("{}", foo) calls

This commit is contained in:
mcarton 2016-02-20 21:03:45 +01:00
parent ef4401d4ac
commit b6443b9928
5 changed files with 14 additions and 16 deletions

View file

@ -530,10 +530,10 @@ fn lint_or_fun_call(cx: &LateContext, expr: &Expr, name: &str, args: &[P<Expr>])
return;
}
let sugg = match (fn_has_arguments, !or_has_args) {
(true, _) => format!("|_| {}", snippet(cx, arg.span, "..")),
(false, false) => format!("|| {}", snippet(cx, arg.span, "..")),
(false, true) => format!("{}", snippet(cx, fun.span, "..")),
let sugg: Cow<_> = match (fn_has_arguments, !or_has_args) {
(true, _) => format!("|_| {}", snippet(cx, arg.span, "..")).into(),
(false, false) => format!("|| {}", snippet(cx, arg.span, "..")).into(),
(false, true) => snippet(cx, fun.span, ".."),
};
span_lint(cx, OR_FUN_CALL, span, &format!("use of `{}` followed by a function call", name))