未验证 提交 b4baef56 编写于 作者: M Matthias Krüger 提交者: GitHub

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`.
......@@ -1506,11 +1506,11 @@ impl Type {
}
crate fn projection(&self) -> Option<(&Type, DefId, PathSegment)> {
let (self_, trait_, assoc) = match self {
QPath { self_type, trait_, assoc, .. } => (self_type, trait_, assoc),
_ => return None,
};
Some((&self_, trait_.def_id(), *assoc.clone()))
if let QPath { self_type, trait_, assoc, .. } = self {
Some((&self_type, trait_.def_id(), *assoc.clone()))
} else {
None
}
}
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册