cargo clippy --fix

This commit is contained in:
bitfl0wer 2023-05-03 16:38:42 +02:00
parent 5edc92524c
commit efb68a607a
3 changed files with 15 additions and 16 deletions

View File

@ -6,7 +6,7 @@ pub mod messages {
use crate::api::types::Message; use crate::api::types::Message;
use crate::api::User; use crate::api::User;
use crate::errors::InstanceServerError; use crate::errors::InstanceServerError;
use crate::instance::Instance;
use crate::limit::LimitedRequester; use crate::limit::LimitedRequester;
impl Message { impl Message {
@ -43,9 +43,9 @@ pub mod messages {
) )
.await .await
{ {
Ok(result) => return Ok(result), Ok(result) => Ok(result),
Err(e) => return Err(e), Err(e) => Err(e),
}; }
} }
} }

View File

@ -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::types::*;
use crate::api::WebSocketEvent; use crate::api::WebSocketEvent;
use crate::errors::ObserverError; use crate::errors::ObserverError;
use crate::gateway::events::Events; use crate::gateway::events::Events;
use crate::URLBundle; use crate::URLBundle;
use futures_util::SinkExt;
use futures_util::StreamExt; use futures_util::StreamExt;
use reqwest::Url; use reqwest::Url;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use serde_json::from_str;
use serde_json::to_string;
use tokio::io; use tokio::io;
use tokio::net::TcpStream; use tokio::net::TcpStream;
use tokio_tungstenite::connect_async; use tokio_tungstenite::connect_async;
@ -60,12 +60,12 @@ impl<'a> Gateway<'a> {
} }
}; };
return Ok(Gateway { Ok(Gateway {
url: websocket_url, url: websocket_url,
token, token,
events: Events::default(), events: Events::default(),
socket: ws_stream, socket: ws_stream,
}); })
} }
} }
@ -129,7 +129,6 @@ impl<'a, T: WebSocketEvent> GatewayEvent<'a, T> {
// pointer value than observable. // pointer value than observable.
self.observers.retain(|obs| !std::ptr::eq(*obs, observable)); self.observers.retain(|obs| !std::ptr::eq(*obs, observable));
self.is_observed = !self.observers.is_empty(); self.is_observed = !self.observers.is_empty();
return;
} }
/** /**
@ -223,7 +222,7 @@ mod example {
#[tokio::test] #[tokio::test]
async fn test_gateway() { 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 .await
.unwrap(); .unwrap();
} }

View File

@ -261,7 +261,7 @@ mod rate_limit {
#[tokio::test] #[tokio::test]
async fn create_limited_requester() { async fn create_limited_requester() {
let urls = URLBundle::new( let _urls = URLBundle::new(
String::from("http://localhost:3001/api/"), String::from("http://localhost:3001/api/"),
String::from("wss://localhost:3001/"), String::from("wss://localhost:3001/"),
String::from("http://localhost:3001/cdn"), String::from("http://localhost:3001/cdn"),