Skip to content

Commit 4ff654c

Browse files
committed
Revert "Fix clippy formatting issues"
This reverts commit 0c38130.
1 parent 0c38130 commit 4ff654c

39 files changed

+98
-85
lines changed

src/cli/auth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl Matcher for AuthSubCommand {
5757

5858
match response {
5959
Ok(_) => println!("Profile set successfully"),
60-
Err(e) => println!("Failed to set profile: {e}"),
60+
Err(e) => println!("Failed to set profile: {}", e),
6161
}
6262
}
6363
}
@@ -170,7 +170,7 @@ impl AuthProfile {
170170
/// # Implementation Details
171171
/// Uses "--" as a delimiter between URL and token since URLs cannot contain "--"
172172
fn combine_url_and_token(url: &str, token: &str) -> String {
173-
format!("{url}--{token}")
173+
format!("{}--{}", url, token)
174174
}
175175

176176
/// Splits a combined URL and token string back into separate components.

src/cli/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn evaluate_and_print_response<T: Serialize>(response: Result<Response<T>, S
3131
response.print_result();
3232
}
3333
Err(e) => {
34-
println!("Error: {e}");
34+
println!("Error: {}", e);
3535
}
3636
}
3737
}
@@ -56,10 +56,10 @@ where
5656
{
5757
let value = matches
5858
.get_one::<U>(arg_name)
59-
.unwrap_or_else(|| panic!("{arg_name} is required."))
59+
.unwrap_or_else(|| panic!("{} is required.", arg_name))
6060
.as_ref()
6161
.parse::<T>()
62-
.unwrap_or_else(|_| panic!("{arg_name} is invalid."));
62+
.unwrap_or_else(|_| panic!("{} is invalid.", arg_name));
6363

6464
value
6565
}

src/cli/dataset.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::fs::File;
1212
use std::io::Write;
1313
use std::path::{Path, PathBuf};
1414

15+
use chrono::ParseResult;
1516
use colored_json::Paint;
1617
use structopt::StructOpt;
1718
use tokio::runtime::Runtime;
@@ -385,7 +386,7 @@ impl Matcher for DatasetSubCommand {
385386

386387
let response = runtime.block_on(
387388
direct_upload::batch_direct_upload()
388-
.client(client)
389+
.client(&client)
389390
.id(id)
390391
.files(paths)
391392
.bodies(bodies)
@@ -430,7 +431,7 @@ impl Matcher for DatasetSubCommand {
430431
};
431432

432433
if let Err(e) = response {
433-
eprintln!("Error: {e}");
434+
eprintln!("Error: {}", e);
434435
}
435436
}
436437
DatasetSubCommand::Export {
@@ -450,7 +451,7 @@ impl Matcher for DatasetSubCommand {
450451
}
451452
},
452453
Err(e) => {
453-
eprintln!("Error: {e}");
454+
eprintln!("Error: {}", e);
454455
return;
455456
}
456457
};
@@ -718,7 +719,7 @@ impl DatasetSubCommand {
718719
.map(String::from)
719720
.unwrap_or_default();
720721

721-
let mime = infer_mime(path).map_err(|e| format!("Failed to infer mime type. Direct upload only supports files with known mime types. Error: {e}"))?;
722+
let mime = infer_mime(path).map_err(|e| format!("Failed to infer mime type. Direct upload only supports files with known mime types. Error: {}", e))?;
722723

723724
Ok(DirectUploadBody {
724725
file_name: Some(filename),

src/cli/file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl Matcher for FileSubCommand {
8686
evaluate_and_print_response(response);
8787
}
8888
FileSubCommand::Meta { id } => {
89-
println!("Getting file metadata for {id:?}");
89+
println!("Getting file metadata for {:?}", id);
9090
let response = runtime.block_on(metadata::get_file_meta(client, &id));
9191
evaluate_and_print_response(response);
9292
}
@@ -108,7 +108,7 @@ impl Matcher for FileSubCommand {
108108
Status::OK,
109109
),
110110
Err(e) => Response::from_message(
111-
Message::PlainMessage(format!("Error downloading file: {e}")),
111+
Message::PlainMessage(format!("Error downloading file: {}", e)),
112112
Status::ERROR,
113113
),
114114
};

src/cli/info.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ impl Matcher for InfoSubCommand {
6464
for (key, exporter) in exporters.iter() {
6565
println!(" - {}: {}", key.bold().blue(), exporter.display_name);
6666
}
67-
let instructions = EXPORTERS_INSTRUCTIONS.to_string();
68-
println!("{instructions}");
67+
println!("{}", EXPORTERS_INSTRUCTIONS.to_string());
6968
} else {
7069
eprintln!("Error: {}", response.message.unwrap());
7170
}
7271
}
73-
Err(e) => eprintln!("Error: {e:?}"),
72+
Err(e) => eprintln!("Error: {:?}", e),
7473
}
7574
}
7675
};

src/data_access/datafile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ async fn get_full_dv_path(client: &BaseClient, id: &Identifier) -> Result<String
264264
let directory_label = metadata.directory_label;
265265

266266
Ok(if let Some(directory_label) = directory_label {
267-
format!("{directory_label}/{label}")
267+
format!("{}/{}", directory_label, label)
268268
} else {
269269
label
270270
})
@@ -313,7 +313,7 @@ pub(crate) fn construct_range_header(
313313
Ok(match downloaded_bytes {
314314
Some(remaining_bytes) => HeaderMap::from_iter([(
315315
RANGE,
316-
HeaderValue::from_str(format!("bytes={remaining_bytes}-").as_str())
316+
HeaderValue::from_str(format!("bytes={}-", remaining_bytes).as_str())
317317
.map_err(|e| e.to_string())?,
318318
)])
319319
.into(),

src/data_access/dataset.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ pub async fn download_dataset_files(
7575
.await
7676
.map_err(|e| {
7777
format!(
78-
"Failed to fetch file bundle from dataset: {e} ({version})"
78+
"Failed to fetch file bundle from dataset: {} ({})",
79+
e, version
7980
)
8081
})?;
8182

@@ -133,7 +134,7 @@ async fn prepare_download(
133134
let version = determine_version(version, client.has_api_token());
134135
let bundle_size = get_dataset_size(client, id, &Some(version.clone()))
135136
.await
136-
.map_err(|e| format!("Failed to fetch dataset size: {e}"))?
137+
.map_err(|e| format!("Failed to fetch dataset size: {}", e))?
137138
.data
138139
.ok_or("Bundle size response has no data".to_string())?
139140
.storage_size

src/datasetversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl Display for DatasetVersion {
5656
DatasetVersion::Latest => write!(f, ":latest"),
5757
DatasetVersion::Draft => write!(f, ":draft"),
5858
DatasetVersion::LatestPublished => write!(f, ":latest-published"),
59-
DatasetVersion::Version(v) => write!(f, "{v}"),
59+
DatasetVersion::Version(v) => write!(f, "{}", v),
6060
}
6161
}
6262
}

src/direct_upload/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(crate) async fn create_database(
3131
// Create the database
3232
match Sqlite::create_database(&db_path).await {
3333
Ok(_) => println!("Create db success"),
34-
Err(error) => panic!("error: {error}"),
34+
Err(error) => panic!("error: {}", error),
3535
}
3636
}
3737

src/direct_upload/hasher.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -675,24 +675,24 @@ mod tests {
675675
"MD5" => {
676676
let expected_hash = format!("{:x}", md5::compute(content));
677677
let hash = hasher.compute().unwrap();
678-
assert_eq!(hash, expected_hash, "Hash for {algorithm} is incorrect");
678+
assert_eq!(hash, expected_hash, "Hash for {} is incorrect", algorithm);
679679
}
680680
"SHA-256" => {
681681
let expected_hash = format!("{:x}", sha2::Sha256::digest(content));
682682
let hash = hasher.compute().unwrap();
683-
assert_eq!(hash, expected_hash, "Hash for {algorithm} is incorrect");
683+
assert_eq!(hash, expected_hash, "Hash for {} is incorrect", algorithm);
684684
}
685685
"SHA-512" => {
686686
let expected_hash = format!("{:x}", sha2::Sha512::digest(content));
687687
let hash = hasher.compute().unwrap();
688-
assert_eq!(hash, expected_hash, "Hash for {algorithm} is incorrect");
688+
assert_eq!(hash, expected_hash, "Hash for {} is incorrect", algorithm);
689689
}
690690
"SHA-1" => {
691691
let expected_hash = format!("{:x}", sha1::Sha1::digest(content));
692692
let hash = hasher.compute().unwrap();
693-
assert_eq!(hash, expected_hash, "Hash for {algorithm} is incorrect");
693+
assert_eq!(hash, expected_hash, "Hash for {} is incorrect", algorithm);
694694
}
695-
_ => panic!("Unsupported algorithm: {algorithm}"),
695+
_ => panic!("Unsupported algorithm: {}", algorithm),
696696
}
697697
}
698698
}

0 commit comments

Comments
 (0)