File tree Expand file tree Collapse file tree 6 files changed +13
-25
lines changed
interceptor/src/nack/generator
payload_feedbacks/slice_loss_indication Expand file tree Collapse file tree 6 files changed +13
-25
lines changed Original file line number Diff line number Diff line change @@ -13,22 +13,14 @@ pub(crate) async fn pipe(
13
13
let ( a_notifier, mut a_connected) = on_connected ( ) ;
14
14
let ( b_notifier, mut b_connected) = on_connected ( ) ;
15
15
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 ( ) ;
21
17
cfg0. urls = vec ! [ ] ;
22
18
cfg0. network_types = supported_network_types ( ) ;
23
19
24
20
let a_agent = Arc :: new ( Agent :: new ( cfg0) . await ?) ;
25
21
a_agent. on_connection_state_change ( a_notifier) ;
26
22
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 ( ) ;
32
24
cfg1. urls = vec ! [ ] ;
33
25
cfg1. network_types = supported_network_types ( ) ;
34
26
Original file line number Diff line number Diff line change @@ -61,11 +61,7 @@ impl InterceptorBuilder for GeneratorBuilder {
61
61
} else {
62
62
13 - 6 // 8192 = 1 << 13
63
63
} ,
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 ( ) ,
69
65
interval : if let Some ( interval) = self . interval {
70
66
interval
71
67
} else {
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ where
123
123
) ;
124
124
125
125
// 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) }
127
127
} ;
128
128
129
129
let info = buffer. info . into ( ) ;
@@ -167,7 +167,7 @@ where
167
167
) ;
168
168
169
169
// 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) }
171
171
} ;
172
172
173
173
let info = buffer. info . into ( ) ;
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ impl MarshalSize for SliceLossIndication {
97
97
impl Marshal for SliceLossIndication {
98
98
/// Marshal encodes the SliceLossIndication in binary
99
99
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 {
101
101
return Err ( Error :: TooManyReports . into ( ) ) ;
102
102
}
103
103
if buf. remaining_mut ( ) < self . marshal_size ( ) {
Original file line number Diff line number Diff line change @@ -323,15 +323,15 @@ impl MarshalSize for RecvDelta {
323
323
// small delta
324
324
if self . type_tcc_packet == SymbolTypeTcc :: PacketReceivedSmallDelta
325
325
&& delta >= 0
326
- && delta <= std :: u8:: MAX as i64
326
+ && delta <= u8:: MAX as i64
327
327
{
328
328
return 1 ;
329
329
}
330
330
331
331
// big delta
332
332
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
335
335
{
336
336
return 2 ;
337
337
}
@@ -348,7 +348,7 @@ impl Marshal for RecvDelta {
348
348
// small delta
349
349
if self . type_tcc_packet == SymbolTypeTcc :: PacketReceivedSmallDelta
350
350
&& delta >= 0
351
- && delta <= std :: u8:: MAX as i64
351
+ && delta <= u8:: MAX as i64
352
352
&& buf. remaining_mut ( ) >= 1
353
353
{
354
354
buf. put_u8 ( delta as u8 ) ;
@@ -357,8 +357,8 @@ impl Marshal for RecvDelta {
357
357
358
358
// big delta
359
359
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
362
362
&& buf. remaining_mut ( ) >= 2
363
363
{
364
364
buf. put_u16 ( delta as u16 ) ;
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ impl MarshalSize for TransportLayerNack {
173
173
impl Marshal for TransportLayerNack {
174
174
/// Marshal encodes the packet in binary.
175
175
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 {
177
177
return Err ( Error :: TooManyReports . into ( ) ) ;
178
178
}
179
179
if buf. remaining_mut ( ) < self . marshal_size ( ) {
You can’t perform that action at this time.
0 commit comments