mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
Fix misc warnings from CI (#620)
This commit is contained in:
@@ -744,6 +744,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_error_at_key_error() {
|
fn test_parse_error_at_key_error() {
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
#[allow(dead_code)]
|
||||||
struct Params {
|
struct Params {
|
||||||
a: u32,
|
a: u32,
|
||||||
}
|
}
|
||||||
@@ -761,6 +762,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_parse_error_at_key_error_multiple() {
|
fn test_parse_error_at_key_error_multiple() {
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
#[allow(dead_code)]
|
||||||
struct Params {
|
struct Params {
|
||||||
a: u32,
|
a: u32,
|
||||||
b: u32,
|
b: u32,
|
||||||
|
|||||||
@@ -122,12 +122,7 @@ impl QueryRoot {
|
|||||||
first: Option<i32>,
|
first: Option<i32>,
|
||||||
last: Option<i32>,
|
last: Option<i32>,
|
||||||
) -> FieldResult<Connection<usize, Human, EmptyFields, EmptyFields>> {
|
) -> FieldResult<Connection<usize, Human, EmptyFields, EmptyFields>> {
|
||||||
let humans = ctx
|
let humans = ctx.data_unchecked::<StarWars>().humans().to_vec();
|
||||||
.data_unchecked::<StarWars>()
|
|
||||||
.humans()
|
|
||||||
.iter()
|
|
||||||
.copied()
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
query_characters(after, before, first, last, &humans)
|
query_characters(after, before, first, last, &humans)
|
||||||
.await
|
.await
|
||||||
.map(|conn| conn.map_node(Human))
|
.map(|conn| conn.map_node(Human))
|
||||||
@@ -149,12 +144,7 @@ impl QueryRoot {
|
|||||||
first: Option<i32>,
|
first: Option<i32>,
|
||||||
last: Option<i32>,
|
last: Option<i32>,
|
||||||
) -> FieldResult<Connection<usize, Droid, EmptyFields, EmptyFields>> {
|
) -> FieldResult<Connection<usize, Droid, EmptyFields, EmptyFields>> {
|
||||||
let droids = ctx
|
let droids = ctx.data_unchecked::<StarWars>().droids().to_vec();
|
||||||
.data_unchecked::<StarWars>()
|
|
||||||
.droids()
|
|
||||||
.iter()
|
|
||||||
.copied()
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
query_characters(after, before, first, last, &droids)
|
query_characters(after, before, first, last, &droids)
|
||||||
.await
|
.await
|
||||||
.map(|conn| conn.map_node(Droid))
|
.map(|conn| conn.map_node(Droid))
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ impl IntoResponse for ServerError {
|
|||||||
fn into_response(self) -> Response {
|
fn into_response(self) -> Response {
|
||||||
match self {
|
match self {
|
||||||
ServerError::ValidationError(_) => {
|
ServerError::ValidationError(_) => {
|
||||||
let message = format!("Input validation error: [{}]", self).replace("\n", ", ");
|
let message = format!("Input validation error: [{}]", self).replace('\n', ", ");
|
||||||
(StatusCode::BAD_REQUEST, message)
|
(StatusCode::BAD_REQUEST, message)
|
||||||
}
|
}
|
||||||
ServerError::AxumFormRejection(_) => (StatusCode::BAD_REQUEST, self.to_string()),
|
ServerError::AxumFormRejection(_) => (StatusCode::BAD_REQUEST, self.to_string()),
|
||||||
|
|||||||
Reference in New Issue
Block a user