Skip to content

Commit 8e87b4f

Browse files
inline rest of the check
1 parent 51e5056 commit 8e87b4f

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

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

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> {
168168
{
169169
let mut chain_refutabilities = Vec::new();
170170
let Ok(()) = self.visit_land(ex, &mut chain_refutabilities) else { return };
171-
// Check only single let binding.
172-
if let [Some((_, refutability))] = chain_refutabilities[..] {
173-
self.check_single_let(refutability, ex.span);
171+
// Lint only single irrefutable let binding.
172+
if let [Some((_, Irrefutable))] = chain_refutabilities[..] {
173+
self.lint_single_let(ex.span);
174174
}
175175
return;
176176
}
@@ -562,17 +562,8 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
562562
}
563563

564564
#[instrument(level = "trace", skip(self))]
565-
fn check_single_let(&mut self, refutability: RefutableFlag, whole_chain_span: Span) {
566-
assert!(self.let_source != LetSource::None);
567-
if matches!(refutability, Irrefutable) {
568-
report_irrefutable_let_patterns(
569-
self.tcx,
570-
self.lint_level,
571-
self.let_source,
572-
1,
573-
whole_chain_span,
574-
);
575-
}
565+
fn lint_single_let(&mut self, let_span: Span) {
566+
report_irrefutable_let_patterns(self.tcx, self.lint_level, self.let_source, 1, let_span);
576567
}
577568

578569
fn analyze_binding(

0 commit comments

Comments
 (0)