diff --git a/src/cache/compat.rs b/src/cache/compat.rs index 93d516f..4e939d3 100644 --- a/src/cache/compat.rs +++ b/src/cache/compat.rs @@ -9,14 +9,14 @@ use serde::{ use super::ImageContentType; #[derive(Copy, Clone, Serialize, Deserialize)] -pub(crate) struct LegacyImageMetadata { +pub struct LegacyImageMetadata { pub(crate) content_type: Option, pub(crate) size: Option, pub(crate) last_modified: Option, } #[derive(Copy, Clone, Serialize)] -pub(crate) struct LegacyDateTime(pub DateTime); +pub struct LegacyDateTime(pub DateTime); impl<'de> Deserialize<'de> for LegacyDateTime { fn deserialize(deserializer: D) -> Result @@ -47,7 +47,7 @@ impl<'de> Deserialize<'de> for LegacyDateTime { } #[derive(Copy, Clone)] -pub(crate) struct LegacyImageContentType(pub ImageContentType); +pub struct LegacyImageContentType(pub ImageContentType); impl Serialize for LegacyImageContentType { fn serialize(&self, serializer: S) -> Result diff --git a/src/cache/fs.rs b/src/cache/fs.rs index 4a40a83..5d62e3f 100644 --- a/src/cache/fs.rs +++ b/src/cache/fs.rs @@ -245,7 +245,7 @@ where error = writer.write_all(metadata_string.as_bytes()).await.err(); } if error.is_none() { - error = error.or(writer.write_all(&bytes).await.err()); + error = writer.write_all(&bytes).await.err(); } if let Some(e) = error { @@ -408,7 +408,7 @@ mod read_file { assert_eq!( metadata, ImageMetadata { - content_length: Some(708370), + content_length: Some(708_370), content_type: Some(ImageContentType::Png), last_modified: Some( DateTime::parse_from_rfc3339("2021-04-13T04:37:41+00:00").unwrap() @@ -447,7 +447,7 @@ mod read_file_compat { assert_eq!( metadata, ImageMetadata { - content_length: Some(117888), + content_length: Some(117_888), content_type: Some(ImageContentType::Jpeg), last_modified: Some( DateTime::parse_from_rfc2822("Sat, 10 Apr 2021 10:55:22 GMT").unwrap() diff --git a/src/cache/mod.rs b/src/cache/mod.rs index fdc4443..fbf075f 100644 --- a/src/cache/mod.rs +++ b/src/cache/mod.rs @@ -115,7 +115,7 @@ impl From for ImageMetadata { } } -#[allow(clippy::pub_enum_variant_names)] +#[allow(clippy::enum_variant_names)] #[derive(Debug)] pub enum ImageRequestError { InvalidContentType, diff --git a/src/config.rs b/src/config.rs index 313db08..c66557d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -339,6 +339,6 @@ mod sample_yaml { #[test] fn sample_yaml_parses() { - assert!(serde_yaml::from_str::(include_str!("../settings.sample.yaml")).is_ok()) + assert!(serde_yaml::from_str::(include_str!("../settings.sample.yaml")).is_ok()); } } diff --git a/src/main.rs b/src/main.rs index a455638..773c8a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,7 +130,7 @@ async fn main() -> Result<(), Box> { send_stop(&client_secret).await; } else { warn!("Got second Ctrl-C, forcefully exiting"); - system.stop() + system.stop(); } }); } diff --git a/src/ping.rs b/src/ping.rs index 96c4ae0..2366c5e 100644 --- a/src/ping.rs +++ b/src/ping.rs @@ -129,10 +129,10 @@ impl<'de> Deserialize<'de> for Tls { .ok() .and_then(|mut v| { v.pop().and_then(|key| RSASigningKey::new(&key).ok()) - }) + }); } "certificate" => { - certificates = certs(&mut BufReader::new(value.as_bytes())).ok() + certificates = certs(&mut BufReader::new(value.as_bytes())).ok(); } _ => (), // Ignore extra fields } @@ -251,7 +251,7 @@ pub async fn update_server_state( }, Err(e) => match e { e if e.is_timeout() => { - error!("Response timed out to control server. Is MangaDex down?") + error!("Response timed out to control server. Is MangaDex down?"); } e => warn!("Failed to send request: {}", e), }, diff --git a/src/routes.rs b/src/routes.rs index 52d07e1..f0113cb 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -47,6 +47,7 @@ impl Responder for ServerResponse { } } +#[allow(clippy::unused_async)] #[get("/")] async fn index() -> impl Responder { HttpResponse::Ok().body(include_str!("index.html")) @@ -122,7 +123,7 @@ pub async fn default(state: Data, req: HttpRequest) -> impl R ServerResponse::HttpResponse(resp_builder.body(resp.bytes().await.unwrap_or_default())) } -#[allow(clippy::future_not_send)] +#[allow(clippy::future_not_send, clippy::unused_async)] #[get("/metrics")] pub async fn metrics() -> impl Responder { let metric_families = prometheus::gather();