Skip to content

Commit

Permalink
ci: Fix Clippy (#2482)
Browse files Browse the repository at this point in the history
  • Loading branch information
maddeleine authored Feb 24, 2025
1 parent cfb314b commit 17b5ff2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
7 changes: 2 additions & 5 deletions examples/rustls-mtls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl MtlsProvider {
let private_key = into_private_key(my_key_pem.as_ref()).await?;
Ok(MtlsProvider {
root_store,
my_cert_chain: cert_chain.into_iter().map(CertificateDer::from).collect(),
my_cert_chain: cert_chain,
my_private_key: private_key,
})
}
Expand Down Expand Up @@ -124,10 +124,7 @@ async fn into_certificate(path: &Path) -> Result<Vec<CertificateDer<'static>>, R
}

async fn into_root_store(path: &Path) -> Result<RootCertStore, RustlsError> {
let ca_certs: Vec<CertificateDer<'static>> = into_certificate(path)
.await
.map(|certs| certs.into_iter().map(CertificateDer::from))?
.collect();
let ca_certs: Vec<CertificateDer<'static>> = into_certificate(path).await?;
let mut cert_store = RootCertStore::empty();
cert_store.add_parsable_certificates(ca_certs);
Ok(cert_store)
Expand Down
2 changes: 1 addition & 1 deletion quic/s2n-quic-core/src/inet/ecn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ mod tests {
] {
assert_eq!(
*ecn,
ExplicitCongestionNotification::new(i << 2 | *ecn as u8)
ExplicitCongestionNotification::new((i << 2) | *ecn as u8)
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion quic/s2n-quic-core/src/inet/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ impl Vihl {

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

Expand Down
8 changes: 4 additions & 4 deletions quic/s2n-quic-core/src/inet/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,13 @@ impl Vtcfl {

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

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

Expand All @@ -556,12 +556,12 @@ impl Vtcfl {

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

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

Expand Down
4 changes: 2 additions & 2 deletions quic/s2n-quic-core/src/packet/long.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ pub enum PacketType {

impl PacketType {
pub const fn into_bits(self) -> u8 {
(self as u8) << PACKET_TYPE_OFFSET & PACKET_TYPE_MASK
((self as u8) << PACKET_TYPE_OFFSET) & PACKET_TYPE_MASK
}

pub fn from_bits(bits: u8) -> Self {
(bits & PACKET_TYPE_MASK >> PACKET_TYPE_OFFSET).into()
(bits & (PACKET_TYPE_MASK >> PACKET_TYPE_OFFSET)).into()
}
}

Expand Down
2 changes: 1 addition & 1 deletion quic/s2n-quic-core/src/packet/stateless_reset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn encode_packet(
&mut packet_buf[..unpredictable_bits_max_len],
);
// Write the short header tag over the first two bits
packet_buf[0] = packet_buf[0] >> TAG_OFFSET | TAG;
packet_buf[0] = (packet_buf[0] >> TAG_OFFSET) | TAG;

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

Expand Down

0 comments on commit 17b5ff2

Please sign in to comment.