refactor: cargo clippy
This commit is contained in:
parent
771cf72889
commit
c21762ac7e
5 changed files with 6 additions and 6 deletions
|
@ -44,7 +44,7 @@ pub async fn check_access_token(
|
|||
) -> Result<Uuid, HttpResponse> {
|
||||
let row =
|
||||
sqlx::query_as("SELECT CAST(uuid as VARCHAR), created_at FROM access_tokens WHERE token = $1")
|
||||
.bind(&access_token)
|
||||
.bind(access_token)
|
||||
.fetch_one(pool)
|
||||
.await;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use super::Response;
|
|||
pub async fn res(req: HttpRequest, data: web::Data<Data>) -> Result<HttpResponse, Error> {
|
||||
let recv_refresh_token_cookie = req.cookie("refresh_token");
|
||||
|
||||
if let None = recv_refresh_token_cookie {
|
||||
if recv_refresh_token_cookie.is_none() {
|
||||
return Ok(HttpResponse::Unauthorized().finish())
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ pub async fn create(req: HttpRequest, path: web::Path<(Uuid,)>, invite_request:
|
|||
|
||||
let guild = guild_result.unwrap();
|
||||
|
||||
let custom_id = invite_request.as_ref().and_then(|ir| Some(ir.custom_id.clone()));
|
||||
let custom_id = invite_request.as_ref().map(|ir| ir.custom_id.clone());
|
||||
|
||||
let invite = guild.create_invite(&data.pool, &member, custom_id).await;
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ impl Channel {
|
|||
|
||||
let channels: Result<Vec<Channel>, HttpResponse> = channels.into_iter().collect();
|
||||
|
||||
Ok(channels?)
|
||||
channels
|
||||
}
|
||||
|
||||
pub async fn fetch_one(pool: &Pool<Postgres>, guild_uuid: Uuid, channel_uuid: Uuid) -> Result<Self, HttpResponse> {
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::Data;
|
|||
pub fn get_auth_header(headers: &HeaderMap) -> Result<&str, HttpResponse> {
|
||||
let auth_token = headers.get(actix_web::http::header::AUTHORIZATION);
|
||||
|
||||
if let None = auth_token {
|
||||
if auth_token.is_none() {
|
||||
return Err(HttpResponse::Unauthorized().finish());
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ pub fn get_auth_header(headers: &HeaderMap) -> Result<&str, HttpResponse> {
|
|||
|
||||
let auth_value = auth.unwrap().split_whitespace().nth(1);
|
||||
|
||||
if let None = auth_value {
|
||||
if auth_value.is_none() {
|
||||
return Err(HttpResponse::BadRequest().finish());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue