fix: collapse nested if-let to satisfy clippy::collapsible_if lint

This commit is contained in:
huqiantao
2026-06-07 19:55:38 +08:00
parent 9aa71e24c0
commit 5e761a616c
+8 -8
View File
@@ -131,14 +131,14 @@ pub(super) fn emit_tool_audit(event: serde_json::Value) {
}
};
let path = PathBuf::from(path);
if let Some(parent) = path.parent() {
if let Err(e) = std::fs::create_dir_all(parent) {
tracing::error!(
"Failed to create audit log directory {}: {e}",
parent.display()
);
return;
}
if let Some(parent) = path.parent()
&& let Err(e) = std::fs::create_dir_all(parent)
{
tracing::error!(
"Failed to create audit log directory {}: {e}",
parent.display()
);
return;
}
match OpenOptions::new().create(true).append(true).open(&path) {
Ok(mut file) => {