Skip to content

Commit d72a0f9

Browse files
authored
Make clippy happy (#3350)
1 parent 07f29f6 commit d72a0f9

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ inefficient_to_string = "warn"
3333
linkedlist = "warn"
3434
lossy_float_literal = "warn"
3535
macro_use_imports = "warn"
36-
match_on_vec_items = "warn"
3736
match_wildcard_for_single_variants = "warn"
3837
mem_forget = "warn"
3938
needless_borrow = "warn"

axum-macros/src/from_request/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -775,10 +775,11 @@ fn impl_struct_by_extracting_all_at_once(
775775
.chain(via_marker_type)
776776
.collect::<Punctuated<Type, Token![,]>>();
777777

778-
let ident_generics = generic_ident
779-
.is_some()
780-
.then(|| quote! { <T> })
781-
.unwrap_or_default();
778+
let ident_generics = if generic_ident.is_some() {
779+
quote! { <T> }
780+
} else {
781+
TokenStream::new()
782+
};
782783

783784
let rejection_bound = rejection.as_ref().map(|rejection| {
784785
match (tr, generic_ident.is_some()) {

examples/http-proxy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async fn main() {
7777
.with_upgrades()
7878
.await
7979
{
80-
println!("Failed to serve connection: {:?}", err);
80+
println!("Failed to serve connection: {err:?}");
8181
}
8282
});
8383
}

examples/reverse-proxy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async fn handler(State(client): State<Client>, mut req: Request) -> Result<Respo
4545
.map(|v| v.as_str())
4646
.unwrap_or(path);
4747

48-
let uri = format!("http://127.0.0.1:3000{}", path_query);
48+
let uri = format!("http://127.0.0.1:3000{path_query}");
4949

5050
*req.uri_mut() = Uri::try_from(uri).unwrap();
5151

examples/sse/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ mod tests {
8585
async fn spawn_app(host: impl Into<String>) -> String {
8686
let host = host.into();
8787
// Bind to localhost at the port 0, which will let the OS assign an available port to us
88-
let listener = TcpListener::bind(format!("{}:0", host)).await.unwrap();
88+
let listener = TcpListener::bind(format!("{host}:0")).await.unwrap();
8989
// Retrieve the port assigned to us by the OS
9090
let port = listener.local_addr().unwrap().port();
9191
tokio::spawn(async {
9292
axum::serve(listener, app()).await.unwrap();
9393
});
9494
// Returns address (e.g. http://127.0.0.1{random_port})
95-
format!("http://{}:{}", host, port)
95+
format!("http://{host}:{port}")
9696
}
9797
let listening_url = spawn_app("127.0.0.1").await;
9898

9999
let mut event_stream = reqwest::Client::new()
100-
.get(format!("{}/sse", listening_url))
100+
.get(format!("{listening_url}/sse"))
101101
.header("User-Agent", "integration_test")
102102
.send()
103103
.await

examples/unix-domain-socket/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ mod unix {
5959
let (mut sender, conn) = hyper::client::conn::http1::handshake(stream).await.unwrap();
6060
tokio::task::spawn(async move {
6161
if let Err(err) = conn.await {
62-
println!("Connection failed: {:?}", err);
62+
println!("Connection failed: {err:?}");
6363
}
6464
});
6565

@@ -79,7 +79,7 @@ mod unix {
7979
}
8080

8181
async fn handler(ConnectInfo(info): ConnectInfo<UdsConnectInfo>) -> &'static str {
82-
println!("new connection from `{:?}`", info);
82+
println!("new connection from `{info:?}`");
8383

8484
"Hello, World!"
8585
}

examples/websockets/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ fn process_message(msg: Message, who: usize) -> ControlFlow<(), ()> {
129129
println!(">>> {who} got str: {t:?}");
130130
}
131131
Message::Binary(d) => {
132-
println!(">>> {} got {} bytes: {:?}", who, d.len(), d);
132+
println!(">>> {who} got {} bytes: {d:?}", d.len());
133133
}
134134
Message::Close(c) => {
135135
if let Some(cf) = c {
136136
println!(
137-
">>> {} got close with code {} and reason `{}`",
138-
who, cf.code, cf.reason
137+
">>> {who} got close with code {} and reason `{}`",
138+
cf.code, cf.reason
139139
);
140140
} else {
141141
println!(">>> {who} somehow got close message without CloseFrame");

examples/websockets/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,13 @@ fn process_message(msg: Message, who: SocketAddr) -> ControlFlow<(), ()> {
220220
println!(">>> {who} sent str: {t:?}");
221221
}
222222
Message::Binary(d) => {
223-
println!(">>> {} sent {} bytes: {:?}", who, d.len(), d);
223+
println!(">>> {who} sent {} bytes: {d:?}", d.len());
224224
}
225225
Message::Close(c) => {
226226
if let Some(cf) = c {
227227
println!(
228-
">>> {} sent close with code {} and reason `{}`",
229-
who, cf.code, cf.reason
228+
">>> {who} sent close with code {} and reason `{}`",
229+
cf.code, cf.reason
230230
);
231231
} else {
232232
println!(">>> {who} somehow sent close message without CloseFrame");

0 commit comments

Comments
 (0)