From 4b3da3b85f4d59ddf6265840f22aa4a90b380c91 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 25 Feb 2024 01:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=92=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/rustfmt.toml | 2 +- ica-rs/src/events.rs | 5 +---- ica-rs/src/main.rs | 5 ++--- ica-rs/src/py/mod.rs | 6 +----- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ica-rs/rustfmt.toml b/ica-rs/rustfmt.toml index 070df82..24a1762 100644 --- a/ica-rs/rustfmt.toml +++ b/ica-rs/rustfmt.toml @@ -3,7 +3,7 @@ # 最大行长 max_width = 100 # 链式调用的最大长度 -chain_width = 70 +chain_width = 80 # 数组的最大长度 array_width = 70 # 函数参数的最大长度 diff --git a/ica-rs/src/events.rs b/ica-rs/src/events.rs index b5c4647..fd4e77b 100644 --- a/ica-rs/src/events.rs +++ b/ica-rs/src/events.rs @@ -28,10 +28,7 @@ pub async fn add_message(payload: Payload, client: Client) { if let Some(value) = values.first() { let message: NewMessage = serde_json::from_value(value.clone()).unwrap(); // 检测是否在过滤列表内 - if IcalinguaStatus::get_config() - .filter_list - .contains(&message.msg.sender_id) - { + if IcalinguaStatus::get_config().filter_list.contains(&message.msg.sender_id) { return; } info!("add_message {}", message.to_string().cyan()); diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index ef2037d..56c1f3c 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -75,9 +75,8 @@ async fn main() { ); std::thread::sleep(Duration::from_secs(1)); info!("发送启动消息到房间: {}", room); - if let Err(e) = socket - .emit("sendMessage", serde_json::to_value(startup_msg).unwrap()) - .await + if let Err(e) = + socket.emit("sendMessage", serde_json::to_value(startup_msg).unwrap()).await { info!("启动信息发送失败 房间:{}|e:{}", room, e); } diff --git a/ica-rs/src/py/mod.rs b/ica-rs/src/py/mod.rs index 049b797..5d3c911 100644 --- a/ica-rs/src/py/mod.rs +++ b/ica-rs/src/py/mod.rs @@ -107,11 +107,7 @@ pub fn load_py_plugins(path: &PathBuf) { pub fn verify_plugins() { let mut need_reload_files: Vec = Vec::new(); - let plugin_path = IcalinguaStatus::get_config() - .py_plugin_path - .as_ref() - .unwrap() - .to_owned(); + let plugin_path = IcalinguaStatus::get_config().py_plugin_path.as_ref().unwrap().to_owned(); for entry in std::fs::read_dir(&plugin_path).unwrap() { if let Ok(entry) = entry { let path = entry.path();