Skip to content

Commit

Permalink
chore(channel): Remove redundant temporary variable (#2122)
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored Jan 5, 2025
1 parent cccd68d commit bff5146
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tonic/src/transport/channel/service/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ impl<K: Hash + Eq + Clone> Stream for DynamicServiceStream<K> {
type Item = Result<TowerChange<K, Connection>, crate::BoxError>;

fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
let c = &mut self.changes;
match Pin::new(&mut *c).poll_recv(cx) {
match Pin::new(&mut self.changes).poll_recv(cx) {
Poll::Pending | Poll::Ready(None) => Poll::Pending,
Poll::Ready(Some(change)) => match change {
Change::Insert(k, endpoint) => {
let http = endpoint.http_connector();
let connection = Connection::lazy(endpoint.connector(http), endpoint);
let change = Ok(TowerChange::Insert(k, connection));
Poll::Ready(Some(change))
Poll::Ready(Some(Ok(TowerChange::Insert(k, connection))))
}
Change::Remove(k) => Poll::Ready(Some(Ok(TowerChange::Remove(k)))),
},
Expand Down

0 comments on commit bff5146

Please sign in to comment.