Make clippy happy (#3350)

This commit is contained in:
Jonas Platte 2025-05-13 09:58:45 +02:00
parent abe98474e1
commit 01ecea0e33
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
8 changed files with 18 additions and 18 deletions

View File

@ -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"

View File

@ -775,10 +775,11 @@ fn impl_struct_by_extracting_all_at_once(
.chain(via_marker_type)
.collect::<Punctuated<Type, Token![,]>>();
let ident_generics = generic_ident
.is_some()
.then(|| quote! { <T> })
.unwrap_or_default();
let ident_generics = if generic_ident.is_some() {
quote! { <T> }
} else {
TokenStream::new()
};
let rejection_bound = rejection.as_ref().map(|rejection| {
match (tr, generic_ident.is_some()) {

View File

@ -77,7 +77,7 @@ async fn main() {
.with_upgrades()
.await
{
println!("Failed to serve connection: {:?}", err);
println!("Failed to serve connection: {err:?}");
}
});
}

View File

@ -45,7 +45,7 @@ async fn handler(State(client): State<Client>, mut req: Request) -> Result<Respo
.map(|v| v.as_str())
.unwrap_or(path);
let uri = format!("http://127.0.0.1:3000{}", path_query);
let uri = format!("http://127.0.0.1:3000{path_query}");
*req.uri_mut() = Uri::try_from(uri).unwrap();

View File

@ -85,19 +85,19 @@ mod tests {
async fn spawn_app(host: impl Into<String>) -> 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

View File

@ -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<UdsConnectInfo>) -> &'static str {
println!("new connection from `{:?}`", info);
println!("new connection from `{info:?}`");
"Hello, World!"
}

View File

@ -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");

View File

@ -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");