From 63c080840a7567f67effa9703d7c94b488d22fc1 Mon Sep 17 00:00:00 2001 From: murilo ijanc Date: Wed, 25 Mar 2026 15:10:15 -0300 Subject: Fix clippy warnings: needless borrow and collapsible if --- src/bin/tpd.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/bin') diff --git a/src/bin/tpd.rs b/src/bin/tpd.rs index c37afb6..54dbd7f 100644 --- a/src/bin/tpd.rs +++ b/src/bin/tpd.rs @@ -140,11 +140,11 @@ fn main() { eprintln!("error: cannot create {}: {e}", dir.display()); std::process::exit(1); } - if let Some(parent) = sock_path.parent() { - if let Err(e) = std::fs::create_dir_all(parent) { - eprintln!("error: cannot create {}: {e}", parent.display()); - std::process::exit(1); - } + if let Some(parent) = sock_path.parent() + && let Err(e) = std::fs::create_dir_all(parent) + { + eprintln!("error: cannot create {}: {e}", parent.display()); + std::process::exit(1); } let store = match PasteStore::open(&dir) { @@ -198,10 +198,10 @@ fn main() { // Apply unveil(2) to restrict filesystem visibility, // then pledge(2) to restrict syscalls. sandbox::do_unveil(&dir, "rwc"); - if sock_path.parent() != Some(dir.as_ref()) { - if let Some(parent) = sock_path.parent() { - sandbox::do_unveil(parent, "rwc"); - } + if sock_path.parent() != Some(dir.as_ref()) + && let Some(parent) = sock_path.parent() + { + sandbox::do_unveil(parent, "rwc"); } if !no_auto_bootstrap || !bootstrap.is_empty() { sandbox::do_unveil(std::path::Path::new("/etc/resolv.conf"), "r"); -- cgit v1.2.3