From 71914c7668f05531767aec361d077fc7c90ac00a Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 8 Jan 2020 10:12:41 -0800 Subject: [PATCH] Fix clippy warnings in EncodingBits --- .../codegen/shared/src/isa/x86/encoding_bits.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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.