Clippy
This commit is contained in:
parent
f6a9caf653
commit
81604a7e94
4 changed files with 22 additions and 18 deletions
13
src/cache/fs.rs
vendored
13
src/cache/fs.rs
vendored
|
@ -121,13 +121,16 @@ pub(super) async fn read_file(
|
|||
// parsed_metadata is either set or unset here. If it's set then we
|
||||
// successfully decoded the data; otherwise the file is garbage.
|
||||
|
||||
if let Some(reader) = reader {
|
||||
let stream = CacheStream::Completed(ReaderStream::new(reader));
|
||||
parsed_metadata.map(|metadata| Ok((stream, maybe_header, metadata)))
|
||||
} else {
|
||||
reader.map_or_else(
|
||||
|| {
|
||||
debug!("Reader was invalid, file is corrupt");
|
||||
None
|
||||
}
|
||||
},
|
||||
|reader| {
|
||||
let stream = CacheStream::Completed(ReaderStream::new(reader));
|
||||
parsed_metadata.map(|metadata| Ok((stream, maybe_header, metadata)))
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
struct EncryptedReader<R> {
|
||||
|
|
|
@ -73,7 +73,7 @@ impl<'a> From<(&'a ClientSecret, &Config)> for Request<'a> {
|
|||
#[derive(Deserialize, Debug)]
|
||||
#[serde(untagged)]
|
||||
pub enum Response {
|
||||
Ok(OkResponse),
|
||||
Ok(Box<OkResponse>),
|
||||
Error(ErrorResponse),
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ use std::sync::atomic::Ordering;
|
|||
|
||||
use actix_web::body::BoxBody;
|
||||
use actix_web::error::ErrorNotFound;
|
||||
use actix_web::http::header::{CONTENT_LENGTH, CONTENT_TYPE, LAST_MODIFIED, HeaderValue};
|
||||
use actix_web::web::Path;
|
||||
use actix_web::http::header::{HeaderValue, CONTENT_LENGTH, CONTENT_TYPE, LAST_MODIFIED};
|
||||
use actix_web::web::{Data, Path};
|
||||
use actix_web::HttpResponseBuilder;
|
||||
use actix_web::{get, web::Data, HttpRequest, HttpResponse, Responder};
|
||||
use actix_web::{get, HttpRequest, HttpResponse, Responder};
|
||||
use base64::DecodeError;
|
||||
use bytes::Bytes;
|
||||
use chrono::{DateTime, Utc};
|
||||
|
|
11
src/state.rs
11
src/state.rs
|
@ -64,15 +64,16 @@ impl ServerState {
|
|||
.token_key
|
||||
.ok_or(ServerInitError::MissingTokenKey)
|
||||
.and_then(|key| {
|
||||
if let Some(key) = base64::decode(&key)
|
||||
base64::decode(&key)
|
||||
.ok()
|
||||
.and_then(|k| PrecomputedKey::from_slice(&k))
|
||||
{
|
||||
Ok(key)
|
||||
} else {
|
||||
.map_or_else(
|
||||
|| {
|
||||
error!("Failed to parse token key: got {}", key);
|
||||
Err(ServerInitError::KeyParseError(key))
|
||||
}
|
||||
},
|
||||
Ok,
|
||||
)
|
||||
})?;
|
||||
|
||||
PREVIOUSLY_COMPROMISED.store(resp.compromised, Ordering::Release);
|
||||
|
|
Loading…
Reference in a new issue