From 0cd3a6c4ae3d2b4bfdf745c70ea55523f33e9eeb Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 24 Aug 2024 16:23:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=A2=E8=B0=A2=20clippy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sr_download/src/main.rs | 6 ++++-- sr_download/src/serve.rs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sr_download/src/main.rs b/sr_download/src/main.rs index f89da6c..470f03e 100644 --- a/sr_download/src/main.rs +++ b/sr_download/src/main.rs @@ -114,8 +114,10 @@ async fn serve_mode(mut stop_receiver: Receiver<()>) -> anyhow::Result<()> { event!(Level::INFO, "{}", "结束下载!".yellow()); // 结束 db db_connect.close().await?; - if conf.serve.enable && web_waiter.is_some() { - web_waiter.unwrap().abort(); + if conf.serve.enable { + if let Some(web_waiter) = web_waiter { + web_waiter.abort(); + } } return Ok(()); } diff --git a/sr_download/src/serve.rs b/sr_download/src/serve.rs index e211749..33c0dda 100644 --- a/sr_download/src/serve.rs +++ b/sr_download/src/serve.rs @@ -2,7 +2,7 @@ use axum::{extract::State, routing::get, Json, Router}; use sea_orm::{ActiveEnum, DatabaseConnection}; use serde::{Deserialize, Serialize}; -use crate::{config::ConfigFile, db_part}; +use crate::db_part; use migration::SaveId; /// 最后一个数据的信息 @@ -79,7 +79,7 @@ async fn get_last_ship(State(db): State) -> Json anyhow::Result<()> { let conf = crate::config::ConfigFile::try_read()?; - + let listener = tokio::net::TcpListener::bind(conf.serve.host_with_port.clone()).await?; let db = db_part::connect_server(&conf).await?; let app = Router::new()