Fix clippy warnings

rust
Elnu 1 year ago
parent a282d06bc5
commit af9aa1b326

@ -6,7 +6,7 @@ mod tests;
use chrono::Utc; use chrono::Utc;
use derive_more::From; use derive_more::From;
use reqwest::StatusCode; use reqwest::StatusCode;
use rocket::http::{Cookie, CookieJar}; use rocket::http::{CookieJar, Cookie};
use serial::*; use serial::*;
use serde::Deserialize; use serde::Deserialize;
@ -42,7 +42,7 @@ impl User {
(response.status(), response.text().await) (response.status(), response.text().await)
}; };
if !status.is_success() { if !status.is_success() {
return Err(GetUserError::DiscordError { return Err(GetUserError::Discord {
status, status,
message: text.ok(), message: text.ok(),
}); });
@ -102,10 +102,10 @@ impl User {
#[derive(From, Debug)] #[derive(From, Debug)]
pub enum GetUserError { pub enum GetUserError {
ReqwestError(reqwest::Error), Reqwest(reqwest::Error),
DeserializeError(serde_json::Error), Deserialize(serde_json::Error),
#[allow(unused)] #[allow(unused)]
DiscordError { Discord {
status: StatusCode, status: StatusCode,
message: Option<String>, message: Option<String>,
}, },
@ -113,4 +113,4 @@ pub enum GetUserError {
fn parse_cookie_value<T: std::str::FromStr>(cookies: &CookieJar<'_>, name: &str) -> Option<T> { fn parse_cookie_value<T: std::str::FromStr>(cookies: &CookieJar<'_>, name: &str) -> Option<T> {
cookies.get_private(name)?.value().parse().ok() cookies.get_private(name)?.value().parse().ok()
} }
Loading…
Cancel
Save