mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
refactor: removes clippy warnings (#601)
This commit is contained in:
@@ -502,7 +502,7 @@ impl Server {
|
||||
};
|
||||
let stream = IncomingStream::new(req.into_body());
|
||||
|
||||
let body_with_io_error = stream.map_err(|err| io::Error::new(io::ErrorKind::Other, err));
|
||||
let body_with_io_error = stream.map_err(io::Error::other);
|
||||
let body_reader = StreamReader::new(body_with_io_error);
|
||||
|
||||
pin_mut!(body_reader);
|
||||
@@ -628,7 +628,7 @@ impl Server {
|
||||
) -> Result<()> {
|
||||
let (mut writer, reader) = tokio::io::duplex(BUF_SIZE);
|
||||
let filename = try_get_file_name(path)?;
|
||||
set_content_disposition(res, false, &format!("{}.zip", filename))?;
|
||||
set_content_disposition(res, false, &format!("{filename}.zip"))?;
|
||||
res.headers_mut()
|
||||
.insert("content-type", HeaderValue::from_static("application/zip"));
|
||||
if head_only {
|
||||
@@ -855,7 +855,7 @@ impl Server {
|
||||
file.seek(SeekFrom::Start(start)).await?;
|
||||
let range_size = end - start + 1;
|
||||
*res.status_mut() = StatusCode::PARTIAL_CONTENT;
|
||||
let content_range = format!("bytes {}-{}/{}", start, end, size);
|
||||
let content_range = format!("bytes {start}-{end}/{size}");
|
||||
res.headers_mut()
|
||||
.insert(CONTENT_RANGE, content_range.parse()?);
|
||||
res.headers_mut()
|
||||
@@ -879,7 +879,7 @@ impl Server {
|
||||
for (start, end) in ranges {
|
||||
file.seek(SeekFrom::Start(start)).await?;
|
||||
let range_size = end - start + 1;
|
||||
let content_range = format!("bytes {}-{}/{}", start, end, size);
|
||||
let content_range = format!("bytes {start}-{end}/{size}");
|
||||
let part_header = format!(
|
||||
"--{boundary}\r\nContent-Type: {content_type}\r\nContent-Range: {content_range}\r\n\r\n",
|
||||
);
|
||||
@@ -1704,7 +1704,7 @@ fn set_content_disposition(res: &mut Response, inline: bool, filename: &str) ->
|
||||
})
|
||||
.collect();
|
||||
let value = if filename.is_ascii() {
|
||||
HeaderValue::from_str(&format!("{kind}; filename=\"{}\"", filename,))?
|
||||
HeaderValue::from_str(&format!("{kind}; filename=\"{filename}\"",))?
|
||||
} else {
|
||||
HeaderValue::from_str(&format!(
|
||||
"{kind}; filename=\"{}\"; filename*=UTF-8''{}",
|
||||
@@ -1799,7 +1799,7 @@ async fn sha256_file(path: &Path) -> Result<String> {
|
||||
}
|
||||
|
||||
let result = hasher.finalize();
|
||||
Ok(format!("{:x}", result))
|
||||
Ok(format!("{result:x}"))
|
||||
}
|
||||
|
||||
fn has_query_flag(query_params: &HashMap<String, String>, name: &str) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user