Skip to content

Commit 7320bdb

Browse files
Use core::error::Error
This allows us to always use the Error rather than only when std feature is enabled. This was stabilized in Rust 1.81, which is below our current MSRV.
1 parent 6378802 commit 7320bdb

File tree

13 files changed

+13
-23
lines changed

13 files changed

+13
-23
lines changed

dc/s2n-quic-dc/src/stream/recv/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl fmt::Display for Error {
3737
}
3838
}
3939

40-
impl std::error::Error for Error {}
40+
impl core::error::Error for Error {}
4141

4242
impl IntoEvent<Error> for Error {
4343
fn into_event(self) -> Error {

dc/s2n-quic-dc/src/stream/send/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl fmt::Display for Error {
3434
}
3535
}
3636

37-
impl std::error::Error for Error {}
37+
impl core::error::Error for Error {}
3838

3939
impl IntoEvent<Error> for Error {
4040
fn into_event(self) -> Error {

quic/s2n-quic-core/src/application/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ use core::{fmt, ops};
1818
#[derive(Copy, Clone, Eq, PartialEq)]
1919
pub struct Error(VarInt);
2020

21-
#[cfg(feature = "std")]
22-
impl std::error::Error for Error {}
21+
impl core::error::Error for Error {}
2322

2423
impl fmt::Debug for Error {
2524
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

quic/s2n-quic-core/src/buffer/deque.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ impl fmt::Display for FillError {
225225
}
226226
}
227227

228-
#[cfg(feature = "std")]
229-
impl std::error::Error for FillError {}
228+
impl core::error::Error for FillError {}
230229

231230
#[cfg(feature = "std")]
232231
impl From<FillError> for std::io::Error {

quic/s2n-quic-core/src/connection/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ pub enum Error {
101101
},
102102
}
103103

104-
#[cfg(feature = "std")]
105-
impl std::error::Error for Error {}
104+
impl core::error::Error for Error {}
106105

107106
impl fmt::Display for Error {
108107
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

quic/s2n-quic-core/src/datagram/default.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ pub enum BuilderError {
4949
ZeroCapacity,
5050
}
5151

52-
#[cfg(feature = "std")]
53-
impl std::error::Error for BuilderError {}
52+
impl core::error::Error for BuilderError {}
5453

5554
impl fmt::Display for BuilderError {
5655
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

quic/s2n-quic-core/src/path/mtu.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ impl Display for MtuError {
241241
}
242242
}
243243

244-
#[cfg(feature = "std")]
245-
impl std::error::Error for MtuError {}
244+
impl core::error::Error for MtuError {}
246245

247246
/// Information about the path that may be used when generating MTU configuration.
248247
#[non_exhaustive]

quic/s2n-quic-core/src/query.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,4 @@ impl core::fmt::Display for Error {
132132
}
133133
}
134134

135-
#[cfg(feature = "std")]
136-
impl std::error::Error for Error {}
135+
impl core::error::Error for Error {}

quic/s2n-quic-core/src/stream/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ pub enum StreamError {
6868
},
6969
}
7070

71-
#[cfg(feature = "std")]
72-
impl std::error::Error for StreamError {}
71+
impl core::error::Error for StreamError {}
7372

7473
impl fmt::Display for StreamError {
7574
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

quic/s2n-quic-core/src/transport/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ pub struct Error {
2929
pub reason: &'static str,
3030
}
3131

32-
#[cfg(feature = "std")]
33-
impl std::error::Error for Error {}
32+
impl core::error::Error for Error {}
3433

3534
impl Error {
3635
/// Creates a new `Error`

0 commit comments

Comments
 (0)