Skip to content

Commit eb13931

Browse files
author
yngrtc
committed
fix clippy
1 parent 67b8ec2 commit eb13931

File tree

6 files changed

+13
-25
lines changed

6 files changed

+13
-25
lines changed

ice/src/agent/agent_transport_test.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,14 @@ pub(crate) async fn pipe(
1313
let (a_notifier, mut a_connected) = on_connected();
1414
let (b_notifier, mut b_connected) = on_connected();
1515

16-
let mut cfg0 = if let Some(cfg) = default_config0 {
17-
cfg
18-
} else {
19-
AgentConfig::default()
20-
};
16+
let mut cfg0 = default_config0.unwrap_or_default();
2117
cfg0.urls = vec![];
2218
cfg0.network_types = supported_network_types();
2319

2420
let a_agent = Arc::new(Agent::new(cfg0).await?);
2521
a_agent.on_connection_state_change(a_notifier);
2622

27-
let mut cfg1 = if let Some(cfg) = default_config1 {
28-
cfg
29-
} else {
30-
AgentConfig::default()
31-
};
23+
let mut cfg1 = default_config1.unwrap_or_default();
3224
cfg1.urls = vec![];
3325
cfg1.network_types = supported_network_types();
3426

interceptor/src/nack/generator/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ impl InterceptorBuilder for GeneratorBuilder {
6161
} else {
6262
13 - 6 // 8192 = 1 << 13
6363
},
64-
skip_last_n: if let Some(skip_last_n) = self.skip_last_n {
65-
skip_last_n
66-
} else {
67-
0
68-
},
64+
skip_last_n: self.skip_last_n.unwrap_or_default(),
6965
interval: if let Some(interval) = self.interval {
7066
interval
7167
} else {

media/src/audio/buffer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ where
123123
);
124124

125125
// Transmute the vec to the initialized type.
126-
unsafe { std::mem::transmute::<_, Vec<T>>(samples) }
126+
unsafe { std::mem::transmute::<Vec<MaybeUninit<T>>, Vec<T>>(samples) }
127127
};
128128

129129
let info = buffer.info.into();
@@ -167,7 +167,7 @@ where
167167
);
168168

169169
// Everything is initialized. Transmute the vec to the initialized type.
170-
unsafe { std::mem::transmute::<_, Vec<T>>(samples) }
170+
unsafe { std::mem::transmute::<Vec<MaybeUninit<T>>, Vec<T>>(samples) }
171171
};
172172

173173
let info = buffer.info.into();

rtcp/src/payload_feedbacks/slice_loss_indication/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl MarshalSize for SliceLossIndication {
9797
impl Marshal for SliceLossIndication {
9898
/// Marshal encodes the SliceLossIndication in binary
9999
fn marshal_to(&self, mut buf: &mut [u8]) -> Result<usize> {
100-
if (self.sli_entries.len() + SLI_LENGTH) as u8 > std::u8::MAX {
100+
if (self.sli_entries.len() + SLI_LENGTH) as u8 > u8::MAX {
101101
return Err(Error::TooManyReports.into());
102102
}
103103
if buf.remaining_mut() < self.marshal_size() {

rtcp/src/transport_feedbacks/transport_layer_cc/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,15 @@ impl MarshalSize for RecvDelta {
323323
// small delta
324324
if self.type_tcc_packet == SymbolTypeTcc::PacketReceivedSmallDelta
325325
&& delta >= 0
326-
&& delta <= std::u8::MAX as i64
326+
&& delta <= u8::MAX as i64
327327
{
328328
return 1;
329329
}
330330

331331
// big delta
332332
if self.type_tcc_packet == SymbolTypeTcc::PacketReceivedLargeDelta
333-
&& delta >= std::i16::MIN as i64
334-
&& delta <= std::u16::MAX as i64
333+
&& delta >= i16::MIN as i64
334+
&& delta <= u16::MAX as i64
335335
{
336336
return 2;
337337
}
@@ -348,7 +348,7 @@ impl Marshal for RecvDelta {
348348
// small delta
349349
if self.type_tcc_packet == SymbolTypeTcc::PacketReceivedSmallDelta
350350
&& delta >= 0
351-
&& delta <= std::u8::MAX as i64
351+
&& delta <= u8::MAX as i64
352352
&& buf.remaining_mut() >= 1
353353
{
354354
buf.put_u8(delta as u8);
@@ -357,8 +357,8 @@ impl Marshal for RecvDelta {
357357

358358
// big delta
359359
if self.type_tcc_packet == SymbolTypeTcc::PacketReceivedLargeDelta
360-
&& delta >= std::i16::MIN as i64
361-
&& delta <= std::u16::MAX as i64
360+
&& delta >= i16::MIN as i64
361+
&& delta <= u16::MAX as i64
362362
&& buf.remaining_mut() >= 2
363363
{
364364
buf.put_u16(delta as u16);

rtcp/src/transport_feedbacks/transport_layer_nack/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl MarshalSize for TransportLayerNack {
173173
impl Marshal for TransportLayerNack {
174174
/// Marshal encodes the packet in binary.
175175
fn marshal_to(&self, mut buf: &mut [u8]) -> Result<usize, util::Error> {
176-
if self.nacks.len() + TLN_LENGTH > std::u8::MAX as usize {
176+
if self.nacks.len() + TLN_LENGTH > u8::MAX as usize {
177177
return Err(Error::TooManyReports.into());
178178
}
179179
if buf.remaining_mut() < self.marshal_size() {

0 commit comments

Comments
 (0)