Fix some more stutter warnings

This commit is contained in:
Devon Hollowood 2018-10-12 17:07:48 -07:00
parent 73ba33dd2b
commit 335bc1e820
3 changed files with 10 additions and 12 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);
}