Skip to content

Commit 6bea4ae

Browse files
committed
clippy
1 parent 36e65ed commit 6bea4ae

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/curl_compat.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
//! Curl compatibility utilities
12
use std::str::FromStr;
23

3-
///! Curl compatibility utilities
4-
54
pub struct Form {
65
pub boundary: String,
76
pub parts: Vec<FormPart>,
@@ -83,10 +82,10 @@ impl Form {
8382
// Convert to hex string manually to avoid external hex dependency
8483
let hex_string = random_bytes
8584
.iter()
86-
.map(|b| format!("{:02x}", b))
85+
.map(|b| format!("{b:02x}"))
8786
.collect::<String>();
8887

89-
format!("----formdata-oha-{}", hex_string)
88+
format!("----formdata-oha-{hex_string}")
9089
}
9190
}
9291

@@ -117,8 +116,8 @@ impl FromStr for FormPart {
117116
let data;
118117

119118
// Check if this is a file upload (@filename or <filename)
120-
if value_part.starts_with('@') {
121-
let file_path = &value_part[1..]; // Remove '@' prefix
119+
if let Some(file_path) = value_part.strip_prefix('@') {
120+
// Remove '@' prefix
122121

123122
// Read file content
124123
data = std::fs::read(file_path)
@@ -129,8 +128,8 @@ impl FromStr for FormPart {
129128
.file_name()
130129
.and_then(|name| name.to_str())
131130
.map(|s| s.to_string());
132-
} else if value_part.starts_with('<') {
133-
let file_path = &value_part[1..]; // Remove '<' prefix
131+
} else if let Some(file_path) = value_part.strip_prefix('<') {
132+
// Remove '<' prefix
134133

135134
// Read file content
136135
data = std::fs::read(file_path)

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ pub async fn run(mut opts: Opts) -> anyhow::Result<()> {
463463
for form_str in opts.form {
464464
let part: curl_compat::FormPart = form_str
465465
.parse()
466-
.with_context(|| format!("Failed to parse form data: {}", form_str))?;
466+
.with_context(|| format!("Failed to parse form data: {form_str}"))?;
467467
form.add_part(part);
468468
}
469469

0 commit comments

Comments
 (0)