]> git.lizzy.rs Git - rust.git/commitdiff
use_self: Simplify spanning
authorMichael Wright <mikerite@lavabit.com>
Wed, 18 Jul 2018 05:57:50 +0000 (07:57 +0200)
committerMichael Wright <mikerite@lavabit.com>
Wed, 18 Jul 2018 05:57:50 +0000 (07:57 +0200)
clippy_lints/src/use_self.rs

index a4450acea0913863df78853560c55821f0e82cf0..d5aaaa81c03de3d66d7ef86e975e60796142ff69 100644 (file)
@@ -1,4 +1,4 @@
-use crate::utils::{in_macro, span_lint_and_then};
+use crate::utils::{in_macro, span_lint_and_sugg};
 use rustc::hir::intravisit::{walk_path, walk_ty, NestedVisitorMap, Visitor};
 use rustc::hir::*;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -51,9 +51,14 @@ fn get_lints(&self) -> LintArray {
 const SEGMENTS_MSG: &str = "segments should be composed of at least 1 element";
 
 fn span_use_self_lint(cx: &LateContext, path: &Path) {
-    span_lint_and_then(cx, USE_SELF, path.span, "unnecessary structure name repetition", |db| {
-        db.span_suggestion(path.span, "use the applicable keyword", "Self".to_owned());
-    });
+    span_lint_and_sugg(
+        cx,
+        USE_SELF,
+        path.span,
+        "unnecessary structure name repetition",
+        "use the applicable keyword",
+        "Self".to_owned(),
+    );
 }
 
 struct TraitImplTyVisitor<'a, 'tcx: 'a> {