Skip to content

Commit 6a6abec

Browse files
committed
refactor: apply clippy fixes across workspace
Applied `cargo clippy --fix --workspace` to modernize string formatting Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
1 parent f296fc7 commit 6a6abec

File tree

61 files changed

+231
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+231
-274
lines changed

data/src/data_channel/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl DataChannel {
187187
match self.handle_dcep(&mut data).await {
188188
Ok(()) => {}
189189
Err(err) => {
190-
log::error!("Failed to handle DCEP: {:?}", err);
190+
log::error!("Failed to handle DCEP: {err:?}");
191191
}
192192
}
193193
continue;

dtls/src/conn/conn_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,7 @@ async fn test_multiple_hello_verify_request() -> Result<()> {
23022302

23032303
for i in 0..cookies.len() {
23042304
let cookie = &cookies[i];
2305-
trace!("cookie {}: {:?}", i, cookie);
2305+
trace!("cookie {i}: {cookie:?}");
23062306

23072307
// read client hello
23082308
let mut resp = vec![0; 1024];

dtls/src/crypto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ fn verify_signature(
342342
_ => return Err(Error::ErrKeySignatureVerifyUnimplemented),
343343
};
344344

345-
log::trace!("Picked an algorithm {:?}", verify_alg);
345+
log::trace!("Picked an algorithm {verify_alg:?}");
346346

347347
let public_key = ring::signature::UnparsedPublicKey::new(
348348
verify_alg,

examples/examples/data-channels-flow-control/data-channels-flow-control.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ async fn main() -> anyhow::Result<()> {
174174
if let Ok(candidate) = candidate.to_json() {
175175
if let Some(requester) = maybe_requester.upgrade() {
176176
if let Err(err) = requester.add_ice_candidate(candidate).await {
177-
log::warn!("{}", err);
177+
log::warn!("{err}");
178178
}
179179
}
180180
}
@@ -191,7 +191,7 @@ async fn main() -> anyhow::Result<()> {
191191
if let Ok(candidate) = candidate.to_json() {
192192
if let Some(responder) = maybe_responder.upgrade() {
193193
if let Err(err) = responder.add_ice_candidate(candidate).await {
194-
log::warn!("{}", err);
194+
log::warn!("{err}");
195195
}
196196
}
197197
}

examples/examples/play-from-disk-hevc/play-from-disk-hevc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async fn main() -> Result<()> {
115115
let (answer_sdr, answer_rcv) = mpsc::channel::<RTCSessionDescription>(10);
116116
tokio::spawn(async move {
117117
if let Err(e) = offer_worker(video_file1, audio_file, offer_sdr, answer_rcv).await {
118-
println!("[Speaker] Error: {:?}", e);
118+
println!("[Speaker] Error: {e:?}");
119119
}
120120
});
121121
// Create a MediaEngine object to configure the supported codec

ice/src/agent/agent_gather.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl Agent {
226226
.await;
227227

228228
if let Err(err) = result {
229-
log::error!("Failed to gather local candidates using UDP mux: {}", err);
229+
log::error!("Failed to gather local candidates using UDP mux: {err}");
230230
}
231231

232232
return;
@@ -426,9 +426,7 @@ impl Agent {
426426
Ok(ip) => Some(ip),
427427
Err(err) => {
428428
log::warn!(
429-
"1:1 NAT mapping is enabled but not external IP is found for {}: {}",
430-
ip,
431-
err
429+
"1:1 NAT mapping is enabled but not external IP is found for {ip}: {err}"
432430
);
433431
None
434432
}

ice/src/agent/agent_internal.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ impl AgentInternal {
180180
}
181181

182182
log::debug!(
183-
"Started agent: isControlling? {}, remoteUfrag: {}, remotePwd: {}",
184-
is_controlling,
185-
remote_ufrag,
186-
remote_pwd
183+
"Started agent: isControlling? {is_controlling}, remoteUfrag: {remote_ufrag}, remotePwd: {remote_pwd}"
187184
);
188185
self.set_remote_credentials(remote_ufrag, remote_pwd)
189186
.await?;

ice/src/agent/agent_selector.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl AgentInternal {
137137
};
138138

139139
if let Err(err) = result {
140-
log::error!("{}", err);
140+
log::error!("{err}");
141141
None
142142
} else {
143143
log::trace!(
@@ -297,7 +297,7 @@ impl ControllingSelector for AgentInternal {
297297
};
298298

299299
if let Err(err) = result {
300-
log::error!("{}", err);
300+
log::error!("{err}");
301301
} else {
302302
self.send_binding_request(&msg, local, remote).await;
303303
}
@@ -316,14 +316,12 @@ impl ControllingSelector for AgentInternal {
316316
// Assert that NAT is not symmetric
317317
// https://tools.ietf.org/html/rfc8445#section-7.2.5.2.1
318318
if transaction_addr != remote_addr {
319-
log::debug!("discard message: transaction source and destination does not match expected({}), actual({})", transaction_addr, remote);
319+
log::debug!("discard message: transaction source and destination does not match expected({transaction_addr}), actual({remote})");
320320
return;
321321
}
322322

323323
log::trace!(
324-
"inbound STUN (SuccessResponse) from {} to {}",
325-
remote,
326-
local
324+
"inbound STUN (SuccessResponse) from {remote} to {local}"
327325
);
328326
let selected_pair_is_none = self.agent_conn.get_selected_pair().is_none();
329327

@@ -381,8 +379,7 @@ impl ControllingSelector for AgentInternal {
381379
{
382380
if let Some(best_pair) = self.agent_conn.get_best_available_candidate_pair().await {
383381
log::trace!(
384-
"controllingSelector: getBestAvailableCandidatePair {}",
385-
best_pair
382+
"controllingSelector: getBestAvailableCandidatePair {best_pair}"
386383
);
387384
if best_pair == p
388385
&& self.is_nominatable(&p.local)
@@ -449,7 +446,7 @@ impl ControlledSelector for AgentInternal {
449446
};
450447

451448
if let Err(err) = result {
452-
log::error!("{}", err);
449+
log::error!("{err}");
453450
} else {
454451
self.send_binding_request(&msg, local, remote).await;
455452
}
@@ -474,20 +471,18 @@ impl ControlledSelector for AgentInternal {
474471
// Assert that NAT is not symmetric
475472
// https://tools.ietf.org/html/rfc8445#section-7.2.5.2.1
476473
if transaction_addr != remote_addr {
477-
log::debug!("discard message: transaction source and destination does not match expected({}), actual({})", transaction_addr, remote);
474+
log::debug!("discard message: transaction source and destination does not match expected({transaction_addr}), actual({remote})");
478475
return;
479476
}
480477

481478
log::trace!(
482-
"inbound STUN (SuccessResponse) from {} to {}",
483-
remote,
484-
local
479+
"inbound STUN (SuccessResponse) from {remote} to {local}"
485480
);
486481

487482
if let Some(p) = self.find_pair(local, remote).await {
488483
p.state
489484
.store(CandidatePairState::Succeeded as u8, Ordering::SeqCst);
490-
log::trace!("Found valid candidate pair: {}", p);
485+
log::trace!("Found valid candidate pair: {p}");
491486

492487
if p.nominate_on_binding_success.load(Ordering::SeqCst)
493488
&& self.agent_conn.get_selected_pair().is_none()

ice/src/agent/agent_vnet_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,8 @@ async fn test_connectivity_vnet_1to1_nat_with_host_candidate_vs_symmetric_nats()
658658
filtering_behavior: nat::EndpointDependencyType::EndpointAddrPortDependent,
659659
..Default::default()
660660
};
661-
log::debug!("natType0: {:?}", nat_type0);
662-
log::debug!("natType1: {:?}", nat_type1);
661+
log::debug!("natType0: {nat_type0:?}");
662+
log::debug!("natType1: {nat_type1:?}");
663663

664664
let v = build_vnet(nat_type0, nat_type1).await?;
665665

@@ -711,8 +711,8 @@ async fn test_connectivity_vnet_1to1_nat_with_srflx_candidate_vs_symmetric_nats(
711711
filtering_behavior: nat::EndpointDependencyType::EndpointAddrPortDependent,
712712
..Default::default()
713713
};
714-
log::debug!("natType0: {:?}", nat_type0);
715-
log::debug!("natType1: {:?}", nat_type1);
714+
log::debug!("natType0: {nat_type0:?}");
715+
log::debug!("natType1: {nat_type1:?}");
716716

717717
let v = build_vnet(nat_type0, nat_type1).await?;
718718

ice/src/agent/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl Agent {
141141
Err(err) => {
142142
// Opportunistic mDNS: If we can't open the connection, that's ok: we
143143
// can continue without it.
144-
log::warn!("Failed to initialize mDNS {}: {}", mdns_name, err);
144+
log::warn!("Failed to initialize mDNS {mdns_name}: {err}");
145145
None
146146
}
147147
};
@@ -269,7 +269,7 @@ impl Agent {
269269
if c.tcp_type() == TcpType::Active {
270270
// TCP Candidates with tcptype active will probe server passive ones, so
271271
// no need to do anything with them.
272-
log::info!("Ignoring remote candidate with tcpType active: {}", c);
272+
log::info!("Ignoring remote candidate with tcpType active: {c}");
273273
return Ok(());
274274
}
275275

@@ -515,7 +515,7 @@ impl Agent {
515515
async fn close_multicast_conn(mdns_conn: &Option<Arc<DnsConn>>) {
516516
if let Some(conn) = mdns_conn {
517517
if let Err(err) = conn.close().await {
518-
log::warn!("failed to close mDNS Conn: {}", err);
518+
log::warn!("failed to close mDNS Conn: {err}");
519519
}
520520
}
521521
}

0 commit comments

Comments
 (0)