Skip to content

Commit de7752d

Browse files
committed
Allow match_single_binding lint in clippy_lints basecode
1 parent 7815f15 commit de7752d

File tree

9 files changed

+11
-1
lines changed

9 files changed

+11
-1
lines changed

clippy_lints/src/eval_order_dependence.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ struct DivergenceVisitor<'a, 'tcx> {
100100
}
101101

102102
impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
103+
#[allow(clippy::match_single_binding)]
103104
fn maybe_walk_expr(&mut self, e: &'tcx Expr<'_>) {
104105
match e.kind {
105106
ExprKind::Closure(..) => {},

clippy_lints/src/matches.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ where
989989
}
990990

991991
impl<'a, T: Copy> Kind<'a, T> {
992+
#[allow(clippy::match_single_binding)]
992993
fn range(&self) -> &'a SpannedRange<T> {
993994
match *self {
994995
Kind::Start(_, r) | Kind::End(_, r) => r,

clippy_lints/src/shadow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ fn lint_shadow<'a, 'tcx>(
309309
}
310310
}
311311

312+
#[allow(clippy::match_single_binding)]
312313
fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>, bindings: &mut Vec<(Name, Span)>) {
313314
if in_external_macro(cx.sess(), expr.span) {
314315
return;

clippy_lints/src/slow_vector_initialization.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ impl SlowVectorInit {
145145
}
146146
}
147147

148+
#[allow(clippy::match_single_binding)]
148149
fn lint_initialization<'tcx>(
149150
cx: &LateContext<'_, 'tcx>,
150151
initialization: &InitializationType<'tcx>,

clippy_lints/src/types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,12 +2254,14 @@ impl<'tcx> ImplicitHasherType<'tcx> {
22542254
}
22552255
}
22562256

2257+
#[allow(clippy::match_single_binding)]
22572258
fn ty(&self) -> Ty<'tcx> {
22582259
match *self {
22592260
ImplicitHasherType::HashMap(_, ty, ..) | ImplicitHasherType::HashSet(_, ty, ..) => ty,
22602261
}
22612262
}
22622263

2264+
#[allow(clippy::match_single_binding)]
22632265
fn span(&self) -> Span {
22642266
match *self {
22652267
ImplicitHasherType::HashMap(span, ..) | ImplicitHasherType::HashSet(span, ..) => span,

clippy_lints/src/utils/author.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ struct PrintVisitor {
191191
impl<'tcx> Visitor<'tcx> for PrintVisitor {
192192
type Map = Map<'tcx>;
193193

194-
#[allow(clippy::too_many_lines)]
194+
#[allow(clippy::too_many_lines, clippy::match_single_binding)]
195195
fn visit_expr(&mut self, expr: &Expr<'_>) {
196196
// handle if desugarings
197197
// TODO add more desugarings here

clippy_lints/src/utils/hir_utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
161161
left.ident.name == right.ident.name && self.eq_expr(&left.expr, &right.expr)
162162
}
163163

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

583+
#[allow(clippy::match_single_binding)]
582584
pub fn hash_guard(&mut self, g: &Guard<'_>) {
583585
match g {
584586
Guard::If(ref expr) => {

clippy_lints/src/utils/inspector.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ fn print_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat<'_>, indent: usize) {
514514
}
515515
}
516516

517+
#[allow(clippy::match_single_binding)]
517518
fn print_guard(cx: &LateContext<'_, '_>, guard: &hir::Guard<'_>, indent: usize) {
518519
let ind = " ".repeat(indent);
519520
println!("{}+", ind);

clippy_lints/src/utils/sugg.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub enum Sugg<'a> {
3333
pub const ONE: Sugg<'static> = Sugg::NonParen(Cow::Borrowed("1"));
3434

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

0 commit comments

Comments
 (0)