Description: break cyclic dependency
Author: Jonas Smedegaard <dr@jones.dk>
Bug-Debian: https://bugs.debian.org/1094199
Forwarded: not-needed
Last-Update: 2025-02-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/axum-core/Cargo.toml
+++ b/axum-core/Cargo.toml
@@ -36,8 +36,6 @@
 tracing = { version = "0.1.37", default-features = false, optional = true }
 
 [dev-dependencies]
-axum = { path = "../axum", version = "0.7.2" }
-axum-extra = { path = "../axum-extra", features = ["typed-header"] }
 futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
 hyper = "1.0.0"
 tokio = { version = "1.25.0", features = ["macros"] }
--- a/axum-core/src/ext_traits/request.rs
+++ b/axum-core/src/ext_traits/request.rs
@@ -18,7 +18,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     async_trait,
     ///     extract::{Request, FromRequest},
@@ -81,7 +81,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     async_trait,
     ///     body::Body,
@@ -135,7 +135,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     async_trait,
     ///     extract::{Path, Request, FromRequest},
@@ -189,7 +189,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     async_trait,
     ///     extract::{Request, FromRef, FromRequest, FromRequestParts},
@@ -337,101 +337,3 @@
         self.with_limited_body().into_body()
     }
 }
-
-#[cfg(test)]
-mod tests {
-    use super::*;
-    use crate::{
-        ext_traits::tests::{RequiresState, State},
-        extract::FromRef,
-    };
-    use async_trait::async_trait;
-    use http::Method;
-
-    #[tokio::test]
-    async fn extract_without_state() {
-        let req = Request::new(Body::empty());
-
-        let method: Method = req.extract().await.unwrap();
-
-        assert_eq!(method, Method::GET);
-    }
-
-    #[tokio::test]
-    async fn extract_body_without_state() {
-        let req = Request::new(Body::from("foobar"));
-
-        let body: String = req.extract().await.unwrap();
-
-        assert_eq!(body, "foobar");
-    }
-
-    #[tokio::test]
-    async fn extract_with_state() {
-        let req = Request::new(Body::empty());
-
-        let state = "state".to_owned();
-
-        let State(extracted_state): State<String> = req.extract_with_state(&state).await.unwrap();
-
-        assert_eq!(extracted_state, state);
-    }
-
-    #[tokio::test]
-    async fn extract_parts_without_state() {
-        let mut req = Request::builder()
-            .header("x-foo", "foo")
-            .body(Body::empty())
-            .unwrap();
-
-        let method: Method = req.extract_parts().await.unwrap();
-
-        assert_eq!(method, Method::GET);
-        assert_eq!(req.headers()["x-foo"], "foo");
-    }
-
-    #[tokio::test]
-    async fn extract_parts_with_state() {
-        let mut req = Request::builder()
-            .header("x-foo", "foo")
-            .body(Body::empty())
-            .unwrap();
-
-        let state = "state".to_owned();
-
-        let State(extracted_state): State<String> =
-            req.extract_parts_with_state(&state).await.unwrap();
-
-        assert_eq!(extracted_state, state);
-        assert_eq!(req.headers()["x-foo"], "foo");
-    }
-
-    // this stuff just needs to compile
-    #[allow(dead_code)]
-    struct WorksForCustomExtractor {
-        method: Method,
-        from_state: String,
-        body: String,
-    }
-
-    #[async_trait]
-    impl<S> FromRequest<S> for WorksForCustomExtractor
-    where
-        S: Send + Sync,
-        String: FromRef<S> + FromRequest<()>,
-    {
-        type Rejection = <String as FromRequest<()>>::Rejection;
-
-        async fn from_request(mut req: Request, state: &S) -> Result<Self, Self::Rejection> {
-            let RequiresState(from_state) = req.extract_parts_with_state(state).await.unwrap();
-            let method = req.extract_parts().await.unwrap();
-            let body = req.extract().await?;
-
-            Ok(Self {
-                method,
-                from_state,
-                body,
-            })
-        }
-    }
-}
--- a/axum-core/src/ext_traits/request_parts.rs
+++ b/axum-core/src/ext_traits/request_parts.rs
@@ -15,7 +15,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     extract::{Query, Path, FromRequestParts},
     ///     response::{Response, IntoResponse},
@@ -64,7 +64,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     extract::{FromRef, FromRequestParts},
     ///     response::{Response, IntoResponse},
@@ -138,62 +138,3 @@
         E::from_request_parts(self, state)
     }
 }
-
-#[cfg(test)]
-mod tests {
-    use std::convert::Infallible;
-
-    use super::*;
-    use crate::{
-        ext_traits::tests::{RequiresState, State},
-        extract::FromRef,
-    };
-    use async_trait::async_trait;
-    use http::{Method, Request};
-
-    #[tokio::test]
-    async fn extract_without_state() {
-        let (mut parts, _) = Request::new(()).into_parts();
-
-        let method: Method = parts.extract().await.unwrap();
-
-        assert_eq!(method, Method::GET);
-    }
-
-    #[tokio::test]
-    async fn extract_with_state() {
-        let (mut parts, _) = Request::new(()).into_parts();
-
-        let state = "state".to_owned();
-
-        let State(extracted_state): State<String> = parts
-            .extract_with_state::<State<String>, String>(&state)
-            .await
-            .unwrap();
-
-        assert_eq!(extracted_state, state);
-    }
-
-    // this stuff just needs to compile
-    #[allow(dead_code)]
-    struct WorksForCustomExtractor {
-        method: Method,
-        from_state: String,
-    }
-
-    #[async_trait]
-    impl<S> FromRequestParts<S> for WorksForCustomExtractor
-    where
-        S: Send + Sync,
-        String: FromRef<S>,
-    {
-        type Rejection = Infallible;
-
-        async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
-            let RequiresState(from_state) = parts.extract_with_state(state).await?;
-            let method = parts.extract().await?;
-
-            Ok(Self { method, from_state })
-        }
-    }
-}
--- a/axum-core/src/extract/default_body_limit.rs
+++ b/axum-core/src/extract/default_body_limit.rs
@@ -24,7 +24,7 @@
 ///
 /// # Example
 ///
-/// ```
+/// ```ignore
 /// use axum::{
 ///     Router,
 ///     routing::post,
@@ -48,7 +48,7 @@
 /// `DefaultBodyLimit` can also be selectively applied to have different limits for different
 /// routes:
 ///
-/// ```
+/// ```ignore
 /// use axum::{
 ///     Router,
 ///     routing::post,
@@ -95,7 +95,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     Router,
     ///     routing::get,
@@ -130,7 +130,7 @@
     ///
     /// # Example
     ///
-    /// ```
+    /// ```ignore
     /// use axum::{
     ///     Router,
     ///     routing::get,
--- a/axum-core/src/response/append_headers.rs
+++ b/axum-core/src/response/append_headers.rs
@@ -7,7 +7,7 @@
 /// Returning something like `[("content-type", "foo=bar")]` from a handler will override any
 /// existing `content-type` headers. If instead you want to append headers, use `AppendHeaders`:
 ///
-/// ```rust
+/// ```ignore
 /// use axum::{
 ///     response::{AppendHeaders, IntoResponse},
 ///     http::header::SET_COOKIE,
--- a/axum-core/src/response/into_response.rs
+++ b/axum-core/src/response/into_response.rs
@@ -26,7 +26,7 @@
 /// However it might be necessary if you have a custom error type that you want
 /// to return from handlers:
 ///
-/// ```rust
+/// ```ignore
 /// use axum::{
 ///     Router,
 ///     body::{self, Bytes},
@@ -64,7 +64,7 @@
 /// Or if you have a custom body type you'll also need to implement
 /// `IntoResponse` for it:
 ///
-/// ```rust
+/// ```ignore
 /// use axum::{
 ///     body,
 ///     routing::get,
--- a/axum-core/src/response/into_response_parts.rs
+++ b/axum-core/src/response/into_response_parts.rs
@@ -9,7 +9,7 @@
 ///
 /// # Example
 ///
-/// ```rust
+/// ```ignore
 /// use axum::{
 ///     response::{ResponseParts, IntoResponse, IntoResponseParts, Response},
 ///     http::{StatusCode, header::{HeaderName, HeaderValue}},
--- a/axum-core/src/response/mod.rs
+++ b/axum-core/src/response/mod.rs
@@ -28,7 +28,7 @@
 ///
 /// # Example
 ///
-/// ```
+/// ```ignore
 /// use axum::{
 ///     response::{IntoResponse, Response},
 ///     http::StatusCode,
@@ -80,7 +80,7 @@
 ///
 /// Since `axum::response::Result` has a default error type you only have to specify the `Ok` type:
 ///
-/// ```
+/// ```ignore
 /// use axum::{
 ///     response::{IntoResponse, Response, Result},
 ///     http::StatusCode,
--- a/axum-macros/Cargo.toml
+++ b/axum-macros/Cargo.toml
@@ -1,4 +1,5 @@
 [package]
+exclude = ["tests/*"]
 categories = ["asynchronous", "network-programming", "web-programming"]
 description = "Macros for axum"
 edition = "2021"
@@ -29,8 +30,6 @@
 ] }
 
 [dev-dependencies]
-axum = { path = "../axum", version = "0.7.2", features = ["macros"] }
-axum-extra = { path = "../axum-extra", version = "0.9.0", features = ["typed-routing", "cookie-private", "typed-header"] }
 rustversion = "1.0"
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
--- a/axum-macros/src/lib.rs
+++ b/axum-macros/src/lib.rs
@@ -69,7 +69,7 @@
 ///
 /// By default `#[derive(FromRequest)]` will call `FromRequest::from_request` for each field:
 ///
-/// ```
+/// ```ignore
 /// use axum_macros::FromRequest;
 /// use axum::{
 ///     extract::Extension,
@@ -99,7 +99,7 @@
 ///
 /// Note that only the last field can consume the request body. Therefore this doesn't compile:
 ///
-/// ```compile_fail
+/// ```ignore
 /// use axum_macros::FromRequest;
 /// use axum::body::Bytes;
 ///
@@ -117,7 +117,7 @@
 /// You can use `#[from_request(via(...))]` to extract a field via another extractor, meaning the
 /// field itself doesn't need to implement `FromRequest`:
 ///
-/// ```
+/// ```ignore
 /// use axum_macros::FromRequest;
 /// use axum::{
 ///     extract::Extension,
@@ -163,7 +163,7 @@
 ///
 /// `#[from_request(via(...))]` supports `Option<_>` and `Result<_, _>` to make fields optional:
 ///
-/// ```
+/// ```ignore
 /// use axum_macros::FromRequest;
 /// use axum_extra::{
 ///     TypedHeader,
@@ -190,7 +190,7 @@
 /// By default [`axum::response::Response`] will be used as the rejection. You can also use your own
 /// rejection type with `#[from_request(rejection(YourType))]`:
 ///
-/// ```
+/// ```ignore
 /// use axum::{
 ///     extract::{
 ///         rejection::{ExtensionRejection, StringRejection},
@@ -238,7 +238,7 @@
 /// If the extraction can be done only for a concrete state, that type can be specified with
 /// `#[from_request(state(YourState))]`:
 ///
-/// ```
+/// ```ignore
 /// use axum::extract::{FromRequest, FromRequestParts};
 ///
 /// #[derive(Clone)]
@@ -269,7 +269,7 @@
 ///
 /// This is not needed for a `State<T>` as the type is inferred in that case.
 ///
-/// ```
+/// ```ignore
 /// use axum::extract::{FromRequest, FromRequestParts, State};
 ///
 /// #[derive(Clone)]
@@ -287,7 +287,7 @@
 /// By using `#[from_request(via(...))]` on the container you can extract the whole type at once,
 /// instead of each field individually:
 ///
-/// ```
+/// ```ignore
 /// use axum_macros::FromRequest;
 /// use axum::extract::Extension;
 ///
@@ -306,7 +306,7 @@
 ///
 /// You can use a different rejection type with `#[from_request(rejection(YourType))]`:
 ///
-/// ```
+/// ```ignore
 /// use axum_macros::FromRequest;
 /// use axum::{
 ///     extract::{Extension, rejection::ExtensionRejection},
@@ -353,7 +353,7 @@
 ///
 /// This allows you to wrap other extractors and easily customize the rejection:
 ///
-/// ```
+/// ```ignore
 /// use axum_macros::FromRequest;
 /// use axum::{
 ///     extract::{Extension, rejection::JsonRejection},
@@ -422,7 +422,7 @@
 ///
 /// # Example
 ///
-/// ```
+/// ```ignore
 /// use axum_macros::FromRequestParts;
 /// use axum::{
 ///     extract::Query,
@@ -468,7 +468,7 @@
 ///
 /// While using [`axum`], you can get long error messages for simple mistakes. For example:
 ///
-/// ```compile_fail
+/// ```ignore
 /// use axum::{routing::get, Router};
 ///
 /// #[tokio::main]
@@ -487,7 +487,7 @@
 /// You will get a long error message about function not implementing [`Handler`] trait. But why
 /// does this function not implement it? To figure it out, the [`debug_handler`] macro can be used.
 ///
-/// ```compile_fail
+/// ```ignore
 /// # use axum::{routing::get, Router};
 /// # use axum_macros::debug_handler;
 /// #
@@ -515,7 +515,7 @@
 ///
 /// As the error message says, handler function needs to be async.
 ///
-/// ```no_run
+/// ```ignore
 /// use axum::{routing::get, Router, debug_handler};
 ///
 /// #[tokio::main]
@@ -537,7 +537,7 @@
 /// By default `#[debug_handler]` assumes your state type is `()` unless your handler has a
 /// [`axum::extract::State`] argument:
 ///
-/// ```
+/// ```ignore
 /// use axum::{debug_handler, extract::State};
 ///
 /// #[debug_handler]
@@ -553,7 +553,7 @@
 /// If your handler takes multiple [`axum::extract::State`] arguments or you need to otherwise
 /// customize the state type you can set it with `#[debug_handler(state = ...)]`:
 ///
-/// ```
+/// ```ignore
 /// use axum::{debug_handler, extract::{State, FromRef}};
 ///
 /// #[debug_handler(state = AppState)]
@@ -628,7 +628,7 @@
 ///
 /// # Example
 ///
-/// ```no_run
+/// ```ignore
 /// use axum::{
 ///     routing::get,
 ///     extract::Request,
@@ -707,7 +707,7 @@
 ///
 /// # Example
 ///
-/// ```
+/// ```ignore
 /// use axum::{
 ///     Router,
 ///     routing::get,
