Skip to content

Commit

Permalink
Simplify creation of span_replace_word
Browse files Browse the repository at this point in the history
Part of unwrap_or test
  • Loading branch information
bootandy committed Feb 20, 2018
1 parent f3d1a0c commit c708154
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions clippy_lints/src/methods.rs
Expand Up @@ -913,9 +913,7 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir:
return;
}

let start_point = self_expr.span.hi();
let end_point = span.hi();
let span_replace_word = Span::new(start_point, end_point, span.ctxt());
let span_replace_word = self_expr.span.with_lo(span.hi());

// don't lint for constant values
let owner_def = cx.tcx.hir.get_parent_did(arg.id);
Expand Down Expand Up @@ -946,7 +944,7 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[hir:
span_lint_and_sugg(
cx,
OR_FUN_CALL,
span_replace_word ,
span_replace_word,
&format!("use of `{}` followed by a function call", name),
"try this",
format!(".{}_{}({})", name, suffix, sugg),
Expand Down

0 comments on commit c708154

Please sign in to comment.