diff options
Diffstat (limited to 'axum-macros/tests')
11 files changed, 35 insertions, 34 deletions
diff --git a/axum-macros/tests/debug_handler/fail/extract_self_mut.rs b/axum-macros/tests/debug_handler/fail/extract_self_mut.rs index 21ae99d6..eb17c1df 100644 --- a/axum-macros/tests/debug_handler/fail/extract_self_mut.rs +++ b/axum-macros/tests/debug_handler/fail/extract_self_mut.rs @@ -1,12 +1,8 @@ -use axum::{ - async_trait, - extract::{Request, FromRequest}, -}; +use axum::extract::{FromRequest, Request}; use axum_macros::debug_handler; struct A; -#[async_trait] impl<S> FromRequest<S> for A where S: Send + Sync, diff --git a/axum-macros/tests/debug_handler/fail/extract_self_mut.stderr b/axum-macros/tests/debug_handler/fail/extract_self_mut.stderr index 595786bf..0610a22a 100644 --- a/axum-macros/tests/debug_handler/fail/extract_self_mut.stderr +++ b/axum-macros/tests/debug_handler/fail/extract_self_mut.stderr @@ -1,5 +1,5 @@ error: Handlers must only take owned values - --> tests/debug_handler/fail/extract_self_mut.rs:23:22 + --> tests/debug_handler/fail/extract_self_mut.rs:19:22 | -23 | async fn handler(&mut self) {} +19 | async fn handler(&mut self) {} | ^^^^^^^^^ diff --git a/axum-macros/tests/debug_handler/fail/extract_self_ref.rs b/axum-macros/tests/debug_handler/fail/extract_self_ref.rs index 8e328119..d70c5f23 100644 --- a/axum-macros/tests/debug_handler/fail/extract_self_ref.rs +++ b/axum-macros/tests/debug_handler/fail/extract_self_ref.rs @@ -1,12 +1,8 @@ -use axum::{ - async_trait, - extract::{Request, FromRequest}, -}; +use axum::extract::{FromRequest, Request}; use axum_macros::debug_handler; struct A; -#[async_trait] impl<S> FromRequest<S> for A where S: Send + Sync, diff --git a/axum-macros/tests/debug_handler/fail/extract_self_ref.stderr b/axum-macros/tests/debug_handler/fail/extract_self_ref.stderr index 4c0b4950..d475c509 100644 --- a/axum-macros/tests/debug_handler/fail/extract_self_ref.stderr +++ b/axum-macros/tests/debug_handler/fail/extract_self_ref.stderr @@ -1,5 +1,5 @@ error: Handlers must only take owned values - --> tests/debug_handler/fail/extract_self_ref.rs:23:22 + --> tests/debug_handler/fail/extract_self_ref.rs:19:22 | -23 | async fn handler(&self) {} +19 | async fn handler(&self) {} | ^^^^^ diff --git a/axum-macros/tests/debug_handler/pass/result_impl_into_response.rs b/axum-macros/tests/debug_handler/pass/result_impl_into_response.rs index 782fc930..f23c9b62 100644 --- a/axum-macros/tests/debug_handler/pass/result_impl_into_response.rs +++ b/axum-macros/tests/debug_handler/pass/result_impl_into_response.rs @@ -1,4 +1,4 @@ -use axum::{async_trait, extract::FromRequestParts, http::request::Parts, response::IntoResponse}; +use axum::{extract::FromRequestParts, http::request::Parts, response::IntoResponse}; use axum_macros::debug_handler; fn main() {} @@ -115,7 +115,6 @@ impl A { } } -#[async_trait] impl<S> FromRequestParts<S> for A where S: Send + Sync, diff --git a/axum-macros/tests/debug_handler/pass/self_receiver.rs b/axum-macros/tests/debug_handler/pass/self_receiver.rs index 9b722845..3fbcc4e0 100644 --- a/axum-macros/tests/debug_handler/pass/self_receiver.rs +++ b/axum-macros/tests/debug_handler/pass/self_receiver.rs @@ -1,12 +1,8 @@ -use axum::{ - async_trait, - extract::{Request, FromRequest}, -}; +use axum::extract::{FromRequest, Request}; use axum_macros::debug_handler; struct A; -#[async_trait] impl<S> FromRequest<S> for A where S: Send + Sync, @@ -18,7 +14,6 @@ where } } -#[async_trait] impl<S> FromRequest<S> for Box<A> where S: Send + Sync, diff --git a/axum-macros/tests/debug_handler/pass/set_state.rs b/axum-macros/tests/debug_handler/pass/set_state.rs index 60a7a330..72bba5ae 100644 --- a/axum-macros/tests/debug_handler/pass/set_state.rs +++ b/axum-macros/tests/debug_handler/pass/set_state.rs @@ -1,6 +1,5 @@ +use axum::extract::{FromRef, FromRequest, Request}; use axum_macros::debug_handler; -use axum::extract::{Request, FromRef, FromRequest}; -use axum::async_trait; #[debug_handler(state = AppState)] async fn handler(_: A) {} @@ -10,7 +9,6 @@ struct AppState; struct A; -#[async_trait] impl<S> FromRequest<S> for A where S: Send + Sync, 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 d732f2cb..d2401803 100644 --- a/axum-macros/tests/from_request/fail/parts_extracting_body.stderr +++ b/axum-macros/tests/from_request/fail/parts_extracting_body.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `String: FromRequestParts<S>` is not satisfied +error[E0277]: the trait bound `String: FromRequestParts<_>` is not satisfied --> tests/from_request/fail/parts_extracting_body.rs:5:11 | 5 | body: String, - | ^^^^^^ the trait `FromRequestParts<S>` is not implemented for `String` + | ^^^^^^ the trait `FromRequestParts<_>` is not implemented for `String` | = note: Function argument is not a valid axum extractor. See `https://docs.rs/axum/0.7/axum/extract/index.html` for details diff --git a/axum-macros/tests/from_request/pass/override_rejection.rs b/axum-macros/tests/from_request/pass/override_rejection.rs index 25e399b4..736006ed 100644 --- a/axum-macros/tests/from_request/pass/override_rejection.rs +++ b/axum-macros/tests/from_request/pass/override_rejection.rs @@ -1,6 +1,6 @@ use axum::{ - async_trait, - extract::{Request, rejection::ExtensionRejection, FromRequest}, + body::Body, + extract::{rejection::ExtensionRejection, FromRequest, Request}, http::StatusCode, response::{IntoResponse, Response}, routing::get, @@ -26,7 +26,6 @@ struct MyExtractor { struct OtherExtractor; -#[async_trait] impl<S> FromRequest<S> for OtherExtractor where S: Send + Sync, diff --git a/axum-macros/tests/from_request/pass/override_rejection_parts.rs b/axum-macros/tests/from_request/pass/override_rejection_parts.rs index 8ef9cb22..7cc27de2 100644 --- a/axum-macros/tests/from_request/pass/override_rejection_parts.rs +++ b/axum-macros/tests/from_request/pass/override_rejection_parts.rs @@ -1,5 +1,4 @@ use axum::{ - async_trait, extract::{rejection::ExtensionRejection, FromRequestParts}, http::{request::Parts, StatusCode}, response::{IntoResponse, Response}, @@ -26,7 +25,6 @@ struct MyExtractor { struct OtherExtractor; -#[async_trait] impl<S> FromRequestParts<S> for OtherExtractor where S: Send + Sync, diff --git a/axum-macros/tests/typed_path/fail/not_deserialize.stderr b/axum-macros/tests/typed_path/fail/not_deserialize.stderr index c3a46d28..ed2c9d75 100644 --- a/axum-macros/tests/typed_path/fail/not_deserialize.stderr +++ b/axum-macros/tests/typed_path/fail/not_deserialize.stderr @@ -1,3 +1,24 @@ +error[E0277]: the trait bound `for<'de> MyPath: serde::de::Deserialize<'de>` is not satisfied + --> tests/typed_path/fail/not_deserialize.rs:3:10 + | +3 | #[derive(TypedPath)] + | ^^^^^^^^^ the trait `for<'de> serde::de::Deserialize<'de>` is not implemented for `MyPath`, which is required by `axum::extract::Path<MyPath>: FromRequestParts<S>` + | + = note: for local types consider adding `#[derive(serde::Deserialize)]` to your `MyPath` type + = note: for types from other crates check whether the crate offers a `serde` feature flag + = help: the following other types implement trait `serde::de::Deserialize<'de>`: + &'a [u8] + &'a serde_json::raw::RawValue + &'a std::path::Path + &'a str + () + (T,) + (T0, T1) + (T0, T1, T2) + and $N others + = note: required for `MyPath` to implement `serde::de::DeserializeOwned` + = note: required for `axum::extract::Path<MyPath>` to implement `FromRequestParts<S>` + error[E0277]: the trait bound `MyPath: serde::de::DeserializeOwned` is not satisfied --> tests/typed_path/fail/not_deserialize.rs:3:10 | @@ -16,7 +37,6 @@ error[E0277]: the trait bound `MyPath: serde::de::DeserializeOwned` is not satis and $N others = note: required for `MyPath` to implement `serde::de::DeserializeOwned` = note: required for `axum::extract::Path<MyPath>` to implement `FromRequestParts<S>` - = note: this error originates in the derive macro `TypedPath` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `MyPath: serde::de::DeserializeOwned` is not satisfied --> tests/typed_path/fail/not_deserialize.rs:3:10 @@ -36,4 +56,4 @@ error[E0277]: the trait bound `MyPath: serde::de::DeserializeOwned` is not satis and $N others = note: required for `MyPath` to implement `serde::de::DeserializeOwned` = note: required for `axum::extract::Path<MyPath>` to implement `FromRequestParts<S>` - = note: this error originates in the attribute macro `::axum::async_trait` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `TypedPath` (in Nightly builds, run with -Z macro-backtrace for more info) |