From ba808044be8f3123736d10f14478a07fe020c9b7 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 19 Sep 2025 17:47:46 +0800 Subject: chore: more concise qualification --- src/client/connector.rs | 8 ++++++-- src/client/connector/httpconnector.rs | 4 ++-- src/tasks.rs | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/client/connector.rs b/src/client/connector.rs index ee40089..f9cee1a 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -1,11 +1,15 @@ pub mod httpconnector; -use std::net::IpAddr; +use std::{ + fmt::{Debug, Display}, + net::IpAddr, + result, +}; use crate::{client::Client, executor::Executor}; use remote_control_rs::tasks::NETWORK_T; -pub type Result = std::result::Result; +pub type Result = result::Result; pub trait Connection { type Ok: std::fmt::Display + AsRef = String; diff --git a/src/client/connector/httpconnector.rs b/src/client/connector/httpconnector.rs index 5cfbe30..dbd094c 100644 --- a/src/client/connector/httpconnector.rs +++ b/src/client/connector/httpconnector.rs @@ -4,7 +4,7 @@ use reqwest::{ Error, StatusCode, Url, blocking::{Client, RequestBuilder}, }; -use std::{net::IpAddr, thread::sleep, time::Duration}; +use std::{net::IpAddr, result, thread::sleep, time::Duration}; #[derive(Debug)] pub enum HTTPConnectorError { @@ -34,7 +34,7 @@ pub struct HTTPConnector { } impl HTTPConnector { - pub fn new(pull_url: &str, ntfy_url: &str, ip_getter_url: &str) -> std::result::Result { + pub fn new(pull_url: &str, ntfy_url: &str, ip_getter_url: &str) -> result::Result { Ok(Self { network_enforcer: Executor::new(&NETWORK_T, ["true"]).unwrap(), // .unwrap() should never panic prev: String::new(), diff --git a/src/tasks.rs b/src/tasks.rs index e862f79..0e196b2 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -1,3 +1,5 @@ +use std::fmt::Display; + pub struct Task { pub name: Name, pub exec: fn(&[&str]) -> Result, @@ -10,7 +12,7 @@ pub enum Name { Network, } -impl std::fmt::Display for Name { +impl Display for Name { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{:?}", self) } -- cgit v1.2.3