From c100650464e96cc9b48a37290760f288d6311ed8 Mon Sep 17 00:00:00 2001
From: Mikhail Antoshkin <51194616+mikhailantoshkin@users.noreply.github.com>
Date: Thu, 16 Nov 2023 16:15:16 +0900
Subject: [PATCH] Fix items-after-test-module clippy warning on 1.75.0-beta.1
 (#2318)

---
 axum-core/src/macros.rs                       | 80 +++++++++----------
 .../fail/argument_not_extractor.stderr        |  2 +-
 .../fail/parts_extracting_body.stderr         |  2 +-
 3 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/axum-core/src/macros.rs b/axum-core/src/macros.rs
index 1a573c2106..3fa61576be 100644
--- a/axum-core/src/macros.rs
+++ b/axum-core/src/macros.rs
@@ -211,46 +211,6 @@ macro_rules! __composite_rejection {
     };
 }
 
-#[cfg(test)]
-mod composite_rejection_tests {
-    use self::defs::*;
-    use crate::Error;
-    use std::error::Error as _;
-
-    #[allow(dead_code, unreachable_pub)]
-    mod defs {
-        use crate::{__composite_rejection, __define_rejection};
-
-        __define_rejection! {
-            #[status = BAD_REQUEST]
-            #[body = "error message 1"]
-            pub struct Inner1;
-        }
-        __define_rejection! {
-            #[status = BAD_REQUEST]
-            #[body = "error message 2"]
-            pub struct Inner2(Error);
-        }
-        __composite_rejection! {
-            pub enum Outer { Inner1, Inner2 }
-        }
-    }
-
-    /// The implementation of `.source()` on `Outer` should defer straight to the implementation
-    /// on its inner type instead of returning the inner type itself, because the `Display`
-    /// implementation on `Outer` already forwards to the inner type and so it would result in two
-    /// errors in the chain `Display`ing the same thing.
-    #[test]
-    fn source_gives_inner_source() {
-        let rejection = Outer::Inner1(Inner1);
-        assert!(rejection.source().is_none());
-
-        let msg = "hello world";
-        let rejection = Outer::Inner2(Inner2(Error::new(msg)));
-        assert_eq!(rejection.source().unwrap().to_string(), msg);
-    }
-}
-
 #[rustfmt::skip]
 macro_rules! all_the_tuples {
     ($name:ident) => {
@@ -334,3 +294,43 @@ macro_rules! __impl_deref {
         }
     };
 }
+
+#[cfg(test)]
+mod composite_rejection_tests {
+    use self::defs::*;
+    use crate::Error;
+    use std::error::Error as _;
+
+    #[allow(dead_code, unreachable_pub)]
+    mod defs {
+        use crate::{__composite_rejection, __define_rejection};
+
+        __define_rejection! {
+            #[status = BAD_REQUEST]
+            #[body = "error message 1"]
+            pub struct Inner1;
+        }
+        __define_rejection! {
+            #[status = BAD_REQUEST]
+            #[body = "error message 2"]
+            pub struct Inner2(Error);
+        }
+        __composite_rejection! {
+            pub enum Outer { Inner1, Inner2 }
+        }
+    }
+
+    /// The implementation of `.source()` on `Outer` should defer straight to the implementation
+    /// on its inner type instead of returning the inner type itself, because the `Display`
+    /// implementation on `Outer` already forwards to the inner type and so it would result in two
+    /// errors in the chain `Display`ing the same thing.
+    #[test]
+    fn source_gives_inner_source() {
+        let rejection = Outer::Inner1(Inner1);
+        assert!(rejection.source().is_none());
+
+        let msg = "hello world";
+        let rejection = Outer::Inner2(Inner2(Error::new(msg)));
+        assert_eq!(rejection.source().unwrap().to_string(), msg);
+    }
+}
diff --git a/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr b/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr
index 0eb6e72c9a..83b418bfdd 100644
--- a/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr
+++ b/axum-macros/tests/debug_handler/fail/argument_not_extractor.stderr
@@ -11,8 +11,8 @@ error[E0277]: the trait bound `bool: FromRequestParts<()>` is not satisfied
             <Extension<T> as FromRequestParts<S>>
             <Method as FromRequestParts<S>>
             <Uri as FromRequestParts<S>>
-            <Version as FromRequestParts<S>>
             <ConnectInfo<T> as FromRequestParts<S>>
+            <Version as FromRequestParts<S>>
             <axum::extract::Path<T> as FromRequestParts<S>>
             <RawPathParams as FromRequestParts<S>>
           and $N others
diff --git a/axum-macros/tests/from_request/fail/parts_extracting_body.stderr b/axum-macros/tests/from_request/fail/parts_extracting_body.stderr
index 71a2deda33..4313d57cd9 100644
--- a/axum-macros/tests/from_request/fail/parts_extracting_body.stderr
+++ b/axum-macros/tests/from_request/fail/parts_extracting_body.stderr
@@ -12,7 +12,7 @@ error[E0277]: the trait bound `String: FromRequestParts<S>` is not satisfied
             <Extension<T> as FromRequestParts<S>>
             <Method as FromRequestParts<S>>
             <Uri as FromRequestParts<S>>
-            <Version as FromRequestParts<S>>
             <ConnectInfo<T> as FromRequestParts<S>>
+            <Version as FromRequestParts<S>>
             <axum::extract::Path<T> as FromRequestParts<S>>
           and $N others