Rollup merge of #94600 - est31:master, r=notriddle
Use if let instead of manual match Factored out of #94139 . `if let` is better here than both `let ... else` and `let ... = match`.
This commit is contained in:
commit
b4baef5675
@ -1506,11 +1506,11 @@ impl Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
crate fn projection(&self) -> Option<(&Type, DefId, PathSegment)> {
|
crate fn projection(&self) -> Option<(&Type, DefId, PathSegment)> {
|
||||||
let (self_, trait_, assoc) = match self {
|
if let QPath { self_type, trait_, assoc, .. } = self {
|
||||||
QPath { self_type, trait_, assoc, .. } => (self_type, trait_, assoc),
|
Some((&self_type, trait_.def_id(), *assoc.clone()))
|
||||||
_ => return None,
|
} else {
|
||||||
};
|
None
|
||||||
Some((&self_, trait_.def_id(), *assoc.clone()))
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
|
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user