Skip to content

Commit

Permalink
🚨 apply clippy suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: David Bernard <david.bernard.31@gmail.com>
  • Loading branch information
davidB committed Feb 11, 2024
1 parent b74b772 commit 5af550f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tracing-opentelemetry-instrumentation-sdk/src/http/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ pub fn http_host<B>(req: &http::Request<B>) -> &str {
.unwrap_or("")
}

/// gRPC status codes
/// [gRPC status codes]: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md#status-codes-and-their-use-in-grpc
/// [`gRPC` status codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md#status-codes-and-their-use-in-grpc)
/// copied from tonic
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum GrpcCode {
Expand Down Expand Up @@ -259,7 +258,10 @@ mod tests {
let mut headers = http::HeaderMap::new();
headers.insert("grpc-status", input.to_string().parse().unwrap());
if input > -1 {
assert_eq!(grpc_status_from_http_header(&headers), Some(input as u16));
assert_eq!(
grpc_status_from_http_header(&headers),
Some(u16::try_from(input).unwrap())
);
} else {
assert_eq!(grpc_status_from_http_header(&headers), None);
}
Expand Down

0 comments on commit 5af550f

Please sign in to comment.