Skip to content

Commit

Permalink
A neater revision of the "let-else" assignment in a25a42d
Browse files Browse the repository at this point in the history
Which is neater than #58
  • Loading branch information
martinthomson committed Jan 10, 2024
1 parent 717082b commit 1cfecf4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ohttp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ impl ClientRequest {
/// See `KeyConfig::decode_list` for the structure details.
pub fn from_encoded_config_list(encoded_config_list: &[u8]) -> Res<Self> {
let mut configs = KeyConfig::decode_list(encoded_config_list)?;
let Some(mut config) = configs.pop() else {
return Err(Error::Unsupported);
};
Self::from_config(&mut config)
if let Some(mut config) = configs.pop() {
Self::from_config(&mut config)
} else {
Err(Error::Unsupported)
}
}

/// Encapsulate a request. This consumes this object.
Expand Down

0 comments on commit 1cfecf4

Please sign in to comment.