diff --git a/src/error.rs b/src/error.rs index adb01a8..b743ad9 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,6 @@ -use actix_web::{error, HttpRequest}; + use actix_web::error::{JsonPayloadError, PayloadError}; -use actix_web::web::JsonConfig; + use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] diff --git a/src/main.rs b/src/main.rs index 72086cd..c53bec7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ -use actix_web::{App, HttpResponse, HttpServer, web, get, post, Responder, HttpRequest}; +use actix_web::{App, HttpResponse, HttpServer, post}; use actix_web::web::{Data, Json, JsonConfig}; -use diesel::{Connection, PgConnection}; +use diesel::{PgConnection}; use diesel::r2d2::ConnectionManager; use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness}; use log::{error, info, Level}; @@ -48,8 +48,8 @@ async fn main() -> std::io::Result<()> { info!("Connecting to database..."); - let mut manager = ConnectionManager::new(&CONFIG.db_uri); - let mut pool: PgPool = match Pool::builder().build(manager) { + let manager = ConnectionManager::new(&CONFIG.db_uri); + let pool: PgPool = match Pool::builder().build(manager) { Ok(c) => c, Err(e) => { error!("Error connecting to database: {}", e); @@ -80,7 +80,7 @@ async fn main() -> std::io::Result<()> { HttpServer::new(move || { App::new() .app_data(data.clone()) - .app_data(JsonConfig::default().error_handler(|err, req| { + .app_data(JsonConfig::default().error_handler(|err, _req| { let err2: APIError = (&err).into(); actix_web::error::InternalError::from_response( err,