Skip to content

Commit

Permalink
Inline some single-use bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Dec 11, 2023
1 parent 4325cde commit 98c0572
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,19 @@ where
return Box::pin(async move { Err(Box::new(err).into()) });
}
};
let connecting_future = self.http.call(dst);

let f = async move {
let connecting_future = self.http.call(dst);
Box::pin(async move {
let tcp = connecting_future
.await
.map_err(Into::into)?;
let connector = TlsConnector::from(cfg);
let tls = connector
.connect(hostname, tcp)
.await
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
Ok(MaybeHttpsStream::Https(tls))
};
Box::pin(f)
Ok(MaybeHttpsStream::Https(
TlsConnector::from(cfg)
.connect(hostname, tcp)
.await
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?,
))
})
}
}

Expand Down

0 comments on commit 98c0572

Please sign in to comment.