Clarify the situation with dummy patterns and PatData
Use an explicit `Option` instead of requiring a `Default` bound
This commit is contained in:
parent
f6af7478ba
commit
5fccaee59c
6 changed files with 22 additions and 20 deletions
|
@ -860,7 +860,7 @@ fn report_arm_reachability<'p, 'tcx>(
|
|||
for (arm, is_useful) in report.arm_usefulness.iter() {
|
||||
match is_useful {
|
||||
Usefulness::Redundant => {
|
||||
report_unreachable_pattern(*arm.pat.data(), arm.arm_data, catchall)
|
||||
report_unreachable_pattern(*arm.pat.data().unwrap(), arm.arm_data, catchall)
|
||||
}
|
||||
Usefulness::Useful(redundant_subpats) if redundant_subpats.is_empty() => {}
|
||||
// The arm is reachable, but contains redundant subpatterns (from or-patterns).
|
||||
|
@ -869,12 +869,12 @@ fn report_arm_reachability<'p, 'tcx>(
|
|||
// Emit lints in the order in which they occur in the file.
|
||||
redundant_subpats.sort_unstable_by_key(|pat| pat.data());
|
||||
for pat in redundant_subpats {
|
||||
report_unreachable_pattern(*pat.data(), arm.arm_data, None);
|
||||
report_unreachable_pattern(*pat.data().unwrap(), arm.arm_data, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
if !arm.has_guard && catchall.is_none() && pat_is_catchall(arm.pat) {
|
||||
catchall = Some(*arm.pat.data());
|
||||
catchall = Some(*arm.pat.data().unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue