Idiomatic capitalization of EcnCodepoint variants

This commit is contained in:
Benjamin Saunders
2021-03-26 10:56:59 -07:00
committed by Dirkjan Ochtman
parent 5e68a8681e
commit fe5673bf20
3 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -717,7 +717,7 @@ where
destination: self.path.remote,
contents: buf,
ecn: if self.path.sending_ecn {
Some(EcnCodepoint::ECT0)
Some(EcnCodepoint::Ect0)
} else {
None
},
+3 -3
View File
@@ -383,13 +383,13 @@ pub struct EcnCounts {
impl std::ops::AddAssign<EcnCodepoint> for EcnCounts {
fn add_assign(&mut self, rhs: EcnCodepoint) {
match rhs {
EcnCodepoint::ECT0 => {
EcnCodepoint::Ect0 => {
self.ect0 += 1;
}
EcnCodepoint::ECT1 => {
EcnCodepoint::Ect1 => {
self.ect1 += 1;
}
EcnCodepoint::CE => {
EcnCodepoint::Ce => {
self.ce += 1;
}
}
+6 -6
View File
@@ -128,11 +128,11 @@ impl fmt::Display for ConnectionId {
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum EcnCodepoint {
#[doc(hidden)]
ECT0 = 0b10,
Ect0 = 0b10,
#[doc(hidden)]
ECT1 = 0b01,
Ect1 = 0b01,
#[doc(hidden)]
CE = 0b11,
Ce = 0b11,
}
impl EcnCodepoint {
@@ -140,9 +140,9 @@ impl EcnCodepoint {
pub fn from_bits(x: u8) -> Option<Self> {
use self::EcnCodepoint::*;
Some(match x & 0b11 {
0b10 => ECT0,
0b01 => ECT1,
0b11 => CE,
0b10 => Ect0,
0b01 => Ect1,
0b11 => Ce,
_ => {
return None;
}