Skip to content

Commit ffead9f

Browse files
author
yngrtc
committed
fix clippy and fmt
1 parent 0aa7c07 commit ffead9f

File tree

31 files changed

+32
-88
lines changed

31 files changed

+32
-88
lines changed

dtls/src/extension/extension_server_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl ExtensionServerName {
2121

2222
pub fn size(&self) -> usize {
2323
//TODO: check how to do cryptobyte?
24-
2 + 2 + 1 + 2 + self.server_name.as_bytes().len()
24+
2 + 2 + 1 + 2 + self.server_name.len()
2525
}
2626

2727
pub fn marshal<W: Write>(&self, writer: &mut W) -> Result<()> {

ice/src/agent/agent_internal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ impl AgentInternal {
984984
) -> bool {
985985
self.find_remote_candidate(local.network_type(), remote)
986986
.await
987-
.map_or(false, |remote_candidate| {
987+
.is_some_and(|remote_candidate| {
988988
remote_candidate.seen(false);
989989
true
990990
})

ice/src/agent/agent_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,8 +1599,8 @@ async fn test_agent_credentials() -> Result<()> {
15991599
let a = Agent::new(AgentConfig::default()).await?;
16001600
{
16011601
let ufrag_pwd = a.internal.ufrag_pwd.lock().await;
1602-
assert!(ufrag_pwd.local_ufrag.as_bytes().len() * 8 >= 24);
1603-
assert!(ufrag_pwd.local_pwd.as_bytes().len() * 8 >= 128);
1602+
assert!(ufrag_pwd.local_ufrag.len() * 8 >= 24);
1603+
assert!(ufrag_pwd.local_pwd.len() * 8 >= 128);
16041604
}
16051605
a.close().await?;
16061606

ice/src/agent/agent_vnet_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ async fn test_write_use_valid_pair() -> Result<(), Error> {
10021002
log::debug!("controlled_agent start_connectivity_checks done...");
10031003

10041004
let test_message = "Test Message";
1005-
let mut read_buf = vec![0u8; test_message.as_bytes().len()];
1005+
let mut read_buf = vec![0u8; test_message.len()];
10061006
controlled_agent_conn.recv(&mut read_buf).await?;
10071007

10081008
assert_eq!(read_buf, test_message.as_bytes(), "should match");

mdns/src/message/resource/txt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl ResourceBody for TxtResource {
4343
let (t, new_off) = unpack_str(msg, off)?;
4444
off = new_off;
4545
// Check if we got too many bytes.
46-
if length < n + t.as_bytes().len() + 1 {
46+
if length < n + t.len() + 1 {
4747
return Err(Error::ErrCalcLen);
4848
}
4949
n += t.len() + 1;

rtcp/src/compound_packet/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ impl Packet for CompoundPacket {
6666
}
6767

6868
fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool {
69-
other
70-
.as_any()
71-
.downcast_ref::<CompoundPacket>()
72-
.map_or(false, |a| self == a)
69+
other.as_any().downcast_ref::<CompoundPacket>() == Some(self)
7370
}
7471

7572
fn cloned(&self) -> Box<dyn Packet + Send + Sync> {

rtcp/src/extended_report/dlrr.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ impl Packet for DLRRReportBlock {
7777
self
7878
}
7979
fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool {
80-
other
81-
.as_any()
82-
.downcast_ref::<DLRRReportBlock>()
83-
.map_or(false, |a| self == a)
80+
other.as_any().downcast_ref::<DLRRReportBlock>() == Some(self)
8481
}
8582
fn cloned(&self) -> Box<dyn Packet + Send + Sync> {
8683
Box::new(self.clone())

rtcp/src/extended_report/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@ impl Packet for ExtendedReport {
199199
}
200200

201201
fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool {
202-
other
203-
.as_any()
204-
.downcast_ref::<ExtendedReport>()
205-
.map_or(false, |a| self == a)
202+
other.as_any().downcast_ref::<ExtendedReport>() == Some(self)
206203
}
207204

208205
fn cloned(&self) -> Box<dyn Packet + Send + Sync> {

rtcp/src/extended_report/prt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Packet for PacketReceiptTimesReportBlock {
7171
other
7272
.as_any()
7373
.downcast_ref::<PacketReceiptTimesReportBlock>()
74-
.map_or(false, |a| self == a)
74+
== Some(self)
7575
}
7676
fn cloned(&self) -> Box<dyn Packet + Send + Sync> {
7777
Box::new(self.clone())

rtcp/src/extended_report/rle.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ impl Packet for RLEReportBlock {
163163
self
164164
}
165165
fn equal(&self, other: &(dyn Packet + Send + Sync)) -> bool {
166-
other
167-
.as_any()
168-
.downcast_ref::<RLEReportBlock>()
169-
.map_or(false, |a| self == a)
166+
other.as_any().downcast_ref::<RLEReportBlock>() == Some(self)
170167
}
171168
fn cloned(&self) -> Box<dyn Packet + Send + Sync> {
172169
Box::new(self.clone())

0 commit comments

Comments
 (0)