Skip to content

Commit

Permalink
Remove redundant bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Aug 22, 2023
1 parent 52a9039 commit 8941268
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
12 changes: 3 additions & 9 deletions axum/src/response/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,25 +382,19 @@ impl EventFlags {
const HAS_ID: Self = Self::from_bits(0b1000);

const fn bits(&self) -> u8 {
let bits = self;
bits.0
self.0
}

const fn from_bits(bits: u8) -> Self {
let bits = bits;
Self(bits)
}

const fn contains(&self, other: Self) -> bool {
let same = self;
let other = other;
same.bits() & other.bits() == other.bits()
self.bits() & other.bits() == other.bits()
}

fn insert(&mut self, other: Self) {
let same = self;
let other = other;
*same = Self::from_bits(same.bits() | other.bits());
*self = Self::from_bits(self.bits() | other.bits());
}
}

Expand Down
5 changes: 1 addition & 4 deletions axum/src/routing/method_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ impl MethodFilter {
}

const fn from_bits(bits: u16) -> Self {
let bits = bits;
Self(bits)
}

pub(crate) const fn contains(&self, other: Self) -> bool {
let same = self;
let other = other;
same.bits() & other.bits() == other.bits()
self.bits() & other.bits() == other.bits()
}

/// Performs the OR operation between the [`MethodFilter`] in `self` with `other`.
Expand Down

0 comments on commit 8941268

Please sign in to comment.