mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Use nightly clippy & rustfmt for more style checks (#487)
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
mod starwars;
|
||||
|
||||
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
|
||||
use async_graphql::{EmptyMutation, EmptySubscription, Request, Response, Schema};
|
||||
use axum::response::IntoResponse;
|
||||
use axum::{extract::Extension, response::Html, routing::get, AddExtensionLayer, Json, Router};
|
||||
use async_graphql::{
|
||||
http::{playground_source, GraphQLPlaygroundConfig},
|
||||
EmptyMutation, EmptySubscription, Request, Response, Schema,
|
||||
};
|
||||
use axum::{
|
||||
extract::Extension,
|
||||
response::{Html, IntoResponse},
|
||||
routing::get,
|
||||
AddExtensionLayer, Json, Router,
|
||||
};
|
||||
use starwars::{QueryRoot, StarWars, StarWarsSchema};
|
||||
|
||||
async fn graphql_handler(schema: Extension<StarWarsSchema>, req: Json<Request>) -> Json<Response> {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::StarWars;
|
||||
use async_graphql::connection::{query, Connection, Edge, EmptyFields};
|
||||
use async_graphql::{Context, Enum, FieldResult, Interface, Object};
|
||||
use async_graphql::{
|
||||
connection::{query, Connection, Edge, EmptyFields},
|
||||
Context, Enum, FieldResult, Interface, Object,
|
||||
};
|
||||
|
||||
/// One of the films in the Star Wars Trilogy
|
||||
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
use axum::{
|
||||
async_trait,
|
||||
extract::rejection::JsonRejection,
|
||||
extract::{FromRequest, RequestParts},
|
||||
extract::{rejection::JsonRejection, FromRequest, RequestParts},
|
||||
http::StatusCode,
|
||||
routing::post,
|
||||
BoxError, Router,
|
||||
|
||||
@@ -148,6 +148,7 @@ async fn logout(
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
struct AuthRequest {
|
||||
code: String,
|
||||
state: String,
|
||||
|
||||
@@ -31,6 +31,7 @@ async fn handler(Query(params): Query<Params>) -> String {
|
||||
///
|
||||
/// [`serde_with`]: https://docs.rs/serde_with/1.11.0/serde_with/rust/string_empty_as_none/index.html
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
struct Params {
|
||||
#[serde(default, deserialize_with = "empty_string_as_none")]
|
||||
foo: Option<String>,
|
||||
|
||||
@@ -47,8 +47,10 @@ fn app() -> Router {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use axum::body::Body;
|
||||
use axum::http::{self, Request, StatusCode};
|
||||
use axum::{
|
||||
body::Body,
|
||||
http::{self, Request, StatusCode},
|
||||
};
|
||||
use serde_json::{json, Value};
|
||||
use std::net::{SocketAddr, TcpListener};
|
||||
use tower::ServiceExt; // for `app.oneshot()`
|
||||
|
||||
@@ -23,10 +23,9 @@ use std::{
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
use tokio::net::{unix::UCred, UnixListener};
|
||||
use tokio::{
|
||||
io::{AsyncRead, AsyncWrite},
|
||||
net::UnixStream,
|
||||
net::{unix::UCred, UnixListener, UnixStream},
|
||||
};
|
||||
use tower::BoxError;
|
||||
|
||||
@@ -150,6 +149,7 @@ impl Connection for ClientConnection {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[allow(dead_code)]
|
||||
struct UdsConnectInfo {
|
||||
peer_addr: Arc<tokio::net::unix::SocketAddr>,
|
||||
peer_cred: UCred,
|
||||
|
||||
@@ -13,8 +13,7 @@ use axum::{
|
||||
routing::get,
|
||||
Router,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::net::SocketAddr;
|
||||
use std::{collections::HashMap, net::SocketAddr};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
||||
Reference in New Issue
Block a user