Skip to content

Commit 17b5ff2

Browse files
authored
ci: Fix Clippy (#2482)
1 parent cfb314b commit 17b5ff2

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

examples/rustls-mtls/src/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl MtlsProvider {
9696
let private_key = into_private_key(my_key_pem.as_ref()).await?;
9797
Ok(MtlsProvider {
9898
root_store,
99-
my_cert_chain: cert_chain.into_iter().map(CertificateDer::from).collect(),
99+
my_cert_chain: cert_chain,
100100
my_private_key: private_key,
101101
})
102102
}
@@ -124,10 +124,7 @@ async fn into_certificate(path: &Path) -> Result<Vec<CertificateDer<'static>>, R
124124
}
125125

126126
async fn into_root_store(path: &Path) -> Result<RootCertStore, RustlsError> {
127-
let ca_certs: Vec<CertificateDer<'static>> = into_certificate(path)
128-
.await
129-
.map(|certs| certs.into_iter().map(CertificateDer::from))?
130-
.collect();
127+
let ca_certs: Vec<CertificateDer<'static>> = into_certificate(path).await?;
131128
let mut cert_store = RootCertStore::empty();
132129
cert_store.add_parsable_certificates(ca_certs);
133130
Ok(cert_store)

quic/s2n-quic-core/src/inet/ecn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ mod tests {
132132
] {
133133
assert_eq!(
134134
*ecn,
135-
ExplicitCongestionNotification::new(i << 2 | *ecn as u8)
135+
ExplicitCongestionNotification::new((i << 2) | *ecn as u8)
136136
);
137137
}
138138
}

quic/s2n-quic-core/src/inet/ipv4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl Vihl {
529529

530530
#[inline]
531531
pub fn set_version(&mut self, value: u8) -> &mut Self {
532-
self.value = value << 4 | (self.value & 0x0F);
532+
self.value = (value << 4) | (self.value & 0x0F);
533533
self
534534
}
535535

quic/s2n-quic-core/src/inet/ipv6.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,13 @@ impl Vtcfl {
536536

537537
#[inline]
538538
pub fn set_version(&mut self, version: u8) -> &mut Self {
539-
self.octets[0] = version << 4 | self.octets[0] & 0x0F;
539+
self.octets[0] = (version << 4) | self.octets[0] & 0x0F;
540540
self
541541
}
542542

543543
#[inline]
544544
pub fn dscp(&self) -> u8 {
545-
let value = self.octets[0] << 4 | self.octets[1] >> 4;
545+
let value = (self.octets[0] << 4) | (self.octets[1] >> 4);
546546
value >> 2
547547
}
548548

@@ -556,12 +556,12 @@ impl Vtcfl {
556556

557557
#[inline]
558558
pub fn ecn(&self) -> ExplicitCongestionNotification {
559-
ExplicitCongestionNotification::new(self.octets[1] >> 4 & 0b11)
559+
ExplicitCongestionNotification::new((self.octets[1] >> 4) & 0b11)
560560
}
561561

562562
#[inline]
563563
pub fn set_ecn(&mut self, ecn: ExplicitCongestionNotification) -> &mut Self {
564-
self.octets[1] = (self.octets[1] & !(0b11 << 4)) | (ecn as u8) << 4;
564+
self.octets[1] = (self.octets[1] & !(0b11 << 4)) | ((ecn as u8) << 4);
565565
self
566566
}
567567

quic/s2n-quic-core/src/packet/long.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ pub enum PacketType {
143143

144144
impl PacketType {
145145
pub const fn into_bits(self) -> u8 {
146-
(self as u8) << PACKET_TYPE_OFFSET & PACKET_TYPE_MASK
146+
((self as u8) << PACKET_TYPE_OFFSET) & PACKET_TYPE_MASK
147147
}
148148

149149
pub fn from_bits(bits: u8) -> Self {
150-
(bits & PACKET_TYPE_MASK >> PACKET_TYPE_OFFSET).into()
150+
(bits & (PACKET_TYPE_MASK >> PACKET_TYPE_OFFSET)).into()
151151
}
152152
}
153153

quic/s2n-quic-core/src/packet/stateless_reset.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn encode_packet(
8383
&mut packet_buf[..unpredictable_bits_max_len],
8484
);
8585
// Write the short header tag over the first two bits
86-
packet_buf[0] = packet_buf[0] >> TAG_OFFSET | TAG;
86+
packet_buf[0] = (packet_buf[0] >> TAG_OFFSET) | TAG;
8787

8888
let packet_len = unpredictable_bits_len + stateless_reset::token::LEN;
8989

0 commit comments

Comments
 (0)