From efb68a607a0785b69ab49880e2ea4d4c6c70ca42 Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Wed, 3 May 2023 16:38:42 +0200 Subject: [PATCH] cargo clippy --fix --- src/api/channels/messages.rs | 8 ++++---- src/gateway.rs | 21 ++++++++++----------- src/limit.rs | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/api/channels/messages.rs b/src/api/channels/messages.rs index 5dfe532..67e1404 100644 --- a/src/api/channels/messages.rs +++ b/src/api/channels/messages.rs @@ -6,7 +6,7 @@ pub mod messages { use crate::api::types::Message; use crate::api::User; use crate::errors::InstanceServerError; - use crate::instance::Instance; + use crate::limit::LimitedRequester; impl Message { @@ -43,9 +43,9 @@ pub mod messages { ) .await { - Ok(result) => return Ok(result), - Err(e) => return Err(e), - }; + Ok(result) => Ok(result), + Err(e) => Err(e), + } } } diff --git a/src/gateway.rs b/src/gateway.rs index 61f51ec..fa2fc8d 100644 --- a/src/gateway.rs +++ b/src/gateway.rs @@ -1,20 +1,20 @@ -use std::sync::Arc; -use std::sync::Mutex; -use std::thread::JoinHandle; -use std::time::Duration; + + + + use crate::api::types::*; use crate::api::WebSocketEvent; use crate::errors::ObserverError; use crate::gateway::events::Events; use crate::URLBundle; -use futures_util::SinkExt; + use futures_util::StreamExt; use reqwest::Url; use serde::Deserialize; use serde::Serialize; -use serde_json::from_str; -use serde_json::to_string; + + use tokio::io; use tokio::net::TcpStream; use tokio_tungstenite::connect_async; @@ -60,12 +60,12 @@ impl<'a> Gateway<'a> { } }; - return Ok(Gateway { + Ok(Gateway { url: websocket_url, token, events: Events::default(), socket: ws_stream, - }); + }) } } @@ -129,7 +129,6 @@ impl<'a, T: WebSocketEvent> GatewayEvent<'a, T> { // pointer value than observable. self.observers.retain(|obs| !std::ptr::eq(*obs, observable)); self.is_observed = !self.observers.is_empty(); - return; } /** @@ -223,7 +222,7 @@ mod example { #[tokio::test] async fn test_gateway() { - let gateway = Gateway::new("ws://localhost:3001/".to_string(), "none".to_string()) + let _gateway = Gateway::new("ws://localhost:3001/".to_string(), "none".to_string()) .await .unwrap(); } diff --git a/src/limit.rs b/src/limit.rs index 84e6d17..0dfbbd3 100644 --- a/src/limit.rs +++ b/src/limit.rs @@ -261,7 +261,7 @@ mod rate_limit { #[tokio::test] async fn create_limited_requester() { - let urls = URLBundle::new( + let _urls = URLBundle::new( String::from("http://localhost:3001/api/"), String::from("wss://localhost:3001/"), String::from("http://localhost:3001/cdn"),