[pdm-devel] [PATCH proxmox v4 2/5] access-control: use format strings where possible
Shannon Sterz
s.sterz at proxmox.com
Fri Nov 14 15:43:10 CET 2025
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner at proxmox.com>
Tested-by: Lukas Wagner <l.wagner at proxmox.com>
---
proxmox-access-control/src/acl.rs | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/proxmox-access-control/src/acl.rs b/proxmox-access-control/src/acl.rs
index 7813ea5d..f2589e57 100644
--- a/proxmox-access-control/src/acl.rs
+++ b/proxmox-access-control/src/acl.rs
@@ -335,7 +335,7 @@ impl AclTree {
for user_or_group in &uglist {
for role in &rolelist {
if !access_conf().roles().contains_key(role) {
- bail!("unknown role '{}'", role);
+ bail!("unknown role '{role}'");
}
if let Some(group) = user_or_group.strip_prefix('@') {
node.insert_group_role(group.to_string(), role.to_string(), propagate);
@@ -358,9 +358,8 @@ impl AclTree {
}
if let Err(err) = tree.parse_acl_line(line) {
bail!(
- "unable to parse acl config data, line {} - {}",
+ "unable to parse acl config data, line {} - {err}",
linenr + 1,
- err
);
}
}
@@ -493,10 +492,8 @@ impl AclTree {
let role_list = role_list(roles);
writeln!(
w,
- "acl:0:{}:{}:{}",
+ "acl:0:{}:{uglist}:{role_list}",
if path.is_empty() { "/" } else { path },
- uglist,
- role_list
)?;
}
@@ -504,10 +501,8 @@ impl AclTree {
let role_list = role_list(roles);
writeln!(
w,
- "acl:1:{}:{}:{}",
+ "acl:1:{}:{uglist}:{role_list}",
if path.is_empty() { "/" } else { path },
- uglist,
- role_list
)?;
}
@@ -532,7 +527,7 @@ impl AclTree {
if err.kind() == std::io::ErrorKind::NotFound {
String::new()
} else {
- bail!("unable to read acl config {:?} - {}", filename, err);
+ bail!("unable to read acl config {filename:?} - {err}");
}
}
};
@@ -546,10 +541,8 @@ impl AclTree {
}
if let Err(err) = tree.parse_acl_line(line) {
bail!(
- "unable to parse acl config {:?}, line {} - {}",
- filename,
- linenr + 1,
- err
+ "unable to parse acl config {filename:?}, line {} - {err}",
+ linenr + 1
);
}
}
--
2.47.3
More information about the pdm-devel
mailing list