mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-14 14:29:53 +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;
|
let mut node = &self.root;
|
||||||
for outer in path {
|
for outer in path {
|
||||||
for comp in outer.split('/') {
|
for comp in outer.split('/') {
|
||||||
node = match node.children.get(comp) {
|
node = node.children.get(comp)?;
|
||||||
Some(n) => n,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(node)
|
Some(node)
|
||||||
@ -221,10 +218,7 @@ impl AclTree {
|
|||||||
let mut node = &mut self.root;
|
let mut node = &mut self.root;
|
||||||
for outer in path {
|
for outer in path {
|
||||||
for comp in outer.split('/') {
|
for comp in outer.split('/') {
|
||||||
node = match node.children.get_mut(comp) {
|
node = node.children.get_mut(comp)?;
|
||||||
Some(n) => n,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(node)
|
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.
|
/// 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> {
|
pub fn get_tfa_entry(config: &TfaConfig, userid: &str, id: &str) -> Option<TypedTfaInfo> {
|
||||||
let user_data = match config.users.get(userid) {
|
let user_data = config.users.get(userid)?;
|
||||||
Some(u) => u,
|
|
||||||
None => return None,
|
|
||||||
};
|
|
||||||
|
|
||||||
Some({
|
Some({
|
||||||
let res = {
|
let res = {
|
||||||
|
Loading…
Reference in New Issue
Block a user