Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tower-http/src/request_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,19 @@ mod tests {
use crate::test_helpers::Body;
use crate::ServiceBuilderExt as _;
use http::Response;
#[cfg(target_has_atomic = "64")]
use std::sync::atomic::AtomicU64;
use std::{
convert::Infallible,
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
sync::{atomic::Ordering, Arc},
};
use tower::{ServiceBuilder, ServiceExt};

#[allow(unused_imports)]
use super::*;

#[tokio::test]
#[cfg(target_has_atomic = "64")]
async fn basic() {
let svc = ServiceBuilder::new()
.set_x_request_id(Counter::default())
Expand Down Expand Up @@ -526,6 +526,7 @@ mod tests {
}

#[tokio::test]
#[cfg(target_has_atomic = "64")]
async fn other_middleware_setting_request_id() {
let svc = ServiceBuilder::new()
.override_request_header(
Expand Down Expand Up @@ -554,6 +555,7 @@ mod tests {
}

#[tokio::test]
#[cfg(target_has_atomic = "64")]
async fn other_middleware_setting_request_id_on_response() {
let svc = ServiceBuilder::new()
.set_x_request_id(Counter::default())
Expand All @@ -574,8 +576,10 @@ mod tests {
}

#[derive(Clone, Default)]
#[cfg(target_has_atomic = "64")]
struct Counter(Arc<AtomicU64>);

#[cfg(target_has_atomic = "64")]
impl MakeRequestId for Counter {
fn make_request_id<B>(&mut self, _request: &Request<B>) -> Option<RequestId> {
let id =
Expand Down