]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/map_clone.rs
Auto merge of #3985 - phansch:move_some_cast_tests, r=flip1995
[rust.git] / clippy_lints / src / map_clone.rs
index 1a9334ae48893245402ee08b14018c21137c7ec8..4743dec9d5c28d2677ec4df54bb63159b8ca0e7d 100644 (file)
@@ -6,14 +6,11 @@
 use rustc::hir;
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::ty;
-use rustc::{declare_tool_lint, lint_array};
+use rustc::{declare_lint_pass, declare_tool_lint};
 use rustc_errors::Applicability;
 use syntax::ast::Ident;
 use syntax::source_map::Span;
 
-#[derive(Clone)]
-pub struct Pass;
-
 declare_clippy_lint! {
     /// **What it does:** Checks for usage of `iterator.map(|x| x.clone())` and suggests
     /// `iterator.cloned()` instead
     "using `iterator.map(|x| x.clone())`, or dereferencing closures for `Copy` types"
 }
 
-impl LintPass for Pass {
-    fn get_lints(&self) -> LintArray {
-        lint_array!(MAP_CLONE)
-    }
-
-    fn name(&self) -> &'static str {
-        "MapClone"
-    }
-}
+declare_lint_pass!(MapClone => [MAP_CLONE]);
 
-impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
+impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MapClone {
     fn check_expr(&mut self, cx: &LateContext<'_, '_>, e: &hir::Expr) {
         if in_macro(e.span) {
             return;