rest-server: clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-07-27 14:52:06 +02:00
parent 2e929cc386
commit 00f16b4e94
2 changed files with 11 additions and 8 deletions

View File

@ -73,6 +73,15 @@ impl From<Error> for AuthError {
}
}
/// Result of [`ServerAdapter::check_auth`].
pub type ServerAdapterCheckAuth<'a> = Pin<
Box<
dyn Future<Output = Result<(String, Box<dyn UserInformation + Sync + Send>), AuthError>>
+ Send
+ 'a,
>,
>;
/// User Authentication and index/root page generation methods
pub trait ServerAdapter: Send + Sync {
/// Returns the index/root page
@ -90,13 +99,7 @@ pub trait ServerAdapter: Send + Sync {
&'a self,
headers: &'a HeaderMap,
method: &'a Method,
) -> Pin<
Box<
dyn Future<Output = Result<(String, Box<dyn UserInformation + Sync + Send>), AuthError>>
+ Send
+ 'a,
>,
>;
) -> ServerAdapterCheckAuth<'a>;
}
lazy_static::lazy_static! {

View File

@ -362,7 +362,7 @@ async fn get_request_parameters<S: 'static + BuildHasher + Send>(
.try_fold(Vec::new(), |mut acc, chunk| async move {
// FIXME: max request body size?
if acc.len() + chunk.len() < 64 * 1024 {
acc.extend_from_slice(&*chunk);
acc.extend_from_slice(&chunk);
Ok(acc)
} else {
Err(http_err!(BAD_REQUEST, "Request body too large"))