Rewrite nested if
conditions into a single match
This commit is contained in:
parent
31ae7c46bd
commit
84a43f0e3a
1 changed files with 7 additions and 6 deletions
|
@ -473,16 +473,17 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
let mut seen = GrowableBitSet::default();
|
let mut seen = GrowableBitSet::default();
|
||||||
for arg in substs {
|
for arg in substs {
|
||||||
match arg.unpack() {
|
match arg.unpack() {
|
||||||
GenericArgKind::Lifetime(lt) => {
|
GenericArgKind::Lifetime(lt) => match (ignore_regions, lt.kind()) {
|
||||||
if ignore_regions == CheckRegions::OnlyEarlyBound {
|
(CheckRegions::OnlyEarlyBound, ty::ReEarlyBound(p)) => {
|
||||||
let ty::ReEarlyBound(p) = lt.kind() else {
|
|
||||||
return Err(NotUniqueParam::NotParam(lt.into()))
|
|
||||||
};
|
|
||||||
if !seen.insert(p.index) {
|
if !seen.insert(p.index) {
|
||||||
return Err(NotUniqueParam::DuplicateParam(lt.into()));
|
return Err(NotUniqueParam::DuplicateParam(lt.into()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
(CheckRegions::OnlyEarlyBound, _) => {
|
||||||
|
return Err(NotUniqueParam::NotParam(lt.into()));
|
||||||
|
}
|
||||||
|
(CheckRegions::No, _) => {}
|
||||||
|
},
|
||||||
GenericArgKind::Type(t) => match t.kind() {
|
GenericArgKind::Type(t) => match t.kind() {
|
||||||
ty::Param(p) => {
|
ty::Param(p) => {
|
||||||
if !seen.insert(p.index) {
|
if !seen.insert(p.index) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue