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