Skip to content

Commit d8d91b6

Browse files
committed
Rename PatKind::Lit to Expr
1 parent 0514808 commit d8d91b6

File tree

45 files changed

+78
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+78
-78
lines changed

compiler/rustc_ast/src/ast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ impl Pat {
623623
PatKind::Wild
624624
| PatKind::Rest
625625
| PatKind::Never
626-
| PatKind::Lit(_)
626+
| PatKind::Expr(_)
627627
| PatKind::Range(..)
628628
| PatKind::Ident(..)
629629
| PatKind::Path(..)
@@ -801,8 +801,8 @@ pub enum PatKind {
801801
/// A reference pattern (e.g., `&mut (a, b)`).
802802
Ref(P<Pat>, Mutability),
803803

804-
/// A literal.
805-
Lit(P<Expr>),
804+
/// A literal, const block or path.
805+
Expr(P<Expr>),
806806

807807
/// A range pattern (e.g., `1...2`, `1..2`, `1..`, `..2`, `1..=2`, `..=2`).
808808
Range(Option<P<Expr>>, Option<P<Expr>>, Spanned<RangeEnd>),

compiler/rustc_ast/src/mut_visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ pub fn walk_pat<T: MutVisitor>(vis: &mut T, pat: &mut P<Pat>) {
15121512
vis.visit_ident(ident);
15131513
visit_opt(sub, |sub| vis.visit_pat(sub));
15141514
}
1515-
PatKind::Lit(e) => vis.visit_expr(e),
1515+
PatKind::Expr(e) => vis.visit_expr(e),
15161516
PatKind::TupleStruct(qself, path, elems) => {
15171517
vis.visit_qself(qself);
15181518
vis.visit_path(path);

compiler/rustc_ast/src/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) -> V::Res
680680
try_visit!(visitor.visit_ident(ident));
681681
visit_opt!(visitor, visit_pat, optional_subpattern);
682682
}
683-
PatKind::Lit(expression) => try_visit!(visitor.visit_expr(expression)),
683+
PatKind::Expr(expression) => try_visit!(visitor.visit_expr(expression)),
684684
PatKind::Range(lower_bound, upper_bound, _end) => {
685685
visit_opt!(visitor, visit_expr, lower_bound);
686686
visit_opt!(visitor, visit_expr, upper_bound);

compiler/rustc_ast_lowering/src/pat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3838
lower_sub,
3939
);
4040
}
41-
PatKind::Lit(e) => {
42-
break hir::PatKind::Lit(self.lower_expr_within_pat(e, false));
41+
PatKind::Expr(e) => {
42+
break hir::PatKind::Expr(self.lower_expr_within_pat(e, false));
4343
}
4444
PatKind::TupleStruct(qself, path, pats) => {
4545
let qpath = self.lower_qpath(

compiler/rustc_ast_pretty/src/pprust/state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@ impl<'a> State<'a> {
17011701
self.print_pat(inner);
17021702
}
17031703
}
1704-
PatKind::Lit(e) => self.print_expr(e, FixupContext::default()),
1704+
PatKind::Expr(e) => self.print_expr(e, FixupContext::default()),
17051705
PatKind::Range(begin, end, Spanned { node: end_kind, .. }) => {
17061706
if let Some(e) = begin {
17071707
self.print_expr(e, FixupContext::default());

compiler/rustc_expand/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ impl MacResult for MacEager {
522522
return Some(P(ast::Pat {
523523
id: ast::DUMMY_NODE_ID,
524524
span: e.span,
525-
kind: PatKind::Lit(e),
525+
kind: PatKind::Expr(e),
526526
tokens: None,
527527
}));
528528
}

compiler/rustc_expand/src/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl<'a> ExtCtxt<'a> {
486486
self.pat(span, PatKind::Wild)
487487
}
488488
pub fn pat_lit(&self, span: Span, expr: P<ast::Expr>) -> P<ast::Pat> {
489-
self.pat(span, PatKind::Lit(expr))
489+
self.pat(span, PatKind::Expr(expr))
490490
}
491491
pub fn pat_ident(&self, span: Span, ident: Ident) -> P<ast::Pat> {
492492
self.pat_ident_binding_mode(span, ident, ast::BindingMode::NONE)

compiler/rustc_hir/src/hir.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ impl<'hir> Pat<'hir> {
13861386

13871387
use PatKind::*;
13881388
match self.kind {
1389-
Wild | Never | Lit(_) | Range(..) | Binding(.., None) | Path(_) | Err(_) => true,
1389+
Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Path(_) | Err(_) => true,
13901390
Box(s) | Deref(s) | Ref(s, _) | Binding(.., Some(s)) => s.walk_short_(it),
13911391
Struct(_, fields, _) => fields.iter().all(|field| field.pat.walk_short_(it)),
13921392
TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().all(|p| p.walk_short_(it)),
@@ -1413,7 +1413,7 @@ impl<'hir> Pat<'hir> {
14131413

14141414
use PatKind::*;
14151415
match self.kind {
1416-
Wild | Never | Lit(_) | Range(..) | Binding(.., None) | Path(_) | Err(_) => {}
1416+
Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Path(_) | Err(_) => {}
14171417
Box(s) | Deref(s) | Ref(s, _) | Binding(.., Some(s)) => s.walk_(it),
14181418
Struct(_, fields, _) => fields.iter().for_each(|field| field.pat.walk_(it)),
14191419
TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().for_each(|p| p.walk_(it)),
@@ -1583,8 +1583,8 @@ pub enum PatKind<'hir> {
15831583
/// A reference pattern (e.g., `&mut (a, b)`).
15841584
Ref(&'hir Pat<'hir>, Mutability),
15851585

1586-
/// A literal.
1587-
Lit(&'hir PatExpr<'hir>),
1586+
/// A literal, const block or path.
1587+
Expr(&'hir PatExpr<'hir>),
15881588

15891589
/// A range pattern (e.g., `1..=2` or `1..2`).
15901590
Range(Option<&'hir PatExpr<'hir>>, Option<&'hir PatExpr<'hir>>, RangeEnd),

compiler/rustc_hir/src/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat<'v>) -> V:
688688
try_visit!(visitor.visit_ident(ident));
689689
visit_opt!(visitor, visit_pat, optional_subpattern);
690690
}
691-
PatKind::Lit(ref expression) => try_visit!(visitor.visit_pat_expr(expression)),
691+
PatKind::Expr(ref expression) => try_visit!(visitor.visit_pat_expr(expression)),
692692
PatKind::Range(ref lower_bound, ref upper_bound, _) => {
693693
visit_opt!(visitor, visit_pat_expr, lower_bound);
694694
visit_opt!(visitor, visit_pat_expr, upper_bound);

compiler/rustc_hir_analysis/src/check/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ fn resolve_local<'tcx>(
701701
| PatKind::Wild
702702
| PatKind::Never
703703
| PatKind::Path(_)
704-
| PatKind::Lit(_)
704+
| PatKind::Expr(_)
705705
| PatKind::Range(_, _, _)
706706
| PatKind::Err(_) => false,
707707
}

compiler/rustc_hir_pretty/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ impl<'a> State<'a> {
19801980
self.pclose();
19811981
}
19821982
}
1983-
PatKind::Lit(e) => self.print_pat_expr(e),
1983+
PatKind::Expr(e) => self.print_pat_expr(e),
19841984
PatKind::Range(begin, end, end_kind) => {
19851985
if let Some(expr) = begin {
19861986
self.print_pat_expr(expr);

compiler/rustc_hir_typeck/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
482482
| hir::PatKind::Box(_)
483483
| hir::PatKind::Ref(_, _)
484484
| hir::PatKind::Deref(_)
485-
| hir::PatKind::Lit(_)
485+
| hir::PatKind::Expr(_)
486486
| hir::PatKind::Range(_, _, _)
487487
| hir::PatKind::Slice(_, _, _)
488488
| hir::PatKind::Err(_) => true,

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
595595
let place_ty = place.place.ty();
596596
needs_to_be_read |= self.is_multivariant_adt(place_ty, pat.span);
597597
}
598-
PatKind::Lit(_) | PatKind::Range(..) => {
598+
PatKind::Expr(_) | PatKind::Range(..) => {
599599
// If the PatKind is a Lit or a Range then we want
600600
// to borrow discr.
601601
needs_to_be_read = true;
@@ -1802,7 +1802,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
18021802

18031803
PatKind::Path(_)
18041804
| PatKind::Binding(.., None)
1805-
| PatKind::Lit(..)
1805+
| PatKind::Expr(..)
18061806
| PatKind::Range(..)
18071807
| PatKind::Never
18081808
| PatKind::Wild

compiler/rustc_hir_typeck/src/pat.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
271271
PatKind::Wild | PatKind::Err(_) => expected,
272272
// We allow any type here; we ensure that the type is uninhabited during match checking.
273273
PatKind::Never => expected,
274-
PatKind::Lit(lt) => self.check_pat_lit(pat.span, lt, expected, ti),
274+
PatKind::Expr(lt) => self.check_pat_lit(pat.span, lt, expected, ti),
275275
PatKind::Range(lhs, rhs, _) => self.check_pat_range(pat.span, lhs, rhs, expected, ti),
276276
PatKind::Binding(ba, var_id, ident, sub) => {
277277
self.check_pat_ident(pat, ba, var_id, ident, sub, expected, pat_info)
@@ -394,7 +394,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
394394
// As a result, we allow `if let 0 = &&0 {}` but not `if let "foo" = &&"foo" {}`.
395395
//
396396
// Call `resolve_vars_if_possible` here for inline const blocks.
397-
PatKind::Lit(lt) => match self.resolve_vars_if_possible(self.check_pat_expr_unadjusted(lt)).kind() {
397+
PatKind::Expr(lt) => match self.resolve_vars_if_possible(self.check_pat_expr_unadjusted(lt)).kind() {
398398
ty::Ref(..) => AdjustMode::Pass,
399399
_ => AdjustMode::Peel,
400400
},
@@ -935,7 +935,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
935935
| PatKind::Box(..)
936936
| PatKind::Deref(_)
937937
| PatKind::Ref(..)
938-
| PatKind::Lit(..)
938+
| PatKind::Expr(..)
939939
| PatKind::Range(..)
940940
| PatKind::Err(_) => break 'block None,
941941
},
@@ -1829,7 +1829,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18291829
}
18301830
} else if inexistent_fields.len() == 1 {
18311831
match pat_field.pat.kind {
1832-
PatKind::Lit(_)
1832+
PatKind::Expr(_)
18331833
if !self.may_coerce(
18341834
self.typeck_results.borrow().node_type(pat_field.pat.hir_id),
18351835
self.field_ty(field.span, field_def, args),

compiler/rustc_lint/src/unused.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ impl EarlyLintPass for UnusedParens {
12201220
// Do not lint on `(..)` as that will result in the other arms being useless.
12211221
Paren(_)
12221222
// The other cases do not contain sub-patterns.
1223-
| Wild | Never | Rest | Lit(..) | MacCall(..) | Range(..) | Ident(.., None) | Path(..) | Err(_) => {},
1223+
| Wild | Never | Rest | Expr(..) | MacCall(..) | Range(..) | Ident(.., None) | Path(..) | Err(_) => {},
12241224
// These are list-like patterns; parens can always be removed.
12251225
TupleStruct(_, _, ps) | Tuple(ps) | Slice(ps) | Or(ps) => for p in ps {
12261226
self.check_unused_parens_pat(cx, p, false, false, keep_space);

compiler/rustc_mir_build/src/thir/pattern/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
324324

325325
hir::PatKind::Never => PatKind::Never,
326326

327-
hir::PatKind::Lit(value) => self.lower_lit(value),
327+
hir::PatKind::Expr(value) => self.lower_lit(value),
328328

329329
hir::PatKind::Range(ref lo_expr, ref hi_expr, end) => {
330330
let (lo_expr, hi_expr) = (lo_expr.as_deref(), hi_expr.as_deref());

compiler/rustc_parse/src/parser/pat.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,14 @@ impl<'a> Parser<'a> {
656656
fn visit_pat(&mut self, p: &'a Pat) -> Self::Result {
657657
match &p.kind {
658658
// Base expression
659-
PatKind::Err(_) | PatKind::Lit(_) => {
659+
PatKind::Err(_) | PatKind::Expr(_) => {
660660
self.maybe_add_suggestions_then_emit(p.span, p.span, false)
661661
}
662662

663663
// Sub-patterns
664664
// FIXME: this doesn't work with recursive subpats (`&mut &mut <err>`)
665665
PatKind::Box(subpat) | PatKind::Ref(subpat, _)
666-
if matches!(subpat.kind, PatKind::Err(_) | PatKind::Lit(_)) =>
666+
if matches!(subpat.kind, PatKind::Err(_) | PatKind::Expr(_)) =>
667667
{
668668
self.maybe_add_suggestions_then_emit(subpat.span, p.span, false)
669669
}
@@ -766,7 +766,7 @@ impl<'a> Parser<'a> {
766766
if let Some(re) = self.parse_range_end() {
767767
self.parse_pat_range_begin_with(const_expr, re)?
768768
} else {
769-
PatKind::Lit(const_expr)
769+
PatKind::Expr(const_expr)
770770
}
771771
} else if self.is_builtin() {
772772
self.parse_pat_builtin()?
@@ -833,7 +833,7 @@ impl<'a> Parser<'a> {
833833
.struct_span_err(self_.token.span, msg)
834834
.with_span_label(self_.token.span, format!("expected {expected}"))
835835
});
836-
PatKind::Lit(self.mk_expr(lo, ExprKind::Lit(lit)))
836+
PatKind::Expr(self.mk_expr(lo, ExprKind::Lit(lit)))
837837
} else {
838838
// Try to parse everything else as literal with optional minus
839839
match self.parse_literal_maybe_minus() {
@@ -845,7 +845,7 @@ impl<'a> Parser<'a> {
845845

846846
match self.parse_range_end() {
847847
Some(form) => self.parse_pat_range_begin_with(begin, form)?,
848-
None => PatKind::Lit(begin),
848+
None => PatKind::Expr(begin),
849849
}
850850
}
851851
Err(err) => return self.fatal_unexpected_non_pat(err, expected),
@@ -989,7 +989,7 @@ impl<'a> Parser<'a> {
989989

990990
match &pat.kind {
991991
// recover ranges with parentheses around the `(start)..`
992-
PatKind::Lit(begin)
992+
PatKind::Expr(begin)
993993
if self.may_recover()
994994
&& let Some(form) = self.parse_range_end() =>
995995
{

compiler/rustc_passes/src/input_stats.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
304304
Box,
305305
Deref,
306306
Ref,
307-
Lit,
307+
Expr,
308308
Range,
309309
Slice,
310310
Err
@@ -586,7 +586,7 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
586586
Box,
587587
Deref,
588588
Ref,
589-
Lit,
589+
Expr,
590590
Range,
591591
Slice,
592592
Rest,

src/librustdoc/clean/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ pub(crate) fn name_from_pat(p: &hir::Pat<'_>) -> Symbol {
314314
PatKind::Box(p) => return name_from_pat(p),
315315
PatKind::Deref(p) => format!("deref!({})", name_from_pat(p)),
316316
PatKind::Ref(p, _) => return name_from_pat(p),
317-
PatKind::Lit(..) => {
317+
PatKind::Expr(..) => {
318318
warn!(
319-
"tried to get argument name from PatKind::Lit, which is silly in function arguments"
319+
"tried to get argument name from PatKind::Expr, which is silly in function arguments"
320320
);
321321
return Symbol::intern("()");
322322
}

src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl<'tcx> Visitor<'tcx> for NumericFallbackVisitor<'_, 'tcx> {
224224

225225
fn visit_pat(&mut self, pat: &'tcx Pat<'_>) {
226226
match pat.kind {
227-
PatKind::Lit(&PatExpr {
227+
PatKind::Expr(&PatExpr {
228228
hir_id,
229229
kind: PatExprKind::Lit { lit, .. },
230230
..

src/tools/clippy/clippy_lints/src/equatable_if_let.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn unary_pattern(pat: &Pat<'_>) -> bool {
5656
PatKind::Struct(_, a, etc) => !etc && a.iter().all(|x| unary_pattern(x.pat)),
5757
PatKind::Tuple(a, etc) | PatKind::TupleStruct(_, a, etc) => etc.as_opt_usize().is_none() && array_rec(a),
5858
PatKind::Ref(x, _) | PatKind::Box(x) | PatKind::Deref(x) => unary_pattern(x),
59-
PatKind::Path(_) | PatKind::Lit(_) => true,
59+
PatKind::Path(_) | PatKind::Expr(_) => true,
6060
}
6161
}
6262

src/tools/clippy/clippy_lints/src/len_zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
163163
if let ExprKind::Let(lt) = expr.kind
164164
&& match lt.pat.kind {
165165
PatKind::Slice([], None, []) => true,
166-
PatKind::Lit(lit) => match lit.kind {
166+
PatKind::Expr(lit) => match lit.kind {
167167
PatExprKind::Lit { lit, .. } => match lit.node {
168168
LitKind::Str(lit, _) => lit.as_str().is_empty(),
169169
_ => false,

src/tools/clippy/clippy_lints/src/manual_range_patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl LateLintPass<'_> for ManualRangePatterns {
8989
let mut ranges_found = Vec::new();
9090

9191
for pat in pats {
92-
if let PatKind::Lit(lit) = pat.kind
92+
if let PatKind::Expr(lit) = pat.kind
9393
&& let Some(num) = Num::new(lit)
9494
{
9595
numbers_found.insert(num.val);

src/tools/clippy/clippy_lints/src/matches/match_bool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(crate) fn check(cx: &LateContext<'_>, scrutinee: &Expr<'_>, arms: &[Arm<'_>]
2121
move |diag| {
2222
if arms.len() == 2 {
2323
// no guards
24-
let exprs = if let PatKind::Lit(arm_bool) = arms[0].pat.kind {
24+
let exprs = if let PatKind::Expr(arm_bool) = arms[0].pat.kind {
2525
if let PatExprKind::Lit { lit, .. } = arm_bool.kind {
2626
match lit.node {
2727
LitKind::Bool(true) => Some((arms[0].body, arms[1].body)),

src/tools/clippy/clippy_lints/src/matches/match_same_arms.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_arena::DroplessArena;
77
use rustc_ast::ast::LitKind;
88
use rustc_errors::Applicability;
99
use rustc_hir::def_id::DefId;
10-
use rustc_hir::{Arm, Expr, PatExprKind, HirId, HirIdMap, HirIdMapEntry, HirIdSet, Pat, PatKind, RangeEnd};
10+
use rustc_hir::{Arm, Expr, HirId, HirIdMap, HirIdMapEntry, HirIdSet, Pat, PatExprKind, PatKind, RangeEnd};
1111
use rustc_lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
1212
use rustc_lint::{LateContext, LintContext};
1313
use rustc_middle::ty;
@@ -309,9 +309,9 @@ impl<'a> NormalizedPat<'a> {
309309
);
310310
Self::Tuple(None, pats)
311311
},
312-
PatKind::Lit(e) => match &e.kind {
312+
PatKind::Expr(e) => match &e.kind {
313313
// TODO: Handle negative integers. They're currently treated as a wild match.
314-
PatExprKind::Lit{ lit, negated: false } => match lit.node {
314+
PatExprKind::Lit { lit, negated: false } => match lit.node {
315315
LitKind::Str(sym, _) => Self::LitStr(sym),
316316
LitKind::ByteStr(ref bytes, _) | LitKind::CStr(ref bytes, _) => Self::LitBytes(bytes),
317317
LitKind::Byte(val) => Self::LitInt(val.into()),

src/tools/clippy/clippy_lints/src/matches/match_str_case_mismatch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn verify_case<'a>(case_method: &'a CaseMethod, arms: &'a [Arm<'_>]) -> Option<(
8585
};
8686

8787
for arm in arms {
88-
if let PatKind::Lit(PatExpr {
88+
if let PatKind::Expr(PatExpr {
8989
kind: PatExprKind::Lit { lit, negated: false },
9090
..
9191
}) = arm.pat.kind

src/tools/clippy/clippy_lints/src/matches/needless_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fn pat_same_as_expr(pat: &Pat<'_>, expr: &Expr<'_>) -> bool {
189189
});
190190
},
191191
// Example: `5 => 5`
192-
(PatKind::Lit(pat_expr_expr), ExprKind::Lit(expr_spanned)) => {
192+
(PatKind::Expr(pat_expr_expr), ExprKind::Lit(expr_spanned)) => {
193193
if let PatExprKind::Lit {
194194
lit: pat_spanned,
195195
negated: false,

src/tools/clippy/clippy_lints/src/matches/overlapping_arms.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn all_ranges<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>], ty: Ty<'tcx>)
5757
});
5858
}
5959

60-
if let PatKind::Lit(value) = pat.kind {
60+
if let PatKind::Expr(value) = pat.kind {
6161
let value = ConstEvalCtxt::new(cx)
6262
.eval_pat_expr(value)?
6363
.int_value(cx.tcx, cx.typeck_results().node_type(pat.hir_id))?;

0 commit comments

Comments
 (0)