Skip to content

Commit cf716fc

Browse files
ehussweihanglo
authored andcommitted
Remove let-else, just use ? propagation.
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
1 parent 302a543 commit cf716fc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/cargo/sources/git/known_hosts.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,9 @@ fn parse_known_hosts_line(line: &str, location: KnownHostLocation) -> Option<Kno
478478
return None;
479479
}
480480
let mut parts = line.split([' ', '\t']).filter(|s| !s.is_empty());
481-
let Some(patterns) = parts.next() else { return None };
482-
let Some(key_type) = parts.next() else { return None };
483-
let Some(key) = parts.next() else { return None };
484-
let Ok(key) = base64::decode(key) else { return None };
481+
let patterns = parts.next()?;
482+
let key_type = parts.next()?;
483+
let key = parts.next().map(base64::decode)?.ok()?;
485484
Some(KnownHost {
486485
location,
487486
patterns: patterns.to_string(),

0 commit comments

Comments
 (0)