1
Fork 0

Use Try syntax for Option in place of macros or match

This commit is contained in:
Matt Brubeck 2017-12-08 17:32:04 -08:00
parent c7b6d8263b
commit 3024c1434a
28 changed files with 92 additions and 230 deletions

View file

@ -1052,10 +1052,7 @@ impl Json {
pub fn find_path<'a>(&'a self, keys: &[&str]) -> Option<&'a Json>{
let mut target = self;
for key in keys {
match target.find(*key) {
Some(t) => { target = t; },
None => return None
}
target = target.find(*key)?;
}
Some(target)
}