From 0d4541cc65ea6343ce0498f3c1a40dcb24b00024 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 25 May 2021 17:22:48 -0700 Subject: cargo clippy clean --- fatcat-cli/src/download.rs | 8 ++++---- fatcat-cli/src/main.rs | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fatcat-cli/src/download.rs b/fatcat-cli/src/download.rs index 44a11b7..d8a6f8c 100644 --- a/fatcat-cli/src/download.rs +++ b/fatcat-cli/src/download.rs @@ -102,7 +102,7 @@ fn rewrite_wayback_url(mut url: Url) -> Result { Ok(url) } -fn default_filename(specifier: &Specifier, fe: &FileEntity) -> Result { +fn default_filename(specifier: &Specifier, fe: &FileEntity) -> PathBuf { let file_suffix = match fe.mimetype.as_deref() { Some("application/pdf") => ".pdf", Some("application/postscript") => ".ps", @@ -115,7 +115,7 @@ fn default_filename(specifier: &Specifier, fe: &FileEntity) -> Result { }; let path_string = format!("{}{}", specifier, file_suffix); - Ok(PathBuf::from(&path_string)) + PathBuf::from(&path_string) } /// Attempts to download a file entity, including verifying checksum. @@ -137,11 +137,11 @@ pub fn download_file( let final_path = match output_path { Some(ref path) if path.is_dir() => { let mut full = output_path.unwrap_or_default(); - full.push(default_filename(specifier, fe)?); + full.push(default_filename(specifier, fe)); full } Some(path) => path, - None => default_filename(specifier, fe)?, + None => default_filename(specifier, fe), }; // NOTE: this isn't perfect; there could have been a race condition diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs index 49f73fe..bdab729 100644 --- a/fatcat-cli/src/main.rs +++ b/fatcat-cli/src/main.rs @@ -155,6 +155,7 @@ enum Command { #[structopt(long = "--hide")] hide: Option, + #[allow(dead_code)] #[structopt(long)] json: bool, @@ -379,13 +380,14 @@ fn run(opt: Opt) -> Result<()> { specifier, expand, hide, - json, + json: _, toml, } => { let result = specifier.get_from_api(&mut api_client, expand, hide)?; if toml { writeln!(&mut std::io::stdout(), "{}", result.to_toml_string()?)? - } else if json || true { + } else { + // "if json" writeln!( &mut std::io::stdout(), "{}", -- cgit v1.2.3