diff --git a/Cargo.toml b/Cargo.toml index cfbfb615..a9eeafcf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,6 @@ inefficient_to_string = "warn" linkedlist = "warn" lossy_float_literal = "warn" macro_use_imports = "warn" -match_on_vec_items = "warn" match_wildcard_for_single_variants = "warn" mem_forget = "warn" needless_borrow = "warn" diff --git a/axum-macros/src/from_request/mod.rs b/axum-macros/src/from_request/mod.rs index 145fdad3..38386365 100644 --- a/axum-macros/src/from_request/mod.rs +++ b/axum-macros/src/from_request/mod.rs @@ -775,10 +775,11 @@ fn impl_struct_by_extracting_all_at_once( .chain(via_marker_type) .collect::>(); - let ident_generics = generic_ident - .is_some() - .then(|| quote! { }) - .unwrap_or_default(); + let ident_generics = if generic_ident.is_some() { + quote! { } + } else { + TokenStream::new() + }; let rejection_bound = rejection.as_ref().map(|rejection| { match (tr, generic_ident.is_some()) { diff --git a/examples/http-proxy/src/main.rs b/examples/http-proxy/src/main.rs index 90aa5aa8..cf5ac15b 100644 --- a/examples/http-proxy/src/main.rs +++ b/examples/http-proxy/src/main.rs @@ -77,7 +77,7 @@ async fn main() { .with_upgrades() .await { - println!("Failed to serve connection: {:?}", err); + println!("Failed to serve connection: {err:?}"); } }); } diff --git a/examples/reverse-proxy/src/main.rs b/examples/reverse-proxy/src/main.rs index db391246..5f90019d 100644 --- a/examples/reverse-proxy/src/main.rs +++ b/examples/reverse-proxy/src/main.rs @@ -45,7 +45,7 @@ async fn handler(State(client): State, mut req: Request) -> Result) -> String { let host = host.into(); // Bind to localhost at the port 0, which will let the OS assign an available port to us - let listener = TcpListener::bind(format!("{}:0", host)).await.unwrap(); + let listener = TcpListener::bind(format!("{host}:0")).await.unwrap(); // Retrieve the port assigned to us by the OS let port = listener.local_addr().unwrap().port(); tokio::spawn(async { axum::serve(listener, app()).await.unwrap(); }); // Returns address (e.g. http://127.0.0.1{random_port}) - format!("http://{}:{}", host, port) + format!("http://{host}:{port}") } let listening_url = spawn_app("127.0.0.1").await; let mut event_stream = reqwest::Client::new() - .get(format!("{}/sse", listening_url)) + .get(format!("{listening_url}/sse")) .header("User-Agent", "integration_test") .send() .await diff --git a/examples/unix-domain-socket/src/main.rs b/examples/unix-domain-socket/src/main.rs index 07b38d91..4990ee97 100644 --- a/examples/unix-domain-socket/src/main.rs +++ b/examples/unix-domain-socket/src/main.rs @@ -59,7 +59,7 @@ mod unix { let (mut sender, conn) = hyper::client::conn::http1::handshake(stream).await.unwrap(); tokio::task::spawn(async move { if let Err(err) = conn.await { - println!("Connection failed: {:?}", err); + println!("Connection failed: {err:?}"); } }); @@ -79,7 +79,7 @@ mod unix { } async fn handler(ConnectInfo(info): ConnectInfo) -> &'static str { - println!("new connection from `{:?}`", info); + println!("new connection from `{info:?}`"); "Hello, World!" } diff --git a/examples/websockets/src/client.rs b/examples/websockets/src/client.rs index a3034131..14ed4527 100644 --- a/examples/websockets/src/client.rs +++ b/examples/websockets/src/client.rs @@ -129,13 +129,13 @@ fn process_message(msg: Message, who: usize) -> ControlFlow<(), ()> { println!(">>> {who} got str: {t:?}"); } Message::Binary(d) => { - println!(">>> {} got {} bytes: {:?}", who, d.len(), d); + println!(">>> {who} got {} bytes: {d:?}", d.len()); } Message::Close(c) => { if let Some(cf) = c { println!( - ">>> {} got close with code {} and reason `{}`", - who, cf.code, cf.reason + ">>> {who} got close with code {} and reason `{}`", + cf.code, cf.reason ); } else { println!(">>> {who} somehow got close message without CloseFrame"); diff --git a/examples/websockets/src/main.rs b/examples/websockets/src/main.rs index 18e8ee32..1bb7cadf 100644 --- a/examples/websockets/src/main.rs +++ b/examples/websockets/src/main.rs @@ -220,13 +220,13 @@ fn process_message(msg: Message, who: SocketAddr) -> ControlFlow<(), ()> { println!(">>> {who} sent str: {t:?}"); } Message::Binary(d) => { - println!(">>> {} sent {} bytes: {:?}", who, d.len(), d); + println!(">>> {who} sent {} bytes: {d:?}", d.len()); } Message::Close(c) => { if let Some(cf) = c { println!( - ">>> {} sent close with code {} and reason `{}`", - who, cf.code, cf.reason + ">>> {who} sent close with code {} and reason `{}`", + cf.code, cf.reason ); } else { println!(">>> {who} somehow sent close message without CloseFrame");