aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2021-07-09 10:14:23 -0400
committerdiogo464 <[email protected]>2021-07-09 10:14:23 -0400
commitdb42ce18a26c4b457086602ae0a1d0ca95ca55cf (patch)
treebb376af6b31bc9d72b8638096ede8e6ced86487b
parent3c63bf31b0c4f105d155622c84baf91745f5b9c6 (diff)
Fixed clippy warnings.
-rw-r--r--dotup/src/depot.rs8
-rw-r--r--dotup/src/utils.rs6
-rw-r--r--dotup_cli/src/commands/link.rs2
-rw-r--r--dotup_cli/src/main.rs2
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 {
133 } 133 }
134 134
135 fn install_destination(&self, install_base: &Path) -> std::io::Result<PathBuf> { 135 fn install_destination(&self, install_base: &Path) -> std::io::Result<PathBuf> {
136 Ok(utils::weakly_canonical( 136 utils::weakly_canonical(install_base.join(self.destination()))
137 install_base.join(self.destination()),
138 )?)
139 } 137 }
140} 138}
141 139
@@ -254,7 +252,7 @@ fn depot_archive(depot: &Depot) -> Archive {
254 let mut links = Vec::new(); 252 let mut links = Vec::new();
255 253
256 for link in depot_links(depot) { 254 for link in depot_links(depot) {
257 let archive_link = link_to_archive_link(&link); 255 let archive_link = link_to_archive_link(link);
258 links.push(archive_link); 256 links.push(archive_link);
259 } 257 }
260 258
@@ -266,7 +264,7 @@ fn depot_archive(depot: &Depot) -> Archive {
266fn depot_create_link(depot: &Depot, link_desc: LinkCreateParams) -> Result<Link, LinkCreateError> { 264fn depot_create_link(depot: &Depot, link_desc: LinkCreateParams) -> Result<Link, LinkCreateError> {
267 // link_ensure_relative_path(&link_desc.origin)?; 265 // link_ensure_relative_path(&link_desc.origin)?;
268 link_ensure_relative_path(&link_desc.destination)?; 266 link_ensure_relative_path(&link_desc.destination)?;
269 debug_assert!(utils::is_canonical(&depot.base_path())?); 267 debug_assert!(utils::is_canonical(depot.base_path())?);
270 268
271 let origin_joined = depot.base_path().join(&link_desc.origin); 269 let origin_joined = depot.base_path().join(&link_desc.origin);
272 let origin_result = origin_joined.canonicalize(); 270 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 @@
1use std::path::{Component, Path, PathBuf}; 1use std::path::{Component, Path, PathBuf};
2 2
3use crate::internal_prelude::*;
4
5pub fn is_file(path: impl AsRef<Path>) -> std::io::Result<bool> { 3pub fn is_file(path: impl AsRef<Path>) -> std::io::Result<bool> {
6 let metadata = match std::fs::metadata(path) { 4 let metadata = match std::fs::metadata(path) {
7 Ok(metadata) => metadata, 5 Ok(metadata) => metadata,
8 Err(e) => match e.kind() { 6 Err(e) => match e.kind() {
9 std::io::ErrorKind::NotFound => return Ok(false), 7 std::io::ErrorKind::NotFound => return Ok(false),
10 _ => return Err(e.into()), 8 _ => return Err(e),
11 }, 9 },
12 }; 10 };
13 Ok(metadata.is_file()) 11 Ok(metadata.is_file())
@@ -18,7 +16,7 @@ pub fn is_directory(path: impl AsRef<Path>) -> std::io::Result<bool> {
18 Ok(metadata) => metadata, 16 Ok(metadata) => metadata,
19 Err(e) => match e.kind() { 17 Err(e) => match e.kind() {
20 std::io::ErrorKind::NotFound => return Ok(false), 18 std::io::ErrorKind::NotFound => return Ok(false),
21 _ => return Err(e.into()), 19 _ => return Err(e),
22 }, 20 },
23 }; 21 };
24 Ok(metadata.is_dir()) 22 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<()> {
43 } else { 43 } else {
44 let mut params = Vec::new(); 44 let mut params = Vec::new();
45 for origin in origins { 45 for origin in origins {
46 link(&depot, &origin, &destination, &origin, &mut params)?; 46 link(&depot, origin, destination, origin, &mut params)?;
47 } 47 }
48 params 48 params
49 }; 49 };
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<()> {
69 0 => "warn", 69 0 => "warn",
70 1 => "info", 70 1 => "info",
71 2 => "debug", 71 2 => "debug",
72 3 | _ => "trace", 72 _ => "trace",
73 }; 73 };
74 74
75 Logger::try_with_env_or_str(log_level)? 75 Logger::try_with_env_or_str(log_level)?