Skip to content

Commit b4baef5

Browse files
authored
Rollup merge of rust-lang#94600 - est31:master, r=notriddle
Use if let instead of manual match Factored out of rust-lang#94139 . `if let` is better here than both `let ... else` and `let ... = match`.
2 parents f9b4976 + 18528a2 commit b4baef5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustdoc/clean/types.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1506,11 +1506,11 @@ impl Type {
15061506
}
15071507

15081508
crate fn projection(&self) -> Option<(&Type, DefId, PathSegment)> {
1509-
let (self_, trait_, assoc) = match self {
1510-
QPath { self_type, trait_, assoc, .. } => (self_type, trait_, assoc),
1511-
_ => return None,
1512-
};
1513-
Some((&self_, trait_.def_id(), *assoc.clone()))
1509+
if let QPath { self_type, trait_, assoc, .. } = self {
1510+
Some((&self_type, trait_.def_id(), *assoc.clone()))
1511+
} else {
1512+
None
1513+
}
15141514
}
15151515

15161516
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {

0 commit comments

Comments
 (0)