From 535350ead8c9336bf3eb0c44e826a905eb38b5d2 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Mon, 25 Mar 2024 13:19:48 -0400 Subject: [PATCH] Fix various accumulated clippy lints Signed-off-by: John Eckersberg --- lib/build.rs | 2 +- lib/src/deploy.rs | 2 +- lib/src/install.rs | 7 ++----- lib/src/lsm.rs | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/build.rs b/lib/build.rs index 2f9ccaf3a..88690b557 100644 --- a/lib/build.rs +++ b/lib/build.rs @@ -8,7 +8,7 @@ fn main() { let out_dir = env::var_os("OUT_DIR").unwrap(); let dest_path = Path::new(&out_dir).join("version.rs"); fs::write( - &dest_path, + dest_path, " #[allow(dead_code)] #[allow(clippy::all)] diff --git a/lib/src/deploy.rs b/lib/src/deploy.rs index 020f48020..444ad8e09 100644 --- a/lib/src/deploy.rs +++ b/lib/src/deploy.rs @@ -395,7 +395,7 @@ pub(crate) fn fixup_etc_fstab(root: &Dir) -> Result<()> { // Returns Ok(true) if we made a change (and we wrote the modified line) // otherwise returns Ok(false) and the caller should write the original line. fn edit_fstab_line(line: &str, mut w: impl Write) -> Result { - if line.starts_with("#") { + if line.starts_with('#') { return Ok(false); } let parts = line.split_ascii_whitespace().collect::>(); diff --git a/lib/src/install.rs b/lib/src/install.rs index 14d2a8118..d8d553f8b 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -1245,11 +1245,8 @@ pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> { // At this point, all other threads should be gone. if let Some(state) = Arc::into_inner(state) { // If we had invoked `setenforce 0`, then let's re-enable it. - match state.selinux_state { - SELinuxFinalState::Enabled(Some(guard)) => { - guard.consume()?; - } - _ => {} + if let SELinuxFinalState::Enabled(Some(guard)) = state.selinux_state { + guard.consume()?; } } else { // This shouldn't happen...but we will make it not fatal right now diff --git a/lib/src/lsm.rs b/lib/src/lsm.rs index d53381a26..4d8b5428b 100644 --- a/lib/src/lsm.rs +++ b/lib/src/lsm.rs @@ -347,7 +347,7 @@ pub(crate) fn ensure_dir_labeled( let as_path = as_path .map(Cow::Borrowed) .unwrap_or_else(|| Utf8Path::new("/").join(destname).into()); - require_label(policy, &*as_path, libc::S_IFDIR | mode.as_raw_mode()) + require_label(policy, &as_path, libc::S_IFDIR | mode.as_raw_mode()) }) .transpose() .with_context(|| format!("Labeling {local_destname}"))?;