diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-09-16 20:27:22 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-09-17 21:28:52 +0800 |
| commit | 73b908cb44cf52a768647c0f5cd450ab48cf831f (patch) | |
| tree | 5cec5d442c065a0464626e45e7c61ac97e04d63e /src/client/connector | |
| parent | 4517907896246d815d1ab2b4c67b883cd567eae0 (diff) | |
chore: rustfmt config change
Diffstat (limited to 'src/client/connector')
| -rw-r--r-- | src/client/connector/httpconnector.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/client/connector/httpconnector.rs b/src/client/connector/httpconnector.rs index d8c0027..a418b97 100644 --- a/src/client/connector/httpconnector.rs +++ b/src/client/connector/httpconnector.rs @@ -16,11 +16,7 @@ pub struct HTTPConnector { } impl HTTPConnector { - pub fn new( - pull_url: &str, - ntfy_url: &str, - ip_getter_url: &str, - ) -> std::result::Result<Self, url::ParseError> { + pub fn new(pull_url: &str, ntfy_url: &str, ip_getter_url: &str) -> std::result::Result<Self, url::ParseError> { Ok(Self { network_enforcer: Executor::new(&NETWORK_T, ["on".to_string()]).unwrap(), // .unwrap() should never panic prev: String::new(), @@ -35,10 +31,7 @@ impl HTTPConnector { } #[allow(clippy::only_used_in_recursion)] - fn handle_response<F: Fn() -> RequestBuilder>( - &self, - req: F, - ) -> Result<<HTTPConnector as Connection>::Ok, <HTTPConnector as Connection>::Err> { + fn handle_response<F: Fn() -> RequestBuilder>(&self, req: F) -> Result<<HTTPConnector as Connection>::Ok, <HTTPConnector as Connection>::Err> { match req().send() { Ok(resp) => match resp.status() { StatusCode::TOO_MANY_REQUESTS => { @@ -84,11 +77,7 @@ impl Connection for HTTPConnector { } fn ntfy(&self, data: String) -> std::result::Result<(), Self::Err> { - self.handle_response(|| { - self.client - .post(self.ntfy_url.as_str()) - .body(data.to_owned()) - })?; + self.handle_response(|| self.client.post(self.ntfy_url.as_str()).body(data.to_owned()))?; Ok(()) } |
