Replace unwrap with match

This commit is contained in:
Matthias Beyer 2016-08-04 14:15:34 +02:00
parent 669b5a936a
commit 99612b4ecc

View file

@ -205,10 +205,10 @@ impl FromStoreId for DiaryId {
debug!("Year = {:?}", year); debug!("Year = {:?}", year);
debug!("Name = {:?}", name); debug!("Name = {:?}", name);
let day = if day.is_none() { return None; } else { day.unwrap() }; let day = match day { None => return None, Some(day) => day };
let month = if month.is_none() { return None; } else { month.unwrap() }; let month = match month { None => return None, Some(month) => month };
let year = if year.is_none() { return None; } else { year.unwrap() }; let year = match year { None => return None, Some(year) => year };
let name = if name.is_none() { return None; } else { name.unwrap() }; let name = match name { None => return None, Some(name) => name };
Some(DiaryId::new(name, year, month, day, hour, minute)) Some(DiaryId::new(name, year, month, day, hour, minute))
} }