Browse Source

if let is cuter

master
Julio Biason 6 years ago
parent
commit
a3f3b39123
  1. 7
      src/main.rs

7
src/main.rs

@ -45,9 +45,10 @@ fn main() {
.take(2)
.map(|record| { dump_record(&record); record })
.fold(None, {|first, current| {
match first {
Some(x) => Some(x),
None => Some(current.id)
if let Some(_) = first {
first
} else {
Some(current.id)
}
}});
log::debug!("First favourite: {:?}", most_recent_favourite);

Loading…
Cancel
Save