]> git.lizzy.rs Git - rust.git/commitdiff
Get rid of another handwritten Span construtor in favour of a builtin function
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Thu, 31 Aug 2017 12:58:18 +0000 (14:58 +0200)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Thu, 31 Aug 2017 13:00:21 +0000 (15:00 +0200)
clippy_lints/src/if_let_redundant_pattern_matching.rs

index 904d3e9e2afac48715aefbb0bcca0e0704a40fbf..36411b73a623e0660bb0f6ae8faa60a4899f8554 100644 (file)
@@ -1,6 +1,5 @@
 use rustc::lint::*;
 use rustc::hir::*;
-use syntax::codemap::Span;
 use utils::{paths, span_lint_and_then, match_qpath, snippet};
 
 /// **What it does:*** Lint for redundant pattern matching over `Result` or
@@ -74,11 +73,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
                                    arms[0].pats[0].span,
                                    &format!("redundant pattern matching, consider using `{}`", good_method),
                                    |db| {
-                    let span = Span::new(
-                        expr.span.lo(),
-                        op.span.hi(),
-                        expr.span.ctxt(),
-                    );
+                    let span = expr.span.with_hi(op.span.hi());
                     db.span_suggestion(span, "try this", format!("if {}.{}", snippet(cx, op.span, "_"), good_method));
                 });
             }