mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-13 20:15:10 +00:00
access-control/tfa: use ?
instead of unnecessary match statements
this makes the code more concise and legible. fixes a clippy lint [1]. [1]: https://rust-lang.github.io/rust-clippy/master/index.html#question_mark Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
This commit is contained in:
parent
a318fcedd3
commit
946d95cfcd
@ -208,10 +208,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)
|
||||
@ -221,10 +218,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)
|
||||
|
@ -98,10 +98,7 @@ pub fn list_user_tfa(config: &TfaConfig, userid: &str) -> Result<Vec<TypedTfaInf
|
||||
///
|
||||
/// In case this returns `None` a `NOT_FOUND` http error should be returned.
|
||||
pub fn get_tfa_entry(config: &TfaConfig, userid: &str, id: &str) -> Option<TypedTfaInfo> {
|
||||
let user_data = match config.users.get(userid) {
|
||||
Some(u) => u,
|
||||
None => return None,
|
||||
};
|
||||
let user_data = config.users.get(userid)?;
|
||||
|
||||
Some({
|
||||
let res = {
|
||||
|
Loading…
Reference in New Issue
Block a user