quic: fix clippy warnings in QUIC-only code

This commit is contained in:
Dirkjan Ochtman 2021-04-21 13:20:45 +02:00
parent 10086c0e06
commit 11f86d3329
4 changed files with 13 additions and 19 deletions

View File

@ -210,7 +210,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -p rustls -- -D warnings
args: -p rustls --all-features -- -D warnings
clippy-nightly:
name: Clippy (Nightly)
@ -228,4 +228,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -p rustls
args: -p rustls --all-features

View File

@ -1055,7 +1055,7 @@ impl hs::State for ExpectFinished {
client: write_key,
server: read_key,
});
return Ok(Box::new(ExpectQUICTraffic(st)));
return Ok(Box::new(ExpectQuicTraffic(st)));
}
}
@ -1105,12 +1105,10 @@ impl ExpectTraffic {
value.set_max_early_data_size(sz);
#[cfg(feature = "quic")]
{
if conn.common.protocol == Protocol::Quic {
if sz != 0 && sz != 0xffff_ffff {
return Err(Error::PeerMisbehavedError(
"invalid max_early_data_size".into(),
));
}
if conn.common.protocol == Protocol::Quic && sz != 0 && sz != 0xffff_ffff {
return Err(Error::PeerMisbehavedError(
"invalid max_early_data_size".into(),
));
}
}
}
@ -1246,10 +1244,10 @@ impl hs::State for ExpectTraffic {
}
#[cfg(feature = "quic")]
pub struct ExpectQUICTraffic(ExpectTraffic);
pub struct ExpectQuicTraffic(ExpectTraffic);
#[cfg(feature = "quic")]
impl hs::State for ExpectQUICTraffic {
impl hs::State for ExpectQuicTraffic {
fn handle(
mut self: Box<Self>,
conn: &mut ClientConnection,

View File

@ -915,11 +915,7 @@ impl ConnectionCommon {
self.quic.alert = Some(alert.description);
} else {
debug_assert!(
if let MessagePayload::Handshake(_) = m.payload {
true
} else {
false
},
matches!(m.payload, MessagePayload::Handshake(_)),
"QUIC uses TLS for the cryptographic handshake only"
);
let mut bytes = Vec::new();

View File

@ -1016,7 +1016,7 @@ impl hs::State for ExpectFinished {
#[cfg(feature = "quic")]
{
if conn.common.protocol == Protocol::Quic {
return Ok(Box::new(ExpectQUICTraffic {
return Ok(Box::new(ExpectQuicTraffic {
key_schedule: key_schedule_traffic,
_fin_verified: fin,
}));
@ -1138,13 +1138,13 @@ impl hs::State for ExpectTraffic {
}
#[cfg(feature = "quic")]
struct ExpectQUICTraffic {
struct ExpectQuicTraffic {
key_schedule: KeyScheduleTraffic,
_fin_verified: verify::FinishedMessageVerified,
}
#[cfg(feature = "quic")]
impl hs::State for ExpectQUICTraffic {
impl hs::State for ExpectQuicTraffic {
fn handle(self: Box<Self>, _: &mut ServerConnection, m: Message) -> hs::NextStateOrError {
// reject all messages
check_message(&m, &[], &[])?;