mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-04-28 12:50:53 +00:00
replace match statements with ? operator
When possible. Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
c4c050dc36
commit
f1a5808e67
@ -342,10 +342,7 @@ impl AclTree {
|
||||
let mut node = &self.root;
|
||||
for outer in path {
|
||||
for comp in outer.split('/') {
|
||||
node = match node.children.get(comp) {
|
||||
Some(n) => n,
|
||||
None => return None,
|
||||
};
|
||||
node = node.children.get(comp)?;
|
||||
}
|
||||
}
|
||||
Some(node)
|
||||
@ -355,10 +352,7 @@ impl AclTree {
|
||||
let mut node = &mut self.root;
|
||||
for outer in path {
|
||||
for comp in outer.split('/') {
|
||||
node = match node.children.get_mut(comp) {
|
||||
Some(n) => n,
|
||||
None => return None,
|
||||
};
|
||||
node = node.children.get_mut(comp)?;
|
||||
}
|
||||
}
|
||||
Some(node)
|
||||
|
@ -417,10 +417,9 @@ impl Iterator for ListNamespacesRecursive {
|
||||
if state.is_empty() {
|
||||
return None; // there's a state but it's empty -> we're all done
|
||||
}
|
||||
let iter = match state.last_mut() {
|
||||
Some(iter) => iter,
|
||||
None => return None, // unexpected, should we just unwrap?
|
||||
};
|
||||
// should we just unwrap on None?
|
||||
let iter = state.last_mut()?;
|
||||
|
||||
match iter.next() {
|
||||
Some(Ok(ns)) => {
|
||||
if state.len() < self.max_depth as usize {
|
||||
|
Loading…
Reference in New Issue
Block a user