Skip to content

Commit

Permalink
remove unused mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed May 7, 2024
1 parent c7cb03d commit 166e68d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 85 deletions.
72 changes: 0 additions & 72 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cdn-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ url = "2"
tracing.workspace = true
pem = "3"
rustls = { version = "0.21", default-features = false }
mockall = "0.12"
async-trait = "0.1"
warp = { version = "0.3", default-features = false }
anyhow = "1"
Expand Down
12 changes: 0 additions & 12 deletions cdn-proto/src/connection/protocols/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::time::Duration;

use async_trait::async_trait;
use mockall::automock;
use rustls::{Certificate, PrivateKey};
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
Expand All @@ -26,7 +25,6 @@ pub mod quic;
pub mod tcp;

/// The `Protocol` trait lets us be generic over a connection type (Tcp, Quic, etc).
#[automock(type Connection=MockConnection; type UnfinalizedConnection=MockUnfinalizedConnection<MockConnection>; type Listener=MockListener<MockUnfinalizedConnection<MockConnection>>;)]
#[async_trait]
pub trait Protocol<M: Middleware>: Send + Sync + 'static {
type Connection: Connection + Send + Sync + Clone;
Expand All @@ -51,7 +49,6 @@ pub trait Protocol<M: Middleware>: Send + Sync + 'static {
) -> Result<Self::Listener>;
}

#[automock]
#[async_trait]
pub trait Connection {
/// Send an (unserialized) message over the stream.
Expand Down Expand Up @@ -83,7 +80,6 @@ pub trait Connection {
async fn finish(&self);
}

#[automock]
#[async_trait]
pub trait Listener<UnfinalizedConnection: Send + Sync> {
/// Accept an unfinalized connection from the local, bound socket.
Expand All @@ -94,7 +90,6 @@ pub trait Listener<UnfinalizedConnection: Send + Sync> {
async fn accept(&self) -> Result<UnfinalizedConnection>;
}

#[automock]
#[async_trait]
pub trait UnfinalizedConnection<Connection: Send + Sync> {
/// Finalize an incoming connection. This is separated so we can prevent
Expand All @@ -103,13 +98,6 @@ pub trait UnfinalizedConnection<Connection: Send + Sync> {
async fn finalize(self) -> Result<Connection>;
}

/// We need to implement `clone` manually because we need it and `mockall` can't do it.
impl Clone for MockConnection {
fn clone(&self) -> Self {
Self::default()
}
}

/// Read a length-delimited (serialized) message from a stream.
/// Has a bounds check for if the message is too big
async fn read_length_delimited<R: AsyncReadExt + Unpin + Send, M: Middleware>(
Expand Down

0 comments on commit 166e68d

Please sign in to comment.