From c708154c168dd198d0127f1a891dcbdba1796e2c Mon Sep 17 00:00:00 2001 From: bootandy Date: Tue, 20 Feb 2018 12:38:20 -0500 Subject: [PATCH] Simplify creation of span_replace_word Part of unwrap_or test --- clippy_lints/src/methods.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index b65775ea7b3..9d829007bca 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -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); @@ -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),