aquatic_ws: fix some clippy warnings

This commit is contained in:
Joakim Frostegård 2020-08-02 00:07:12 +02:00
parent 8fc09cb130
commit aabdf76a5d
3 changed files with 21 additions and 25 deletions

View file

@ -198,8 +198,9 @@ pub fn handle_announce_requests(
} }
// If peer sent answer, send it on to relevant peer // If peer sent answer, send it on to relevant peer
match (request.answer, request.to_peer_id, request.offer_id){ if let (Some(answer), Some(answer_receiver_id), Some(offer_id)) =
(Some(answer), Some(answer_receiver_id), Some(offer_id)) => { (request.answer, request.to_peer_id, request.offer_id)
{
if let Some(answer_receiver) = torrent_data.peers if let Some(answer_receiver) = torrent_data.peers
.get(&answer_receiver_id) .get(&answer_receiver_id)
{ {
@ -215,8 +216,6 @@ pub fn handle_announce_requests(
OutMessage::Answer(middleman_answer) OutMessage::Answer(middleman_answer)
)); ));
} }
},
_ => (),
} }
let response = OutMessage::AnnounceResponse(AnnounceResponse { let response = OutMessage::AnnounceResponse(AnnounceResponse {

View file

@ -68,11 +68,8 @@ pub fn run(config: Config) -> anyhow::Result<()> {
if let Some(statuses) = socket_worker_statuses.try_lock(){ if let Some(statuses) = socket_worker_statuses.try_lock(){
for opt_status in statuses.iter(){ for opt_status in statuses.iter(){
match opt_status { if let Some(Err(err)) = opt_status {
Some(Err(err)) => {
return Err(::anyhow::anyhow!(err.to_owned())); return Err(::anyhow::anyhow!(err.to_owned()));
},
_ => {},
} }
} }
@ -126,7 +123,7 @@ pub fn create_tls_acceptor(
.context("Couldn't read pkcs12 identity file")?; .context("Couldn't read pkcs12 identity file")?;
let identity = Identity::from_pkcs12( let identity = Identity::from_pkcs12(
&mut identity_bytes, &identity_bytes,
&config.network.tls_pkcs12_password &config.network.tls_pkcs12_password
).context("Couldn't parse pkcs12 identity file")?; ).context("Couldn't parse pkcs12 identity file")?;

View file

@ -222,7 +222,7 @@ impl Connection {
} }
#[inline] #[inline]
pub fn get_established_ws<'a>(&mut self) -> Option<&mut EstablishedWs> { pub fn get_established_ws(&mut self) -> Option<&mut EstablishedWs> {
match self.inner { match self.inner {
Either::Left(ref mut ews) => Some(ews), Either::Left(ref mut ews) => Some(ews),
Either::Right(_) => None, Either::Right(_) => None,