cargo clippy and fmt

This commit is contained in:
xenofem 2022-04-28 05:18:35 -04:00
parent 127d7e9c67
commit bda6da33e8
6 changed files with 129 additions and 68 deletions

View file

@ -4,8 +4,8 @@ use actix_web::{
body::{self, BoxBody, SizedStream},
http::{
header::{
self, ContentDisposition, DispositionParam,
DispositionType, HeaderValue, HttpDate, EntityTag, IfUnmodifiedSince, IfMatch, IfNoneMatch, IfModifiedSince,
self, ContentDisposition, DispositionParam, DispositionType, EntityTag, HeaderValue,
HttpDate, IfMatch, IfModifiedSince, IfNoneMatch, IfUnmodifiedSince,
},
StatusCode,
},
@ -52,7 +52,7 @@ impl DownloadingFile {
ContentDisposition {
disposition: DispositionType::Attachment,
parameters: vec![DispositionParam::Filename(self.info.name)],
}
},
));
res.insert_header((header::LAST_MODIFIED, last_modified));
res.insert_header((header::ETAG, etag));
@ -76,7 +76,12 @@ impl DownloadingFile {
res.insert_header((
header::CONTENT_RANGE,
format!("bytes {}-{}/{}", offset, offset + length - 1, self.info.size),
format!(
"bytes {}-{}/{}",
offset,
offset + length - 1,
self.info.size
),
));
} else {
res.insert_header((header::CONTENT_RANGE, format!("bytes */{}", length)));
@ -122,7 +127,9 @@ fn precondition_failed(req: &HttpRequest, etag: &EntityTag, last_modified: &Http
fn not_modified(req: &HttpRequest, etag: &EntityTag, last_modified: &HttpDate) -> bool {
match req.get_header::<IfNoneMatch>() {
Some(IfNoneMatch::Any) => { return true; }
Some(IfNoneMatch::Any) => {
return true;
}
Some(IfNoneMatch::Items(ref items)) => {
return items.iter().any(|item| item.weak_eq(etag));
}