diff --git a/cranelift/codegen/shared/src/isa/x86/encoding_bits.rs b/cranelift/codegen/shared/src/isa/x86/encoding_bits.rs index ba6418f7cf..9edb2a6e6f 100644 --- a/cranelift/codegen/shared/src/isa/x86/encoding_bits.rs +++ b/cranelift/codegen/shared/src/isa/x86/encoding_bits.rs @@ -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.