misc clippy fixes

the trivial ones ;)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-02-08 14:57:16 +01:00
parent 645b2ae89b
commit bb7018e183
5 changed files with 6 additions and 6 deletions

View File

@ -80,7 +80,7 @@ lazy_static! {
#[api]
/// Lists all current items
fn list_items() -> Result<Vec<String>, Error> {
Ok(ITEM_MAP.lock().unwrap().keys().map(|k| k.clone()).collect())
Ok(ITEM_MAP.lock().unwrap().keys().cloned().collect())
}
#[api(

View File

@ -206,7 +206,7 @@ impl ApiConfig {
let logger_options = FileLogOptions {
append: true,
file_opts: file_opts.unwrap_or(CreateOptions::default()),
file_opts: file_opts.unwrap_or_default(),
..Default::default()
};
let request_log = Arc::new(Mutex::new(FileLogger::new(&path, logger_options)?));
@ -246,7 +246,7 @@ impl ApiConfig {
let logger_options = FileLogOptions {
append: true,
prefix_time: true,
file_opts: file_opts.unwrap_or(CreateOptions::default()),
file_opts: file_opts.unwrap_or_default(),
..Default::default()
};
let auth_log = Arc::new(Mutex::new(FileLogger::new(&path, logger_options)?));

View File

@ -205,7 +205,7 @@ pub fn extract_cookie(cookie: &str, cookie_name: &str) -> Option<String> {
/// We assume cookie_name is already url encoded.
pub fn cookie_from_header(headers: &http::HeaderMap, cookie_name: &str) -> Option<String> {
if let Some(Ok(cookie)) = headers.get("COOKIE").map(|v| v.to_str()) {
extract_cookie(&cookie, cookie_name)
extract_cookie(cookie, cookie_name)
} else {
None
}

View File

@ -377,7 +377,7 @@ async fn get_request_parameters<S: 'static + BuildHasher + Send>(
}
}
param_schema.verify_json(&params)?;
return Ok(params);
Ok(params)
} else {
parse_query_parameters(param_schema, utf8_data, &parts, &uri_param)
}

View File

@ -901,7 +901,7 @@ impl WorkerTask {
pub fn request_abort(&self) {
let prev_abort = self.abort_requested.swap(true, Ordering::SeqCst);
if !prev_abort { // log abort one time
self.log_message(format!("received abort request ..."));
self.log_message("received abort request ...".to_string());
}
// noitify listeners
let mut data = self.data.lock().unwrap();