From 66aa985a9cb95c96325823705c88ae5a6aaf5cb1 Mon Sep 17 00:00:00 2001 From: erikness-doordash Date: Mon, 23 Oct 2023 15:35:14 -0700 Subject: [PATCH] Simplify code into 1 statement --- src/dispatcher.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/dispatcher.rs b/src/dispatcher.rs index b48ff88a..a1bbc7eb 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -428,9 +428,7 @@ impl Dispatcher { } fn on_grpc_receive_initial_metadata(&self, token_id: u32, headers: u32) { - let grpc_streams_ref = self.grpc_streams.borrow_mut(); - let context_id_hash_slot = grpc_streams_ref.get(&token_id); - let context_id = match context_id_hash_slot { + let context_id = match self.grpc_streams.borrow_mut().get(&token_id) { Some(id) => *id, None => { // TODO: change back to a panic once underlying issue is fixed. @@ -490,9 +488,7 @@ impl Dispatcher { } fn on_grpc_receive_trailing_metadata(&self, token_id: u32, trailers: u32) { - let grpc_streams_ref = self.grpc_streams.borrow_mut(); - let context_id_hash_slot = grpc_streams_ref.get(&token_id); - let context_id = match context_id_hash_slot { + let context_id = match self.grpc_streams.borrow_mut().get(&token_id) { Some(id) => *id, None => { // TODO: change back to a panic once underlying issue is fixed.