From 645416a04c536f793cee0a2884a6d5b5e319b1a2 Mon Sep 17 00:00:00 2001 From: MCorange Date: Mon, 15 Sep 2025 22:01:23 +0300 Subject: [PATCH] cleanup --- persmgr_derive/src/lib.rs | 2 +- src/api/files/create.rs | 7 +++---- src/api/files/delete.rs | 6 ++---- src/api/files/get_file.rs | 6 ++---- src/api/files/mkdir.rs | 6 ++---- src/api/files/rmdir.rs | 6 ++---- src/api/mod.rs | 2 +- src/api/user/login.rs | 7 +------ src/api/user/mod.rs | 5 +---- src/db/tables/assignables/missions.rs | 1 - src/db/tables/groups.rs | 2 +- src/db/tables/mod.rs | 2 +- src/db/tables/user.rs | 1 - 13 files changed, 17 insertions(+), 36 deletions(-) diff --git a/persmgr_derive/src/lib.rs b/persmgr_derive/src/lib.rs index 985c51f..01904f1 100644 --- a/persmgr_derive/src/lib.rs +++ b/persmgr_derive/src/lib.rs @@ -1,7 +1,7 @@ use darling::FromDeriveInput; use proc_macro::{self, TokenStream}; use quote::quote; -use syn::{Data, DeriveInput, Expr, Fields, Type, parse_macro_input}; +use syn::{Data, Expr, Fields, Type, parse_macro_input}; #[derive(FromDeriveInput, Default)] #[darling(default, attributes(meta))] diff --git a/src/api/files/create.rs b/src/api/files/create.rs index a975deb..4130416 100644 --- a/src/api/files/create.rs +++ b/src/api/files/create.rs @@ -1,7 +1,6 @@ use axum::{ - body::{Body, Bytes}, - extract::{Path, State}, - http::{HeaderMap, HeaderValue, StatusCode}, + extract::State, + http::StatusCode, response::{IntoResponse, Response}, }; use serde::Deserialize; @@ -14,7 +13,7 @@ pub struct Data { } #[axum::debug_handler] -pub async fn route(State(db): State) -> impl IntoResponse { +pub async fn route(State(_db): State) -> impl IntoResponse { if false { return Response::builder() .status(StatusCode::NOT_FOUND) diff --git a/src/api/files/delete.rs b/src/api/files/delete.rs index 06a56ee..47b41a9 100644 --- a/src/api/files/delete.rs +++ b/src/api/files/delete.rs @@ -1,7 +1,6 @@ use axum::{ - body::{Body, Bytes}, - extract::{Path, State}, - http::{HeaderMap, HeaderValue, StatusCode}, + extract::State, + http::StatusCode, response::{IntoResponse, Response}, }; use serde::Deserialize; @@ -27,4 +26,3 @@ pub async fn route(State(db): State) -> impl IntoResponse { .body(String::new()) .unwrap() } - diff --git a/src/api/files/get_file.rs b/src/api/files/get_file.rs index 06a56ee..47b41a9 100644 --- a/src/api/files/get_file.rs +++ b/src/api/files/get_file.rs @@ -1,7 +1,6 @@ use axum::{ - body::{Body, Bytes}, - extract::{Path, State}, - http::{HeaderMap, HeaderValue, StatusCode}, + extract::State, + http::StatusCode, response::{IntoResponse, Response}, }; use serde::Deserialize; @@ -27,4 +26,3 @@ pub async fn route(State(db): State) -> impl IntoResponse { .body(String::new()) .unwrap() } - diff --git a/src/api/files/mkdir.rs b/src/api/files/mkdir.rs index 06a56ee..47b41a9 100644 --- a/src/api/files/mkdir.rs +++ b/src/api/files/mkdir.rs @@ -1,7 +1,6 @@ use axum::{ - body::{Body, Bytes}, - extract::{Path, State}, - http::{HeaderMap, HeaderValue, StatusCode}, + extract::State, + http::StatusCode, response::{IntoResponse, Response}, }; use serde::Deserialize; @@ -27,4 +26,3 @@ pub async fn route(State(db): State) -> impl IntoResponse { .body(String::new()) .unwrap() } - diff --git a/src/api/files/rmdir.rs b/src/api/files/rmdir.rs index 06a56ee..47b41a9 100644 --- a/src/api/files/rmdir.rs +++ b/src/api/files/rmdir.rs @@ -1,7 +1,6 @@ use axum::{ - body::{Body, Bytes}, - extract::{Path, State}, - http::{HeaderMap, HeaderValue, StatusCode}, + extract::State, + http::StatusCode, response::{IntoResponse, Response}, }; use serde::Deserialize; @@ -27,4 +26,3 @@ pub async fn route(State(db): State) -> impl IntoResponse { .body(String::new()) .unwrap() } - diff --git a/src/api/mod.rs b/src/api/mod.rs index 670e713..a1bd288 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -4,7 +4,7 @@ use axum::{Router, extract::State, http::StatusCode, routing::get}; pub mod files; pub mod user; -async fn root(State(state): State) -> (StatusCode, &'static str) { +async fn root(State(_state): State) -> (StatusCode, &'static str) { (StatusCode::OK, "We Good twin :3c") } diff --git a/src/api/user/login.rs b/src/api/user/login.rs index 0efb2da..dfc1f36 100644 --- a/src/api/user/login.rs +++ b/src/api/user/login.rs @@ -1,9 +1,4 @@ -use axum::{ - body::Body, - extract::State, - http::{HeaderMap, HeaderValue, StatusCode}, - response::{IntoResponse, Response}, -}; +use axum::{body::Body, extract::State, http::StatusCode, response::Response}; use crate::db::Database; diff --git a/src/api/user/mod.rs b/src/api/user/mod.rs index 32dc97c..63f4a06 100644 --- a/src/api/user/mod.rs +++ b/src/api/user/mod.rs @@ -1,7 +1,4 @@ -use axum::{ - Router, - routing::{get, post}, -}; +use axum::{Router, routing::post}; use crate::db::Database; diff --git a/src/db/tables/assignables/missions.rs b/src/db/tables/assignables/missions.rs index 7583d3f..d17e84e 100644 --- a/src/db/tables/assignables/missions.rs +++ b/src/db/tables/assignables/missions.rs @@ -15,7 +15,6 @@ pub struct Mission { pub created_at: i64, pub modified_at: i64, } - impl Mission { pub async fn insert_new(&self, pool: &CurrPool) -> Result { let session = sqlx::query_as!( diff --git a/src/db/tables/groups.rs b/src/db/tables/groups.rs index 0224e80..465ec7f 100644 --- a/src/db/tables/groups.rs +++ b/src/db/tables/groups.rs @@ -4,7 +4,7 @@ use sqlx::prelude::FromRow; use crate::db::{ CurrPool, - tables::{ForeignKey, TableMeta, assignables::missions::Mission, user::User}, + tables::{ForeignKey, TableMeta, user::User}, }; #[derive(Debug, Default, Clone, FromRow, TableMeta)] diff --git a/src/db/tables/mod.rs b/src/db/tables/mod.rs index 939ded9..04cfe84 100644 --- a/src/db/tables/mod.rs +++ b/src/db/tables/mod.rs @@ -4,7 +4,7 @@ use std::{ ops::{Deref, DerefMut}, }; -use sqlx::{Decode, Encode, QueryBuilder, Type, postgres::PgRow}; +use sqlx::{Decode, QueryBuilder, Type, postgres::PgRow}; pub mod assignables; pub mod attendance; diff --git a/src/db/tables/user.rs b/src/db/tables/user.rs index 7ebaf69..f5cdf5d 100644 --- a/src/db/tables/user.rs +++ b/src/db/tables/user.rs @@ -1,4 +1,3 @@ -use anyhow::bail; use persmgr_derive::TableMeta; use sqlx::prelude::FromRow;