Fix clippy warnings in EncodingBits

This commit is contained in:
Andrew Brown
2020-01-08 10:12:41 -08:00
parent d765677fcc
commit 71914c7668

View File

@@ -59,20 +59,18 @@ impl EncodingBits {
/// Returns a copy of the EncodingBits with the RRR bits set. /// Returns a copy of the EncodingBits with the RRR bits set.
#[inline] #[inline]
pub fn with_rrr(self, rrr: u8) -> Self { pub fn with_rrr(mut self, rrr: u8) -> Self {
debug_assert_eq!(u8::from(self.rrr()), 0); debug_assert_eq!(self.rrr(), 0);
let mut enc = self.clone(); self.write(RRR, rrr.into());
enc.write(RRR, rrr.into()); self
enc
} }
/// Returns a copy of the EncodingBits with the REX.W bit set. /// Returns a copy of the EncodingBits with the REX.W bit set.
#[inline] #[inline]
pub fn with_rex_w(self) -> Self { pub fn with_rex_w(mut self) -> Self {
debug_assert_eq!(self.rex_w(), 0); debug_assert_eq!(self.rex_w(), 0);
let mut enc = self.clone(); self.write(REX_W, 1);
enc.write(REX_W, 1); self
enc
} }
/// Returns the raw bits. /// Returns the raw bits.