From 335bc1e820c2fd1316e3c225189361b43f2654c3 Mon Sep 17 00:00:00 2001 From: Devon Hollowood Date: Fri, 12 Oct 2018 17:07:48 -0700 Subject: [PATCH] Fix some more `stutter` warnings --- clippy_lints/src/double_comparison.rs | 9 ++++----- clippy_lints/src/lib.rs | 4 ++-- clippy_lints/src/question_mark.rs | 9 ++++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/clippy_lints/src/double_comparison.rs b/clippy_lints/src/double_comparison.rs index 314ca41ba..0171ac1e7 100644 --- a/clippy_lints/src/double_comparison.rs +++ b/clippy_lints/src/double_comparison.rs @@ -40,16 +40,15 @@ declare_clippy_lint! { "unnecessary double comparisons that can be simplified" } -#[allow(clippy::stutter)] -pub struct DoubleComparisonPass; +pub struct Pass; -impl LintPass for DoubleComparisonPass { +impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(DOUBLE_COMPARISONS) } } -impl<'a, 'tcx> DoubleComparisonPass { +impl<'a, 'tcx> Pass { #[allow(clippy::similar_names)] fn check_binop( &self, @@ -89,7 +88,7 @@ impl<'a, 'tcx> DoubleComparisonPass { } } -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DoubleComparisonPass { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { if let ExprKind::Binary(ref kind, ref lhs, ref rhs) = expr.node { self.check_binop(cx, kind.node, lhs, rhs, expr.span); diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index c343cf364..9b749bdce 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -428,8 +428,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { reg.register_late_lint_pass(box fallible_impl_from::FallibleImplFrom); reg.register_late_lint_pass(box replace_consts::ReplaceConsts); reg.register_late_lint_pass(box types::UnitArg); - reg.register_late_lint_pass(box double_comparison::DoubleComparisonPass); - reg.register_late_lint_pass(box question_mark::QuestionMarkPass); + reg.register_late_lint_pass(box double_comparison::Pass); + reg.register_late_lint_pass(box question_mark::Pass); reg.register_late_lint_pass(box suspicious_trait_impl::SuspiciousImpl); reg.register_early_lint_pass(box multiple_crate_versions::Pass); reg.register_late_lint_pass(box map_unit_fn::Pass); diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs index 93a40e135..72d33e58c 100644 --- a/clippy_lints/src/question_mark.rs +++ b/clippy_lints/src/question_mark.rs @@ -44,17 +44,16 @@ declare_clippy_lint!{ "checks for expressions that could be replaced by the question mark operator" } -#[allow(clippy::stutter)] #[derive(Copy, Clone)] -pub struct QuestionMarkPass; +pub struct Pass; -impl LintPass for QuestionMarkPass { +impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(QUESTION_MARK) } } -impl QuestionMarkPass { +impl Pass { /// Check if the given expression on the given context matches the following structure: /// /// ```ignore @@ -146,7 +145,7 @@ impl QuestionMarkPass { } } -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for QuestionMarkPass { +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { Self::check_is_none_and_early_return_none(cx, expr); }