From 7277e4ede463ea606cabce1f5e7ddc02a40fb54c Mon Sep 17 00:00:00 2001 From: Cameron Garnham Date: Wed, 26 Apr 2023 18:53:34 +0200 Subject: [PATCH] dev: fix clippy warnings for: src/routes/mod.rs --- src/app.rs | 2 +- src/routes/about.rs | 2 +- src/routes/category.rs | 2 +- src/routes/mod.rs | 16 ++++++++-------- src/routes/proxy.rs | 2 +- src/routes/root.rs | 2 +- src/routes/settings.rs | 2 +- src/routes/torrent.rs | 2 +- src/routes/user.rs | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/app.rs b/src/app.rs index aabd6138..3bc00b58 100644 --- a/src/app.rs +++ b/src/app.rs @@ -91,7 +91,7 @@ pub async fn run(configuration: Configuration) -> Running { .wrap(Cors::permissive()) .app_data(web::Data::new(app_data.clone())) .wrap(middleware::Logger::default()) - .configure(routes::init_routes) + .configure(routes::init) }) .bind((ip, net_port)) .expect("can't bind server to socket address"); diff --git a/src/routes/about.rs b/src/routes/about.rs index 5fc1ade7..c5b81d2d 100644 --- a/src/routes/about.rs +++ b/src/routes/about.rs @@ -3,7 +3,7 @@ use actix_web::{web, HttpResponse, Responder}; use crate::errors::ServiceResult; -pub fn init_routes(cfg: &mut web::ServiceConfig) { +pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( web::scope("/about") .service(web::resource("").route(web::get().to(get))) diff --git a/src/routes/category.rs b/src/routes/category.rs index 855dfb38..865d233d 100644 --- a/src/routes/category.rs +++ b/src/routes/category.rs @@ -5,7 +5,7 @@ use crate::common::WebAppData; use crate::errors::{ServiceError, ServiceResult}; use crate::models::response::OkResponse; -pub fn init_routes(cfg: &mut web::ServiceConfig) { +pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( web::scope("/category").service( web::resource("") diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 946e776f..ce833698 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -8,12 +8,12 @@ pub mod settings; pub mod torrent; pub mod user; -pub fn init_routes(cfg: &mut web::ServiceConfig) { - user::init_routes(cfg); - torrent::init_routes(cfg); - category::init_routes(cfg); - settings::init_routes(cfg); - about::init_routes(cfg); - proxy::init_routes(cfg); - root::init_routes(cfg); +pub fn init(cfg: &mut web::ServiceConfig) { + user::init(cfg); + torrent::init(cfg); + category::init(cfg); + settings::init(cfg); + about::init(cfg); + proxy::init(cfg); + root::init(cfg); } diff --git a/src/routes/proxy.rs b/src/routes/proxy.rs index 443900df..0863a08c 100644 --- a/src/routes/proxy.rs +++ b/src/routes/proxy.rs @@ -26,7 +26,7 @@ const ERROR_IMAGE_TOO_BIG_TEXT: &str = "Image is too big."; const ERROR_IMAGE_USER_QUOTA_MET_TEXT: &str = "Image proxy quota met."; const ERROR_IMAGE_UNAUTHENTICATED_TEXT: &str = "Sign in to see image."; -pub fn init_routes(cfg: &mut web::ServiceConfig) { +pub fn init(cfg: &mut web::ServiceConfig) { cfg.service(web::scope("/proxy").service(web::resource("/image/{url}").route(web::get().to(get_proxy_image)))); load_error_images(); diff --git a/src/routes/root.rs b/src/routes/root.rs index a11526dd..ffeb1ed4 100644 --- a/src/routes/root.rs +++ b/src/routes/root.rs @@ -2,6 +2,6 @@ use actix_web::web; use crate::routes::about; -pub fn init_routes(cfg: &mut web::ServiceConfig) { +pub fn init(cfg: &mut web::ServiceConfig) { cfg.service(web::scope("/").service(web::resource("").route(web::get().to(about::get)))); } diff --git a/src/routes/settings.rs b/src/routes/settings.rs index 65dd0716..9c19e503 100644 --- a/src/routes/settings.rs +++ b/src/routes/settings.rs @@ -5,7 +5,7 @@ use crate::config; use crate::errors::{ServiceError, ServiceResult}; use crate::models::response::OkResponse; -pub fn init_routes(cfg: &mut web::ServiceConfig) { +pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( web::scope("/settings") .service( diff --git a/src/routes/torrent.rs b/src/routes/torrent.rs index ffba1724..32ad44df 100644 --- a/src/routes/torrent.rs +++ b/src/routes/torrent.rs @@ -17,7 +17,7 @@ use crate::models::torrent::TorrentRequest; use crate::utils::parse_torrent; use crate::AsCSV; -pub fn init_routes(cfg: &mut web::ServiceConfig) { +pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( web::scope("/torrent") .service(web::resource("/upload").route(web::post().to(upload_torrent))) diff --git a/src/routes/user.rs b/src/routes/user.rs index 7917e778..7b195030 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -16,7 +16,7 @@ use crate::models::user::UserAuthentication; use crate::utils::clock::current_time; use crate::utils::regex::validate_email_address; -pub fn init_routes(cfg: &mut web::ServiceConfig) { +pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( web::scope("/user") .service(web::resource("/register").route(web::post().to(register)))