Skip to content

Commit

Permalink
fix: remove unused use statements
Browse files Browse the repository at this point in the history
  • Loading branch information
guidota committed May 15, 2023
1 parent 0e2bbbc commit 1bdaea9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
38 changes: 0 additions & 38 deletions rpc/src/transports/error.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
//! Contains the parsing methods for the errors of the current transports.
use std::{io, net::AddrParseError};

#[cfg(feature = "quic")]
use quinn::{ConnectError, ConnectionError, WriteError};
#[cfg(feature = "websockets")]
use tokio_tungstenite::tungstenite;

use super::TransportError;

impl From<io::Error> for TransportError {
Expand All @@ -14,41 +9,8 @@ impl From<io::Error> for TransportError {
}
}

#[cfg(feature = "quic")]
impl From<ConnectError> for TransportError {
fn from(value: ConnectError) -> Self {
TransportError::Internal(Box::new(value))
}
}

#[cfg(feature = "quic")]
impl From<ConnectionError> for TransportError {
fn from(value: ConnectionError) -> Self {
TransportError::Internal(Box::new(value))
}
}

impl From<AddrParseError> for TransportError {
fn from(value: AddrParseError) -> Self {
TransportError::Internal(Box::new(value))
}
}

#[cfg(feature = "quic")]
impl From<WriteError> for TransportError {
fn from(value: WriteError) -> Self {
match value {
WriteError::ZeroRttRejected => {
TransportError::Internal(Box::new(WriteError::ZeroRttRejected))
}
_ => TransportError::Closed,
}
}
}

#[cfg(feature = "websockets")]
impl From<tungstenite::Error> for TransportError {
fn from(value: tungstenite::Error) -> Self {
TransportError::Internal(Box::new(value))
}
}
4 changes: 1 addition & 3 deletions rpc/src/transports/web_sockets/tungstenite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ use tokio_tungstenite::{
MaybeTlsStream, WebSocketStream,
};

use crate::transports::TransportError;

use super::{convert, Error, Message, WebSocket};

/// Write Stream Half of [`WebSocketStream`]
Expand Down Expand Up @@ -208,7 +206,7 @@ impl Drop for WebSocketServer {
pub struct WebSocketClient;

impl WebSocketClient {
pub async fn connect(host: &str) -> Result<Arc<TungsteniteWebSocket>, TransportError> {
pub async fn connect(host: &str) -> Result<Arc<TungsteniteWebSocket>, Error> {
let (websocket_stream, _) = connect_async(host).await?;
debug!("Connected to {}", host);

Expand Down

0 comments on commit 1bdaea9

Please sign in to comment.