Use Try syntax for Option in place of macros or match
This commit is contained in:
parent
c7b6d8263b
commit
3024c1434a
28 changed files with 92 additions and 230 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue