Skip to content

Commit 75b773f

Browse files
committed
suggestions from edition 2024
1 parent 58a6128 commit 75b773f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ impl TcpStream {
202202

203203
/// Check whether the stream is connected or not
204204
#[must_use]
205+
#[allow(irrefutable_let_patterns)]
205206
pub fn is_connected(&self) -> bool {
206207
if let Self::Plain(_, connected) = self {
207208
*connected
@@ -214,13 +215,14 @@ impl TcpStream {
214215
/// - Ok(true) if connected
215216
/// - Ok(false) if connecting
216217
/// - Err(_) if an error is encountered
218+
#[allow(irrefutable_let_patterns)]
217219
pub fn try_connect(&mut self) -> io::Result<bool> {
218220
if self.is_connected() {
219221
return Ok(true);
220222
}
221223
match self.is_writable() {
222224
Ok(()) => {
223-
if let Self::Plain(_, ref mut connected) = self {
225+
if let Self::Plain(_, connected) = self {
224226
*connected = true;
225227
}
226228
Ok(true)
@@ -490,13 +492,13 @@ impl DerefMut for TcpStream {
490492
macro_rules! fwd_impl {
491493
($self:ident, $method:ident, $($args:expr),*) => {
492494
match $self {
493-
TcpStream::Plain(ref mut plain, _) => plain.$method($($args),*),
495+
TcpStream::Plain(plain, _) => plain.$method($($args),*),
494496
#[cfg(feature = "native-tls")]
495-
TcpStream::NativeTls(ref mut tls) => tls.$method($($args),*),
497+
TcpStream::NativeTls(tls) => tls.$method($($args),*),
496498
#[cfg(feature = "openssl")]
497-
TcpStream::OpenSsl(ref mut tls) => tls.$method($($args),*),
499+
TcpStream::OpenSsl(tls) => tls.$method($($args),*),
498500
#[cfg(feature = "rustls-common")]
499-
TcpStream::Rustls(ref mut tls) => tls.$method($($args),*),
501+
TcpStream::Rustls(tls) => tls.$method($($args),*),
500502
}
501503
};
502504
}

0 commit comments

Comments
 (0)