X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Fmap_clone.rs;h=4743dec9d5c28d2677ec4df54bb63159b8ca0e7d;hb=6feed2713c7740eb5868eba43745bc508b8b77aa;hp=1a9334ae48893245402ee08b14018c21137c7ec8;hpb=ea25f044ec0c0758e5ca26dfeb596b08236cb20f;p=rust.git diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index 1a9334ae488..4743dec9d5c 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -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 @@ -42,17 +39,9 @@ "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;