Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
kushudai committed Nov 20, 2024
1 parent 8aece78 commit 3c62d3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ SOFTWARE.
#![deny(missing_docs)]

use http_body_util::BodyExt;

#[cfg(feature = "metrics")]
use metrics::MetricInfoWrapper;

use std::collections::HashMap;
use std::convert::Infallible;
use std::time::Duration;
Expand Down Expand Up @@ -770,7 +773,7 @@ impl Consul {
req: http::request::Builder,
body: BoxBody<Bytes, Infallible>,
duration: Option<std::time::Duration>,
function: Function,
_function: Function,
) -> Result<(Box<dyn Buf>, u64)> {
let req = req
.header(
Expand All @@ -782,13 +785,14 @@ impl Consul {
#[cfg(feature = "trace")]
let mut span = crate::hyper_wrapper::span_for_request(&self.tracer, &req);

#[cfg(feature = "metrics")]
let method = req.method().clone();

let future = self.https_client.request(req);

#[cfg(feature = "metrics")]
let mut metrics_info_wrapper =
MetricInfoWrapper::new(method.into(), function, None, self.metrics_tx.clone());
MetricInfoWrapper::new(method.into(), _function, None, self.metrics_tx.clone());
let response = if let Some(dur) = duration {
match timeout(dur, future).await {
Ok(resp) => resp.map_err(ConsulError::ResponseError),
Expand Down
4 changes: 3 additions & 1 deletion src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use http::StatusCode;
#[cfg(feature = "metrics")]
use std::time::Duration;
#[cfg(feature = "metrics")]
use http::StatusCode;

/// A struct to hold information about a calls to consul for metrics.
#[cfg(feature = "metrics")]
Expand Down

0 comments on commit 3c62d3c

Please sign in to comment.