From e4ef625255f2d4130c5387085f9d5555691f3afe Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 25 May 2021 17:09:39 -0700 Subject: cargo fmt --- fatcat-cli/src/commands.rs | 2 +- fatcat-cli/src/download.rs | 20 ++++++++++++-------- fatcat-cli/src/main.rs | 4 +++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/fatcat-cli/src/commands.rs b/fatcat-cli/src/commands.rs index 6f52614..8ef6bb0 100644 --- a/fatcat-cli/src/commands.rs +++ b/fatcat-cli/src/commands.rs @@ -292,7 +292,7 @@ pub fn print_search_table(results: SearchResults, entity_type: SearchEntityType) SearchEntityType::File => { writeln!(tw, "ident\tsha1\tsize_bytes\tmimetype")?; } - SearchEntityType::Scholar=> { + SearchEntityType::Scholar => { writeln!(tw, "key\ttype\tstage\tyear\tcontainer_name\ttitle")?; } } diff --git a/fatcat-cli/src/download.rs b/fatcat-cli/src/download.rs index d415e58..4cb3143 100644 --- a/fatcat-cli/src/download.rs +++ b/fatcat-cli/src/download.rs @@ -154,19 +154,23 @@ pub fn download_file( // TODO: remove clone (?) Some(url_list) => { // prefer an IA_hosted URL, but fallback to any URL - let public_url_list: Vec<&fatcat_openapi::models::FileUrl> = url_list.iter().filter(|v| { - if let Ok(url) = Url::parse(&v.url) { - url.host_str() == Some("web.archive.org") || url.host_str() == Some("archive.org") - } else { - false - } - }).collect(); + let public_url_list: Vec<&fatcat_openapi::models::FileUrl> = url_list + .iter() + .filter(|v| { + if let Ok(url) = Url::parse(&v.url) { + url.host_str() == Some("web.archive.org") + || url.host_str() == Some("archive.org") + } else { + false + } + }) + .collect(); if !public_url_list.is_empty() { public_url_list[0].url.clone() } else { url_list[0].url.clone() } - }, + } }; let mut url = Url::parse(&raw_url)?; diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs index 317a7c3..de62d9c 100644 --- a/fatcat-cli/src/main.rs +++ b/fatcat-cli/src/main.rs @@ -660,7 +660,9 @@ fn run(opt: Opt) -> Result<()> { writeln!(&mut std::io::stdout(), "{}", entity.to_json_string()?)? } (false, true, SearchEntityType::Scholar) => { - return Err(anyhow!("entity schema output not supported for scholar index")); + return Err(anyhow!( + "entity schema output not supported for scholar index" + )); } } } -- cgit v1.2.3