Skip to content

Commit 755a236

Browse files
committed
Get rid of another handwritten Span construtor in favour of a builtin function
1 parent a8cf4e8 commit 755a236

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

clippy_lints/src/if_let_redundant_pattern_matching.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use rustc::lint::*;
22
use rustc::hir::*;
3-
use syntax::codemap::Span;
43
use utils::{paths, span_lint_and_then, match_qpath, snippet};
54

65
/// **What it does:*** Lint for redundant pattern matching over `Result` or
@@ -74,11 +73,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
7473
arms[0].pats[0].span,
7574
&format!("redundant pattern matching, consider using `{}`", good_method),
7675
|db| {
77-
let span = Span::new(
78-
expr.span.lo(),
79-
op.span.hi(),
80-
expr.span.ctxt(),
81-
);
76+
let span = expr.span.with_hi(op.span.hi());
8277
db.span_suggestion(span, "try this", format!("if {}.{}", snippet(cx, op.span, "_"), good_method));
8378
});
8479
}

0 commit comments

Comments
 (0)