Skip to content

Commit

Permalink
Allow match_single_binding lint in clippy_lints basecode
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibsG committed Jan 19, 2020
1 parent 7b66739 commit 6f7e035
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions clippy_lints/src/eval_order_dependence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct DivergenceVisitor<'a, 'tcx> {
}

impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
#[allow(clippy::match_single_binding)]
fn maybe_walk_expr(&mut self, e: &'tcx Expr<'_>) {
match e.kind {
ExprKind::Closure(..) => {},
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ where
}

impl<'a, T: Copy> Kind<'a, T> {
#[allow(clippy::match_single_binding)]
fn range(&self) -> &'a SpannedRange<T> {
match *self {
Kind::Start(_, r) | Kind::End(_, r) => r,
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ fn lint_shadow<'a, 'tcx>(
}
}

#[allow(clippy::match_single_binding)]
fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>, bindings: &mut Vec<(Name, Span)>) {
if in_external_macro(cx.sess(), expr.span) {
return;
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/slow_vector_initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ impl SlowVectorInit {
}
}

#[allow(clippy::match_single_binding)]
fn lint_initialization<'tcx>(
cx: &LateContext<'_, 'tcx>,
initialization: &InitializationType<'tcx>,
Expand Down
2 changes: 2 additions & 0 deletions clippy_lints/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2254,12 +2254,14 @@ impl<'tcx> ImplicitHasherType<'tcx> {
}
}

#[allow(clippy::match_single_binding)]
fn ty(&self) -> Ty<'tcx> {
match *self {
ImplicitHasherType::HashMap(_, ty, ..) | ImplicitHasherType::HashSet(_, ty, ..) => ty,
}
}

#[allow(clippy::match_single_binding)]
fn span(&self) -> Span {
match *self {
ImplicitHasherType::HashMap(span, ..) | ImplicitHasherType::HashSet(span, ..) => span,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ struct PrintVisitor {
impl<'tcx> Visitor<'tcx> for PrintVisitor {
type Map = Map<'tcx>;

#[allow(clippy::too_many_lines)]
#[allow(clippy::too_many_lines, clippy::match_single_binding)]
fn visit_expr(&mut self, expr: &Expr<'_>) {
// handle if desugarings
// TODO add more desugarings here
Expand Down
2 changes: 2 additions & 0 deletions clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
left.ident.name == right.ident.name && self.eq_expr(&left.expr, &right.expr)
}

#[allow(clippy::match_single_binding)]
fn eq_guard(&mut self, left: &Guard<'_>, right: &Guard<'_>) -> bool {
match (left, right) {
(Guard::If(l), Guard::If(r)) => self.eq_expr(l, r),
Expand Down Expand Up @@ -579,6 +580,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
}
}

#[allow(clippy::match_single_binding)]
pub fn hash_guard(&mut self, g: &Guard<'_>) {
match g {
Guard::If(ref expr) => {
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/utils/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ fn print_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, indent: usize) {
}
}

#[allow(clippy::match_single_binding)]
fn print_guard(cx: &LateContext<'_, '_>, guard: &hir::Guard<'_>, indent: usize) {
let ind = " ".repeat(indent);
println!("{}+", ind);
Expand Down
1 change: 1 addition & 0 deletions clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub enum Sugg<'a> {
pub const ONE: Sugg<'static> = Sugg::NonParen(Cow::Borrowed("1"));

impl Display for Sugg<'_> {
#[allow(clippy::match_single_binding)]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
match *self {
Sugg::NonParen(ref s) | Sugg::MaybeParen(ref s) | Sugg::BinOp(_, ref s) => s.fmt(f),
Expand Down

0 comments on commit 6f7e035

Please sign in to comment.