diff --git a/interop/src/server.rs b/interop/src/server.rs index 199a21b88..c5cdda052 100644 --- a/interop/src/server.rs +++ b/interop/src/server.rs @@ -241,12 +241,11 @@ impl HttpBody for MergeTrailers { ) -> Poll, Self::Error>>> { let this = self.get_mut(); let mut frame = ready!(Pin::new(&mut this.inner).poll_frame(cx)?); - if let Some(frame) = frame.as_mut() { - if let Some(trailers) = frame.trailers_mut() { - if let Some((key, value)) = &this.trailer { - trailers.insert(key.clone(), value.clone()); - } - } + if let (Some(trailers), Some((key, value))) = ( + frame.as_mut().and_then(|frame| frame.trailers_mut()), + &this.trailer, + ) { + trailers.insert(key.clone(), value.clone()); } Poll::Ready(frame.map(Ok)) }