cargo-fix
This commit is contained in:
parent
284703134d
commit
109afa50ab
|
@ -1,6 +1,6 @@
|
||||||
use actix_web::{error, HttpRequest};
|
|
||||||
use actix_web::error::{JsonPayloadError, PayloadError};
|
use actix_web::error::{JsonPayloadError, PayloadError};
|
||||||
use actix_web::web::JsonConfig;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
|
10
src/main.rs
10
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 actix_web::web::{Data, Json, JsonConfig};
|
||||||
use diesel::{Connection, PgConnection};
|
use diesel::{PgConnection};
|
||||||
use diesel::r2d2::ConnectionManager;
|
use diesel::r2d2::ConnectionManager;
|
||||||
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||||
use log::{error, info, Level};
|
use log::{error, info, Level};
|
||||||
|
@ -48,8 +48,8 @@ async fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
info!("Connecting to database...");
|
info!("Connecting to database...");
|
||||||
|
|
||||||
let mut manager = ConnectionManager::new(&CONFIG.db_uri);
|
let manager = ConnectionManager::new(&CONFIG.db_uri);
|
||||||
let mut pool: PgPool = match Pool::builder().build(manager) {
|
let pool: PgPool = match Pool::builder().build(manager) {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Error connecting to database: {}", e);
|
error!("Error connecting to database: {}", e);
|
||||||
|
@ -80,7 +80,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(data.clone())
|
.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();
|
let err2: APIError = (&err).into();
|
||||||
actix_web::error::InternalError::from_response(
|
actix_web::error::InternalError::from_response(
|
||||||
err,
|
err,
|
||||||
|
|
Loading…
Reference in New Issue