diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-08-01 01:54:24 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-08-01 01:54:24 +0200 |
| commit | 91793b790077edac19ecfba1ec3a5dcce71d67fb (patch) | |
| tree | fcad2bf7eda4d2ae8ddc61f6234551ae994105cc /cli/src/search.rs | |
| parent | 29aaafeb67df0c5d9382c2cb9e9c3d1a07afba09 (diff) | |
| download | money-91793b790077edac19ecfba1ec3a5dcce71d67fb.tar.gz | |
return None if applicable
Diffstat (limited to 'cli/src/search.rs')
| -rw-r--r-- | cli/src/search.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/src/search.rs b/cli/src/search.rs index c19437f..ff9f772 100644 --- a/cli/src/search.rs +++ b/cli/src/search.rs @@ -26,8 +26,8 @@ impl DateIsh { pub fn parse_relative(s: &str) -> Option<Duration> { //TODO Month and year. Would depend on current date so maybe parse in one place. - let num = s[..s.len()-1].parse().unwrap(); - Some(match s.chars().last().unwrap() { + let num = s[..s.len()-1].parse().ok()?; + Some(match s.chars().last()? { 'd' => Duration::days(num), 'w' => Duration::weeks(num), _ => unimplemented!(), |
