summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-05-25 17:22:48 -0700
committerBryan Newbold <bnewbold@archive.org>2021-05-25 17:22:48 -0700
commit0d4541cc65ea6343ce0498f3c1a40dcb24b00024 (patch)
tree0a4547d7f5119bc30ba0ed7952055cfb2e65af74
parent6c35836bd44e38cb78b110c7c0da507859e4c7ed (diff)
downloadfatcat-cli-0d4541cc65ea6343ce0498f3c1a40dcb24b00024.tar.gz
fatcat-cli-0d4541cc65ea6343ce0498f3c1a40dcb24b00024.zip
cargo clippy clean
-rw-r--r--fatcat-cli/src/download.rs8
-rw-r--r--fatcat-cli/src/main.rs6
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<Url> {
Ok(url)
}
-fn default_filename(specifier: &Specifier, fe: &FileEntity) -> Result<PathBuf> {
+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<PathBuf> {
};
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<String>,
+ #[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(),
"{}",