From ab469fb04424bc1aff8ea0fc04df3d9dd44fc7bf Mon Sep 17 00:00:00 2001 From: Benno van den Berg Date: Tue, 23 Jul 2024 16:15:03 +0200 Subject: [PATCH 1/5] Replace clippy::mismatched_target_os with unexpected_cfgs --- axum-core/src/lib.rs | 4 ++-- axum-extra/src/lib.rs | 4 ++-- axum-macros/src/lib.rs | 4 ++-- axum/src/lib.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/axum-core/src/lib.rs b/axum-core/src/lib.rs index 994b522c07..fb4406bea7 100644 --- a/axum-core/src/lib.rs +++ b/axum-core/src/lib.rs @@ -21,7 +21,6 @@ clippy::needless_borrow, clippy::match_wildcard_for_single_variants, clippy::if_let_mutex, - clippy::mismatched_target_os, clippy::await_holding_lock, clippy::match_on_vec_items, clippy::imprecise_flops, @@ -41,7 +40,8 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs + missing_docs, + unexpected_cfgs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] diff --git a/axum-extra/src/lib.rs b/axum-extra/src/lib.rs index 2ddda783e4..f7d24baaa5 100644 --- a/axum-extra/src/lib.rs +++ b/axum-extra/src/lib.rs @@ -40,7 +40,6 @@ clippy::needless_borrow, clippy::match_wildcard_for_single_variants, clippy::if_let_mutex, - clippy::mismatched_target_os, clippy::await_holding_lock, clippy::match_on_vec_items, clippy::imprecise_flops, @@ -60,7 +59,8 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs + missing_docs, + unexpected_cfgs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] diff --git a/axum-macros/src/lib.rs b/axum-macros/src/lib.rs index 0d5836c6e2..60eacc18da 100644 --- a/axum-macros/src/lib.rs +++ b/axum-macros/src/lib.rs @@ -15,7 +15,6 @@ clippy::needless_borrow, clippy::match_wildcard_for_single_variants, clippy::if_let_mutex, - clippy::mismatched_target_os, clippy::await_holding_lock, clippy::match_on_vec_items, clippy::imprecise_flops, @@ -35,7 +34,8 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs + missing_docs, + unexpected_cfgs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] diff --git a/axum/src/lib.rs b/axum/src/lib.rs index fcd78a8baa..0b67207c23 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -388,7 +388,6 @@ clippy::needless_borrow, clippy::match_wildcard_for_single_variants, clippy::if_let_mutex, - clippy::mismatched_target_os, clippy::await_holding_lock, clippy::match_on_vec_items, clippy::imprecise_flops, @@ -408,7 +407,8 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs + missing_docs, + unexpected_cfgs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] From 005bce2733464f24a0ce86f193ee202b6608086a Mon Sep 17 00:00:00 2001 From: Benno van den Berg Date: Tue, 23 Jul 2024 16:15:39 +0200 Subject: [PATCH 2/5] Fix warning related to default_features --- axum-extra/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axum-extra/Cargo.toml b/axum-extra/Cargo.toml index 4ba0732a61..e091cd9c81 100644 --- a/axum-extra/Cargo.toml +++ b/axum-extra/Cargo.toml @@ -49,7 +49,7 @@ http-body-util = "0.1.0" mime = "0.3" pin-project-lite = "0.2" serde = "1.0" -tower = { version = "0.4", default_features = false, features = ["util"] } +tower = { version = "0.4", default-features = false, features = ["util"] } tower-layer = "0.3" tower-service = "0.3" From ce6bac370d7b34b40f4bae35728c88b9e0e7c280 Mon Sep 17 00:00:00 2001 From: Benno van den Berg Date: Tue, 23 Jul 2024 16:20:35 +0200 Subject: [PATCH 3/5] Resolve another clippy --- examples/sse/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sse/src/main.rs b/examples/sse/src/main.rs index 53f7dc49b8..73e7511eb5 100644 --- a/examples/sse/src/main.rs +++ b/examples/sse/src/main.rs @@ -96,7 +96,7 @@ mod tests { let listening_url = spawn_app("127.0.0.1").await; let mut event_stream = reqwest::Client::new() - .get(&format!("{}/sse", listening_url)) + .get(format!("{}/sse", listening_url)) .header("User-Agent", "integration_test") .send() .await From 7483a520826cb1cdd3b57430d065eabf3e495b99 Mon Sep 17 00:00:00 2001 From: Benno van den Berg Date: Tue, 23 Jul 2024 16:32:14 +0200 Subject: [PATCH 4/5] Resolve more clippies Allow dead_code for RequiresState, since it is actually being used. Remove unused Svc struct in a test --- axum-core/src/ext_traits/mod.rs | 1 + axum/src/routing/tests/handle_error.rs | 17 ----------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/axum-core/src/ext_traits/mod.rs b/axum-core/src/ext_traits/mod.rs index 02595fbeac..4c98b14332 100644 --- a/axum-core/src/ext_traits/mod.rs +++ b/axum-core/src/ext_traits/mod.rs @@ -30,6 +30,7 @@ mod tests { } // some extractor that requires the state, such as `SignedCookieJar` + #[allow(dead_code)] pub(crate) struct RequiresState(pub(crate) String); #[async_trait] diff --git a/axum/src/routing/tests/handle_error.rs b/axum/src/routing/tests/handle_error.rs index e5d575e9dc..a2fd2e6828 100644 --- a/axum/src/routing/tests/handle_error.rs +++ b/axum/src/routing/tests/handle_error.rs @@ -12,23 +12,6 @@ fn timeout() -> TimeoutLayer { TimeoutLayer::new(Duration::from_millis(10)) } -#[derive(Clone)] -struct Svc; - -impl Service for Svc { - type Response = Response; - type Error = hyper::Error; - type Future = Ready>; - - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { - Poll::Ready(Ok(())) - } - - fn call(&mut self, _req: R) -> Self::Future { - ready(Ok(Response::new(Body::empty()))) - } -} - #[crate::test] async fn handler() { let app = Router::new().route( From 2fc04b640f3cb7d3e132d4f266a9f38887e9d00d Mon Sep 17 00:00:00 2001 From: Benno van den Berg Date: Tue, 23 Jul 2024 22:08:55 +0200 Subject: [PATCH 5/5] Remove unneeded unexpected_cfgs --- axum-core/src/lib.rs | 3 +-- axum-extra/src/lib.rs | 3 +-- axum-macros/src/lib.rs | 3 +-- axum/src/lib.rs | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/axum-core/src/lib.rs b/axum-core/src/lib.rs index fb4406bea7..cd1dc2ee60 100644 --- a/axum-core/src/lib.rs +++ b/axum-core/src/lib.rs @@ -40,8 +40,7 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs, - unexpected_cfgs + missing_docs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] diff --git a/axum-extra/src/lib.rs b/axum-extra/src/lib.rs index f7d24baaa5..02dd6e697a 100644 --- a/axum-extra/src/lib.rs +++ b/axum-extra/src/lib.rs @@ -59,8 +59,7 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs, - unexpected_cfgs + missing_docs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] diff --git a/axum-macros/src/lib.rs b/axum-macros/src/lib.rs index 60eacc18da..f1de3ce8f2 100644 --- a/axum-macros/src/lib.rs +++ b/axum-macros/src/lib.rs @@ -34,8 +34,7 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs, - unexpected_cfgs + missing_docs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] diff --git a/axum/src/lib.rs b/axum/src/lib.rs index 0b67207c23..94174229e8 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -407,8 +407,7 @@ future_incompatible, nonstandard_style, missing_debug_implementations, - missing_docs, - unexpected_cfgs + missing_docs )] #![deny(unreachable_pub)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)]