diff --git a/quinn-proto/src/connection/streams/mod.rs b/quinn-proto/src/connection/streams/mod.rs index 9a4b62c3a..b373804bf 100644 --- a/quinn-proto/src/connection/streams/mod.rs +++ b/quinn-proto/src/connection/streams/mod.rs @@ -508,19 +508,12 @@ impl ShouldTransmit { } /// Error indicating that a stream has not been opened or has already been finished or reset -#[derive(Debug, Error, Clone, PartialEq, Eq)] +#[derive(Debug, Default, Error, Clone, PartialEq, Eq)] #[error("closed stream")] pub struct ClosedStream { _private: (), } -impl ClosedStream { - #[doc(hidden)] // For use in quinn only - pub fn new() -> Self { - Self { _private: () } - } -} - impl From for io::Error { fn from(x: ClosedStream) -> Self { Self::new(io::ErrorKind::NotConnected, x) diff --git a/quinn/src/send_stream.rs b/quinn/src/send_stream.rs index 08e8ef4a2..ccc2c8ce7 100644 --- a/quinn/src/send_stream.rs +++ b/quinn/src/send_stream.rs @@ -144,7 +144,7 @@ impl SendStream { conn.wake(); Ok(()) } - Err(FinishError::ClosedStream) => Err(ClosedStream::new()), + Err(FinishError::ClosedStream) => Err(ClosedStream::default()), // Harmless. If the application needs to know about stopped streams at this point, it // should call `stopped`. Err(FinishError::Stopped(_)) => Ok(()),