Skip to content

Commit 6ed925e

Browse files
ctzdjc
authored andcommitted
Address nightly clippy::derivable_impls lints
1 parent 645095f commit 6ed925e

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

rustls/src/enums.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ enum_builder! {
615615
/// [RFC 6091 Section 5]: <https://datatracker.ietf.org/doc/html/rfc6091#section-5>
616616
/// [RFC 7250 Section 7]: <https://datatracker.ietf.org/doc/html/rfc7250#section-7>
617617
#[repr(u8)]
618+
#[derive(Default)]
618619
pub enum CertificateType {
620+
#[default]
619621
X509 => 0x00,
620622
RawPublicKey => 0x02,
621623
}

rustls/src/msgs/enums.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -355,27 +355,26 @@ enum_builder! {
355355
///
356356
/// [RFC 9180 Section 7.2]: <https://datatracker.ietf.org/doc/html/rfc9180#name-key-derivation-functions-kd>
357357
#[repr(u16)]
358+
#[derive(Default)]
358359
pub enum HpkeKdf {
360+
// TODO(XXX): revisit the default configuration. This is just what Cloudflare ships right now.
361+
#[default]
359362
HKDF_SHA256 => 0x0001,
360363
HKDF_SHA384 => 0x0002,
361364
HKDF_SHA512 => 0x0003,
362365
}
363366
}
364367

365-
impl Default for HpkeKdf {
366-
// TODO(XXX): revisit the default configuration. This is just what Cloudflare ships right now.
367-
fn default() -> Self {
368-
Self::HKDF_SHA256
369-
}
370-
}
371-
372368
enum_builder! {
373369
/// The Authenticated Encryption with Associated Data (`Aead`) type for HPKE operations.
374370
/// Listed by IANA, as specified in [RFC 9180 Section 7.3]
375371
///
376372
/// [RFC 9180 Section 7.3]: <https://datatracker.ietf.org/doc/html/rfc9180#name-authenticated-encryption-wi>
377373
#[repr(u16)]
374+
#[derive(Default)]
378375
pub enum HpkeAead {
376+
// TODO(XXX): revisit the default configuration. This is just what Cloudflare ships right now.
377+
#[default]
379378
AES_128_GCM => 0x0001,
380379
AES_256_GCM => 0x0002,
381380
CHACHA20_POLY_1305 => 0x0003,
@@ -396,13 +395,6 @@ impl HpkeAead {
396395
}
397396
}
398397

399-
impl Default for HpkeAead {
400-
// TODO(XXX): revisit the default configuration. This is just what Cloudflare ships right now.
401-
fn default() -> Self {
402-
Self::AES_128_GCM
403-
}
404-
}
405-
406398
enum_builder! {
407399
/// The Encrypted Client Hello protocol version (`EchVersion`).
408400
///

rustls/src/quic.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -976,11 +976,12 @@ pub enum KeyChange {
976976
///
977977
/// Governs version-specific behavior in the TLS layer
978978
#[non_exhaustive]
979-
#[derive(Clone, Copy, Debug)]
979+
#[derive(Clone, Copy, Debug, Default)]
980980
pub enum Version {
981981
/// Draft versions 29, 30, 31 and 32
982982
V1Draft,
983983
/// First stable RFC
984+
#[default]
984985
V1,
985986
/// Anti-ossification variant of V1
986987
V2,
@@ -1039,12 +1040,6 @@ impl Version {
10391040
}
10401041
}
10411042

1042-
impl Default for Version {
1043-
fn default() -> Self {
1044-
Self::V1
1045-
}
1046-
}
1047-
10481043
#[cfg(test)]
10491044
mod tests {
10501045
use std::prelude::v1::*;

rustls/src/server/server_conn.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,9 @@ impl State<ServerConnectionData> for Accepting {
11111111
}
11121112
}
11131113

1114+
#[derive(Default)]
11141115
pub(super) enum EarlyDataState {
1116+
#[default]
11151117
New,
11161118
Accepted {
11171119
received: ChunkVecBuffer,
@@ -1120,12 +1122,6 @@ pub(super) enum EarlyDataState {
11201122
Rejected,
11211123
}
11221124

1123-
impl Default for EarlyDataState {
1124-
fn default() -> Self {
1125-
Self::New
1126-
}
1127-
}
1128-
11291125
impl EarlyDataState {
11301126
pub(super) fn reject(&mut self) {
11311127
*self = Self::Rejected;

0 commit comments

Comments
 (0)