Get rid of another handwritten Span construtor in favour of a builtin function

This commit is contained in:
Oliver Schneider 2017-08-31 14:58:18 +02:00
parent a8cf4e8ecb
commit 755a236641
No known key found for this signature in database
GPG Key ID: A69F8D225B3AD7D9

View 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 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
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));
});
}