Skip to content

Commit f14f099

Browse files
committed
chore: fix undocumented panicks
1 parent 7c208d9 commit f14f099

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/linux/adaptor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl KtlsConnector {
9696
.await?
9797
}
9898
#[cfg(not(feature = "rustls"))]
99-
KtlsConnectorInner::None(_) => unreachable!(),
99+
KtlsConnectorInner::None(v) => match *v {},
100100
})),
101101
Err(e) if e.is_ktls_unsupported() => Ok(Err(stream)),
102102
Err(ktls_core::Error::Ulp(e)) => Err(e),
@@ -221,7 +221,7 @@ impl KtlsAcceptor {
221221
#[cfg(feature = "rustls")]
222222
KtlsAcceptorInner::Rustls(c) => super::rtls::accept_ktls(c.clone(), stream).await?,
223223
#[cfg(not(feature = "rustls"))]
224-
KtlsAcceptorInner::None(_) => unreachable!(),
224+
KtlsAcceptorInner::None(v) => match *v {},
225225
})),
226226
Err(e) if e.is_ktls_unsupported() => Ok(Err(stream)),
227227
Err(ktls_core::Error::Ulp(e)) => Err(e),

src/linux/rtls.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,14 @@ where
103103
unsafe { outgoing_tls.set_len(outgoing_tls.len() + len) };
104104
break;
105105
}
106-
Err(EncodeError::InsufficientSize(e)) if first => {
107-
outgoing_tls.reserve(e.required_size)
106+
Err(EncodeError::InsufficientSize(e)) => {
107+
if first {
108+
outgoing_tls.reserve(e.required_size)
109+
} else {
110+
unreachable!("insufficient size after reserve()");
111+
}
108112
}
109-
Err(_) => unreachable!(),
113+
Err(EncodeError::AlreadyEncoded) => unreachable!("encoded twice"),
110114
}
111115
}
112116
}

0 commit comments

Comments
 (0)