Skip to content

Commit 3b5f1fa

Browse files
committed
chore: resolve clippy warnings
1 parent c257866 commit 3b5f1fa

File tree

14 files changed

+17
-24
lines changed

14 files changed

+17
-24
lines changed

interceptor/src/twcc/receiver/receiver_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async fn test_twcc_receiver_interceptor_different_delays_between_rtp_packets() -
119119
)
120120
.await;
121121

122-
let delays = vec![0, 10, 100, 200];
122+
let delays = [0, 10, 100, 200];
123123
for (i, d) in delays.iter().enumerate() {
124124
tokio::time::advance(Duration::from_millis(*d)).await;
125125

media/src/audio/buffer/info.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ impl<L> Copy for BufferInfo<L> {}
4747

4848
impl<L> Clone for BufferInfo<L> {
4949
fn clone(&self) -> Self {
50-
Self {
51-
channels: self.channels,
52-
frames: self.frames,
53-
_phantom: PhantomData,
54-
}
50+
*self
5551
}
5652
}
5753

rtcp/src/payload_feedbacks/receiver_estimated_maximum_bitrate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl Unmarshal for ReceiverEstimatedMaximumBitrate {
228228
}
229229

230230
// REMB rules all around me
231-
let mut unique_identifier = vec![0; 4];
231+
let mut unique_identifier = [0; 4];
232232
unique_identifier[0] = raw_packet.get_u8();
233233
unique_identifier[1] = raw_packet.get_u8();
234234
unique_identifier[2] = raw_packet.get_u8();

rtp/src/codecs/vp8/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Payloader for Vp8Payloader {
6767
let current_fragment_size =
6868
std::cmp::min(max_fragment_size, payload_data_remaining) as usize;
6969
let mut out = BytesMut::with_capacity(using_header_size + current_fragment_size);
70-
let mut buf = vec![0u8; 4];
70+
let mut buf = [0u8; 4];
7171
if first {
7272
buf[0] = 0x10;
7373
first = false;

rtp/src/codecs/vp9/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl Payloader for Vp9Payloader {
106106
let current_fragment_size =
107107
std::cmp::min(max_fragment_size as usize, payload_data_remaining);
108108
let mut out = BytesMut::with_capacity(VP9HEADER_SIZE + current_fragment_size);
109-
let mut buf = vec![0u8; VP9HEADER_SIZE];
109+
let mut buf = [0u8; VP9HEADER_SIZE];
110110
buf[0] = 0x90; // F=1 I=1
111111
if payload_data_index == 0 {
112112
buf[0] |= 0x08; // B=1

sctp/src/association/association_internal.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,6 @@ impl AssociationInternal {
18141814
reconfig_response_sequence_number: p.reconfig_request_sequence_number,
18151815
sender_last_tsn: tsn,
18161816
stream_identifiers: sis_to_reset,
1817-
..Default::default()
18181817
})),
18191818
..Default::default()
18201819
};

sctp/src/queue/queue_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn test_payload_queue_get_gap_ack_block() -> Result<()> {
7878
pq.push(make_payload(5, 0), 0);
7979
pq.push(make_payload(6, 0), 0);
8080

81-
let gab1 = vec![GapAckBlock { start: 1, end: 6 }];
81+
let gab1 = [GapAckBlock { start: 1, end: 6 }];
8282
let gab2 = pq.get_gap_ack_blocks(0);
8383
assert!(!gab2.is_empty());
8484
assert_eq!(gab2.len(), 1);
@@ -89,7 +89,7 @@ fn test_payload_queue_get_gap_ack_block() -> Result<()> {
8989
pq.push(make_payload(8, 0), 0);
9090
pq.push(make_payload(9, 0), 0);
9191

92-
let gab1 = vec![
92+
let gab1 = [
9393
GapAckBlock { start: 1, end: 6 },
9494
GapAckBlock { start: 8, end: 9 },
9595
];

sctp/src/timer/timer_test.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ mod test_rto_manager {
9393
#[tokio::test]
9494
async fn test_rto_manager_rto_calculation_small_rtt() -> Result<()> {
9595
let mut m = RtoManager::new();
96-
let exp = vec![
97-
1800, 1500, 1275, 1106, 1000, // capped at RTO.Min
98-
];
96+
let exp = [1800, 1500, 1275, 1106, 1000];
9997

10098
for i in 0..5 {
10199
m.set_new_rtt(600);
@@ -109,7 +107,7 @@ mod test_rto_manager {
109107
#[tokio::test]
110108
async fn test_rto_manager_rto_calculation_large_rtt() -> Result<()> {
111109
let mut m = RtoManager::new();
112-
let exp = vec![
110+
let exp = [
113111
60000, // capped at RTO.Max
114112
60000, // capped at RTO.Max
115113
60000, // capped at RTO.Max

sdp/src/direction/direction_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn test_new_direction() {
1111
("inactive", Direction::Inactive),
1212
];
1313

14-
let failingtests = vec!["", "notadirection"];
14+
let failingtests = ["", "notadirection"];
1515

1616
for (i, u) in passingtests.iter().enumerate() {
1717
let dir = Direction::new(u.0);

sdp/src/extmap/extmap_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn test_extmap() -> Result<()> {
1818
let example_attr_extmap2_line = EXAMPLE_ATTR_EXTMAP2;
1919
let failing_attr_extmap1_line = format!("{ATTRIBUTE_KEY}{FAILING_ATTR_EXTMAP1}{END_LINE}");
2020
let failing_attr_extmap2_line = format!("{ATTRIBUTE_KEY}{FAILING_ATTR_EXTMAP2}{END_LINE}");
21-
let passingtests = vec![
21+
let passingtests = [
2222
(EXAMPLE_ATTR_EXTMAP1, example_attr_extmap1_line),
2323
(EXAMPLE_ATTR_EXTMAP2, example_attr_extmap2_line),
2424
];

stun/src/integrity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl MessageIntegrity {
6868
// new_long_term_integrity returns new MessageIntegrity with key for long-term
6969
// credentials. Password, username, and realm must be SASL-prepared.
7070
pub fn new_long_term_integrity(username: String, realm: String, password: String) -> Self {
71-
let s = vec![username, realm, password].join(CREDENTIALS_SEP);
71+
let s = [username, realm, password].join(CREDENTIALS_SEP);
7272

7373
let mut h = Md5::new();
7474
h.update(s.as_bytes());

stun/src/xoraddr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl XorMappedAddress {
119119
IpAddr::V6(ipv6) => (FAMILY_IPV6, IPV6LEN, ipv6.octets().to_vec()),
120120
};
121121

122-
let mut value = vec![0; 32 + 128];
122+
let mut value = [0; 32 + 128];
123123
//value[0] = 0 // first 8 bits are zeroes
124124
let mut xor_value = vec![0; IPV6LEN];
125125
xor_value[4..].copy_from_slice(&m.transaction_id.0);

util/src/vnet/router/router_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,8 @@ fn test_router_static_ips_static_ip_local_ip_mapping() -> Result<()> {
641641
assert_eq!(lan.static_ips[2].to_string(), "1.2.3.3", "should match");
642642

643643
assert_eq!(3, lan.static_local_ips.len(), "should be 3");
644-
let local_ips = vec!["192.168.0.1", "192.168.0.2", "192.168.0.3"];
645-
let ips = vec!["1.2.3.1", "1.2.3.2", "1.2.3.3"];
644+
let local_ips = ["192.168.0.1", "192.168.0.2", "192.168.0.3"];
645+
let ips = ["1.2.3.1", "1.2.3.2", "1.2.3.3"];
646646
for i in 0..3 {
647647
let ext_ipstr = ips[i];
648648
if let Some(loc_ip) = lan.static_local_ips.get(ext_ipstr) {

webrtc/src/data_channel/data_channel_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ async fn test_data_channel_buffered_amount_set_before_open() -> Result<()> {
872872
Box::pin(async move {
873873
for _ in 0..10 {
874874
assert!(
875-
matches!(dc3.send(&buf).await, Ok(_)),
875+
dc3.send(&buf).await.is_ok(),
876876
"Failed to send string on data channel"
877877
);
878878
assert_eq!(
@@ -973,7 +973,7 @@ async fn test_data_channel_buffered_amount_set_after_open() -> Result<()> {
973973

974974
for _ in 0..10 {
975975
assert!(
976-
matches!(dc3.send(&buf).await, Ok(_)),
976+
dc3.send(&buf).await.is_ok(),
977977
"Failed to send string on data channel"
978978
);
979979
assert_eq!(

0 commit comments

Comments
 (0)