Skip to content

Commit 0306e91

Browse files
committed
Simplify TlsListener::configure
Now that we no longer need to return the TlsAcceptor, integrate the error handling into the preceeding match.
1 parent e8ea6d0 commit 0306e91

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/tls_listener.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ impl<State> TlsListener<State> {
8686
TlsListenerConfig::Acceptor(TlsAcceptor::from(Arc::new(config)))
8787
}
8888

89-
other => other,
89+
other @ TlsListenerConfig::Acceptor(_) => other,
90+
91+
TlsListenerConfig::Unconfigured => {
92+
return Err(io::Error::new(
93+
io::ErrorKind::Other,
94+
"could not configure tlslistener",
95+
));
96+
}
9097
};
9198

92-
if let TlsListenerConfig::Acceptor(_) = self.config {
93-
Ok(())
94-
} else {
95-
Err(io::Error::new(
96-
io::ErrorKind::Other,
97-
"could not configure tlslistener",
98-
))
99-
}
99+
Ok(())
100100
}
101101

102102
fn acceptor(&self) -> Option<&TlsAcceptor> {

0 commit comments

Comments
 (0)