Skip to content

Commit

Permalink
Replace let _ with let _enter
Browse files Browse the repository at this point in the history
See discussion here: rust-lang/rust-clippy#8246

tl;dr: `let _` drops immediately, so for anything that has Guard
like behavior, it will not work as expected. `let _enter` will
ensure that the guard is dropped at the end of the scope.
  • Loading branch information
rbtcollins authored and davidB committed Feb 11, 2024
1 parent aa51cb9 commit 3e35c7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ where
tracing::Span::none()
};
let future = {
let _ = span.enter();
let _enter = span.enter();
self.inner.call(req)
};
ResponseFuture {
Expand Down
2 changes: 1 addition & 1 deletion tonic-tracing-opentelemetry/src/middleware/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ where
let span = otel_http::grpc_client::make_span_from_request(&req);
otel_http::inject_context(&find_context_from_tracing(&span), req.headers_mut());
let future = {
let _ = span.enter();
let _enter = span.enter();
self.inner.call(req)
};
ResponseFuture {
Expand Down
2 changes: 1 addition & 1 deletion tonic-tracing-opentelemetry/src/middleware/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
tracing::Span::none()
};
let future = {
let _ = span.enter();
let _enter = span.enter();
self.inner.call(req)
};
ResponseFuture {
Expand Down

0 comments on commit 3e35c7d

Please sign in to comment.