mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
Rewrite nested if
conditions into a single match
This commit is contained in:
parent
31ae7c46bd
commit
84a43f0e3a
@ -473,16 +473,17 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
let mut seen = GrowableBitSet::default();
|
||||
for arg in substs {
|
||||
match arg.unpack() {
|
||||
GenericArgKind::Lifetime(lt) => {
|
||||
if ignore_regions == CheckRegions::OnlyEarlyBound {
|
||||
let ty::ReEarlyBound(p) = lt.kind() else {
|
||||
return Err(NotUniqueParam::NotParam(lt.into()))
|
||||
};
|
||||
GenericArgKind::Lifetime(lt) => match (ignore_regions, lt.kind()) {
|
||||
(CheckRegions::OnlyEarlyBound, ty::ReEarlyBound(p)) => {
|
||||
if !seen.insert(p.index) {
|
||||
return Err(NotUniqueParam::DuplicateParam(lt.into()));
|
||||
}
|
||||
}
|
||||
}
|
||||
(CheckRegions::OnlyEarlyBound, _) => {
|
||||
return Err(NotUniqueParam::NotParam(lt.into()));
|
||||
}
|
||||
(CheckRegions::No, _) => {}
|
||||
},
|
||||
GenericArgKind::Type(t) => match t.kind() {
|
||||
ty::Param(p) => {
|
||||
if !seen.insert(p.index) {
|
||||
|
Loading…
Reference in New Issue
Block a user