mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
Re-format trybuild tests (#3049)
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
use axum::{
|
||||
body::Bytes,
|
||||
http::{Method, Uri},
|
||||
Json,
|
||||
};
|
||||
use axum_macros::debug_handler;
|
||||
use axum::{Json, body::Bytes, http::{Method, Uri}};
|
||||
|
||||
#[debug_handler]
|
||||
async fn one(_: Json<()>, _: String, _: Uri) {}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
error: Can't have two extractors that consume the request body. `Json<_>` and `String` both do that.
|
||||
--> tests/debug_handler/fail/multiple_request_consumers.rs:5:14
|
||||
--> tests/debug_handler/fail/multiple_request_consumers.rs:9:14
|
||||
|
|
||||
5 | async fn one(_: Json<()>, _: String, _: Uri) {}
|
||||
9 | async fn one(_: Json<()>, _: String, _: Uri) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Can't have more than one extractor that consume the request body. `Json<_>`, `Bytes`, and `String` all do that.
|
||||
--> tests/debug_handler/fail/multiple_request_consumers.rs:8:14
|
||||
|
|
||||
8 | async fn two(_: Json<()>, _: Method, _: Bytes, _: Uri, _: String) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
--> tests/debug_handler/fail/multiple_request_consumers.rs:12:14
|
||||
|
|
||||
12 | async fn two(_: Json<()>, _: Method, _: Bytes, _: Uri, _: String) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use axum::response::AppendHeaders;
|
||||
|
||||
#[axum::debug_handler]
|
||||
async fn handler(
|
||||
) -> (
|
||||
async fn handler() -> (
|
||||
axum::http::StatusCode,
|
||||
AppendHeaders<[(axum::http::HeaderName, &'static str); 1]>,
|
||||
AppendHeaders<[(axum::http::HeaderName, &'static str); 1]>,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
error: Cannot return tuples with more than 17 elements
|
||||
--> tests/debug_handler/fail/output_tuple_too_many.rs:5:3
|
||||
--> tests/debug_handler/fail/output_tuple_too_many.rs:4:20
|
||||
|
|
||||
5 | ) -> (
|
||||
| ___^
|
||||
6 | | axum::http::StatusCode,
|
||||
4 | async fn handler() -> (
|
||||
| ____________________^
|
||||
5 | | axum::http::StatusCode,
|
||||
6 | | AppendHeaders<[(axum::http::HeaderName, &'static str); 1]>,
|
||||
7 | | AppendHeaders<[(axum::http::HeaderName, &'static str); 1]>,
|
||||
8 | | AppendHeaders<[(axum::http::HeaderName, &'static str); 1]>,
|
||||
... |
|
||||
24 | | axum::http::StatusCode,
|
||||
25 | | ) {
|
||||
23 | | axum::http::StatusCode,
|
||||
24 | | ) {
|
||||
| |_^
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#[axum::debug_handler]
|
||||
async fn handler(
|
||||
) -> (
|
||||
async fn handler() -> (
|
||||
axum::http::request::Parts, // this should be response parts, not request parts
|
||||
axum::http::StatusCode,
|
||||
) {
|
||||
panic!()
|
||||
}
|
||||
|
||||
fn main(){}
|
||||
fn main() {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
error[E0308]: mismatched types
|
||||
--> tests/debug_handler/fail/returning_request_parts.rs:4:5
|
||||
--> tests/debug_handler/fail/returning_request_parts.rs:3:5
|
||||
|
|
||||
4 | axum::http::request::Parts, // this should be response parts, not request parts
|
||||
3 | axum::http::request::Parts, // this should be response parts, not request parts
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected `axum::http::response::Parts`, found `axum::http::request::Parts`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use axum_macros::debug_handler;
|
||||
use axum::http::Uri;
|
||||
use axum_macros::debug_handler;
|
||||
|
||||
#[debug_handler]
|
||||
async fn handler(
|
||||
@@ -20,6 +20,7 @@ async fn handler(
|
||||
_e15: Uri,
|
||||
_e16: Uri,
|
||||
_e17: Uri,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use axum::{http::Uri, Json};
|
||||
use axum_macros::debug_handler;
|
||||
use axum::{Json, http::Uri};
|
||||
|
||||
#[debug_handler]
|
||||
async fn one(_: Json<()>, _: Uri) {}
|
||||
|
||||
@@ -4,16 +4,13 @@
|
||||
async fn named_type() -> (
|
||||
axum::http::StatusCode,
|
||||
axum::Json<&'static str>,
|
||||
axum::response::AppendHeaders<[( axum::http::HeaderName,&'static str); 1]>,
|
||||
axum::response::AppendHeaders<[(axum::http::HeaderName, &'static str); 1]>,
|
||||
) {
|
||||
panic!()
|
||||
}
|
||||
|
||||
|
||||
struct CustomIntoResponse{
|
||||
|
||||
}
|
||||
impl axum::response::IntoResponse for CustomIntoResponse{
|
||||
struct CustomIntoResponse {}
|
||||
impl axum::response::IntoResponse for CustomIntoResponse {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
todo!()
|
||||
}
|
||||
@@ -22,7 +19,7 @@ impl axum::response::IntoResponse for CustomIntoResponse{
|
||||
async fn custom_type() -> (
|
||||
axum::http::StatusCode,
|
||||
CustomIntoResponse,
|
||||
axum::response::AppendHeaders<[( axum::http::HeaderName,&'static str); 1]>,
|
||||
axum::response::AppendHeaders<[(axum::http::HeaderName, &'static str); 1]>,
|
||||
) {
|
||||
panic!()
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ error: `Json<_>` must be the last element in a response tuple
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `CustomIntoResponse: IntoResponseParts` is not satisfied
|
||||
--> tests/debug_handler/fail/wrong_return_tuple.rs:24:5
|
||||
--> tests/debug_handler/fail/wrong_return_tuple.rs:21:5
|
||||
|
|
||||
24 | CustomIntoResponse,
|
||||
21 | CustomIntoResponse,
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `IntoResponseParts` is not implemented for `CustomIntoResponse`
|
||||
|
|
||||
= help: the following other types implement trait `IntoResponseParts`:
|
||||
@@ -27,9 +27,9 @@ help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `CustomIntoResponse: IntoResponseParts` is not satisfied
|
||||
--> tests/debug_handler/fail/wrong_return_tuple.rs:24:5
|
||||
--> tests/debug_handler/fail/wrong_return_tuple.rs:21:5
|
||||
|
|
||||
24 | CustomIntoResponse,
|
||||
21 | CustomIntoResponse,
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `IntoResponseParts` is not implemented for `CustomIntoResponse`
|
||||
|
|
||||
= help: the following other types implement trait `IntoResponseParts`:
|
||||
@@ -43,7 +43,7 @@ error[E0277]: the trait bound `CustomIntoResponse: IntoResponseParts` is not sat
|
||||
(T1, T2, T3, T4, T5, T6, T7, T8)
|
||||
and $N others
|
||||
note: required by a bound in `__axum_macros_check_custom_type_into_response_parts_1_check`
|
||||
--> tests/debug_handler/fail/wrong_return_tuple.rs:24:5
|
||||
--> tests/debug_handler/fail/wrong_return_tuple.rs:21:5
|
||||
|
|
||||
24 | CustomIntoResponse,
|
||||
21 | CustomIntoResponse,
|
||||
| ^^^^^^^^^^^^^^^^^^ required by this bound in `__axum_macros_check_custom_type_into_response_parts_1_check`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use axum_macros::debug_handler;
|
||||
use axum::response::IntoResponse;
|
||||
use axum_macros::debug_handler;
|
||||
|
||||
#[debug_handler]
|
||||
async fn handler() -> impl IntoResponse {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use axum_macros::debug_handler;
|
||||
use axum::extract::State;
|
||||
use axum_macros::debug_handler;
|
||||
|
||||
#[debug_handler]
|
||||
async fn handler(_: State<AppState>) {}
|
||||
@@ -8,22 +8,13 @@ async fn handler(_: State<AppState>) {}
|
||||
async fn handler_2(_: axum::extract::State<AppState>) {}
|
||||
|
||||
#[debug_handler]
|
||||
async fn handler_3(
|
||||
_: axum::extract::State<AppState>,
|
||||
_: axum::extract::State<AppState>,
|
||||
) {}
|
||||
async fn handler_3(_: axum::extract::State<AppState>, _: axum::extract::State<AppState>) {}
|
||||
|
||||
#[debug_handler]
|
||||
async fn handler_4(
|
||||
_: State<AppState>,
|
||||
_: State<AppState>,
|
||||
) {}
|
||||
async fn handler_4(_: State<AppState>, _: State<AppState>) {}
|
||||
|
||||
#[debug_handler]
|
||||
async fn handler_5(
|
||||
_: axum::extract::State<AppState>,
|
||||
_: State<AppState>,
|
||||
) {}
|
||||
async fn handler_5(_: axum::extract::State<AppState>, _: State<AppState>) {}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct AppState;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use axum_macros::debug_handler;
|
||||
use axum::http::{Method, Uri};
|
||||
use axum_macros::debug_handler;
|
||||
|
||||
#[debug_handler]
|
||||
async fn handler(_one: Method, _two: Uri, _three: String) {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use axum_macros::debug_handler;
|
||||
use std::future::{Ready, ready};
|
||||
use std::future::{ready, Ready};
|
||||
|
||||
#[debug_handler]
|
||||
fn handler() -> Ready<()> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use axum::{extract::Request, extract::State};
|
||||
use axum_macros::debug_handler;
|
||||
use axum::{extract::State, extract::Request};
|
||||
|
||||
#[debug_handler(state = AppState)]
|
||||
async fn handler(_: State<AppState>, _: Request) {}
|
||||
|
||||
Reference in New Issue
Block a user