Skip to content

Commit

Permalink
Use if let instead of manual match
Browse files Browse the repository at this point in the history
  • Loading branch information
est31 committed Mar 4, 2022
1 parent 65f6d33 commit 18528a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 18528a2

Please sign in to comment.