Skip to content

Commit 41facf3

Browse files
gretchenfragedjc
authored andcommitted
Fix large RetryError clippy warnings
Clippy is warning that the size of RetryError (both proto and quinn's versions) are excessively large for a Result Err variant. This function fixes these warnings by boxing the contents of both.
1 parent c8ca79c commit 41facf3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

quinn-proto/src/endpoint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ impl Endpoint {
723723
/// Errors if `incoming.may_retry()` is false.
724724
pub fn retry(&mut self, incoming: Incoming, buf: &mut Vec<u8>) -> Result<Transmit, RetryError> {
725725
if !incoming.may_retry() {
726-
return Err(RetryError(incoming));
726+
return Err(RetryError(Box::new(incoming)));
727727
}
728728

729729
self.clean_up_incoming(&incoming);
@@ -1278,12 +1278,12 @@ pub struct AcceptError {
12781278
/// Error for attempting to retry an [`Incoming`] which already bears a token from a previous retry
12791279
#[derive(Debug, Error)]
12801280
#[error("retry() with validated Incoming")]
1281-
pub struct RetryError(Incoming);
1281+
pub struct RetryError(Box<Incoming>);
12821282

12831283
impl RetryError {
12841284
/// Get the [`Incoming`]
12851285
pub fn into_incoming(self) -> Incoming {
1286-
self.0
1286+
*self.0
12871287
}
12881288
}
12891289

quinn/src/incoming.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ impl Incoming {
5252
pub fn retry(mut self) -> Result<(), RetryError> {
5353
let state = self.0.take().unwrap();
5454
state.endpoint.retry(state.inner).map_err(|e| {
55-
RetryError(Self(Some(State {
55+
RetryError(Box::new(Self(Some(State {
5656
inner: e.into_incoming(),
5757
endpoint: state.endpoint,
58-
})))
58+
}))))
5959
})
6060
}
6161

@@ -118,12 +118,12 @@ struct State {
118118
/// Error for attempting to retry an [`Incoming`] which already bears a token from a previous retry
119119
#[derive(Debug, Error)]
120120
#[error("retry() with validated Incoming")]
121-
pub struct RetryError(Incoming);
121+
pub struct RetryError(Box<Incoming>);
122122

123123
impl RetryError {
124124
/// Get the [`Incoming`]
125125
pub fn into_incoming(self) -> Incoming {
126-
self.0
126+
*self.0
127127
}
128128
}
129129

0 commit comments

Comments
 (0)