From db42ce18a26c4b457086602ae0a1d0ca95ca55cf Mon Sep 17 00:00:00 2001 From: diogo464 Date: Fri, 9 Jul 2021 10:14:23 -0400 Subject: Fixed clippy warnings. --- dotup/src/depot.rs | 8 +++----- dotup/src/utils.rs | 6 ++---- dotup_cli/src/commands/link.rs | 2 +- dotup_cli/src/main.rs | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/dotup/src/depot.rs b/dotup/src/depot.rs index 653c0d3..823dfa4 100644 --- a/dotup/src/depot.rs +++ b/dotup/src/depot.rs @@ -133,9 +133,7 @@ impl Link { } fn install_destination(&self, install_base: &Path) -> std::io::Result { - Ok(utils::weakly_canonical( - install_base.join(self.destination()), - )?) + utils::weakly_canonical(install_base.join(self.destination())) } } @@ -254,7 +252,7 @@ fn depot_archive(depot: &Depot) -> Archive { let mut links = Vec::new(); for link in depot_links(depot) { - let archive_link = link_to_archive_link(&link); + let archive_link = link_to_archive_link(link); links.push(archive_link); } @@ -266,7 +264,7 @@ fn depot_archive(depot: &Depot) -> Archive { fn depot_create_link(depot: &Depot, link_desc: LinkCreateParams) -> Result { // link_ensure_relative_path(&link_desc.origin)?; link_ensure_relative_path(&link_desc.destination)?; - debug_assert!(utils::is_canonical(&depot.base_path())?); + debug_assert!(utils::is_canonical(depot.base_path())?); let origin_joined = depot.base_path().join(&link_desc.origin); let origin_result = origin_joined.canonicalize(); diff --git a/dotup/src/utils.rs b/dotup/src/utils.rs index b961ec3..3a49e8f 100644 --- a/dotup/src/utils.rs +++ b/dotup/src/utils.rs @@ -1,13 +1,11 @@ use std::path::{Component, Path, PathBuf}; -use crate::internal_prelude::*; - pub fn is_file(path: impl AsRef) -> std::io::Result { let metadata = match std::fs::metadata(path) { Ok(metadata) => metadata, Err(e) => match e.kind() { std::io::ErrorKind::NotFound => return Ok(false), - _ => return Err(e.into()), + _ => return Err(e), }, }; Ok(metadata.is_file()) @@ -18,7 +16,7 @@ pub fn is_directory(path: impl AsRef) -> std::io::Result { Ok(metadata) => metadata, Err(e) => match e.kind() { std::io::ErrorKind::NotFound => return Ok(false), - _ => return Err(e.into()), + _ => return Err(e), }, }; Ok(metadata.is_dir()) diff --git a/dotup_cli/src/commands/link.rs b/dotup_cli/src/commands/link.rs index 518bd4a..ed7ee55 100644 --- a/dotup_cli/src/commands/link.rs +++ b/dotup_cli/src/commands/link.rs @@ -43,7 +43,7 @@ pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> { } else { let mut params = Vec::new(); for origin in origins { - link(&depot, &origin, &destination, &origin, &mut params)?; + link(&depot, origin, destination, origin, &mut params)?; } params }; diff --git a/dotup_cli/src/main.rs b/dotup_cli/src/main.rs index b4339c9..05fdcab 100644 --- a/dotup_cli/src/main.rs +++ b/dotup_cli/src/main.rs @@ -69,7 +69,7 @@ fn main() -> anyhow::Result<()> { 0 => "warn", 1 => "info", 2 => "debug", - 3 | _ => "trace", + _ => "trace", }; Logger::try_with_env_or_str(log_level)? -- cgit