nightly clippy lints
This commit is contained in:
parent
5f4be9809a
commit
7546948196
7 changed files with 14 additions and 13 deletions
6
src/cache/compat.rs
vendored
6
src/cache/compat.rs
vendored
|
@ -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<LegacyImageContentType>,
|
||||
pub(crate) size: Option<u32>,
|
||||
pub(crate) last_modified: Option<LegacyDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Serialize)]
|
||||
pub(crate) struct LegacyDateTime(pub DateTime<FixedOffset>);
|
||||
pub struct LegacyDateTime(pub DateTime<FixedOffset>);
|
||||
|
||||
impl<'de> Deserialize<'de> for LegacyDateTime {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
|
@ -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<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
|
|
6
src/cache/fs.rs
vendored
6
src/cache/fs.rs
vendored
|
@ -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()
|
||||
|
|
2
src/cache/mod.rs
vendored
2
src/cache/mod.rs
vendored
|
@ -115,7 +115,7 @@ impl From<LegacyImageMetadata> for ImageMetadata {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::pub_enum_variant_names)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[derive(Debug)]
|
||||
pub enum ImageRequestError {
|
||||
InvalidContentType,
|
||||
|
|
|
@ -339,6 +339,6 @@ mod sample_yaml {
|
|||
|
||||
#[test]
|
||||
fn sample_yaml_parses() {
|
||||
assert!(serde_yaml::from_str::<YamlArgs>(include_str!("../settings.sample.yaml")).is_ok())
|
||||
assert!(serde_yaml::from_str::<YamlArgs>(include_str!("../settings.sample.yaml")).is_ok());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
send_stop(&client_secret).await;
|
||||
} else {
|
||||
warn!("Got second Ctrl-C, forcefully exiting");
|
||||
system.stop()
|
||||
system.stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
},
|
||||
|
|
|
@ -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<RwLockServerState>, 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();
|
||||
|
|
Loading…
Reference in a new issue