abrown opened PR #1324 from fix-warnings
to master
:
abrown requested sstangl for a review on PR #1324.
abrown edited PR #1324 from fix-warnings
to master
:
Prior to this I would see the following on
cargo build
:$ cargo build warning: identical conversion --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:63:26 | 63 | debug_assert_eq!(u8::from(self.rrr()), 0); | ^^^^^^^^^^^^^^^^^^^^ help: consider removing `u8::from()`: `self.rrr()` | = note: `#[warn(clippy::identity_conversion)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:64:23 | 64 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = note: `#[warn(clippy::clone_on_copy)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:73:23 | 73 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy Finished dev [unoptimized + debuginfo] target(s) in 0.04s
bjorn3 submitted PR Review.
bjorn3 submitted PR Review.
bjorn3 created PR Review Comment:
You can use
mut self
here.
abrown updated PR #1324 from fix-warnings
to master
:
Prior to this I would see the following on
cargo build
:$ cargo build warning: identical conversion --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:63:26 | 63 | debug_assert_eq!(u8::from(self.rrr()), 0); | ^^^^^^^^^^^^^^^^^^^^ help: consider removing `u8::from()`: `self.rrr()` | = note: `#[warn(clippy::identity_conversion)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:64:23 | 64 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = note: `#[warn(clippy::clone_on_copy)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:73:23 | 73 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy Finished dev [unoptimized + debuginfo] target(s) in 0.04s
abrown submitted PR Review.
abrown created PR Review Comment:
Good call :+1:
abrown updated PR #1324 from fix-warnings
to master
:
Prior to this I would see the following on
cargo build
:$ cargo build warning: identical conversion --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:63:26 | 63 | debug_assert_eq!(u8::from(self.rrr()), 0); | ^^^^^^^^^^^^^^^^^^^^ help: consider removing `u8::from()`: `self.rrr()` | = note: `#[warn(clippy::identity_conversion)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:64:23 | 64 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = note: `#[warn(clippy::clone_on_copy)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:73:23 | 73 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy Finished dev [unoptimized + debuginfo] target(s) in 0.04s
bnjbvr submitted PR Review.
bnjbvr submitted PR Review.
bnjbvr created PR Review Comment:
Out of curiosity, why was it split into two lines? It seems
dominates
would be dead in a non-debug build.
abrown created PR Review Comment:
clippy was complaining about using something mutable inside the
debug_assert!
(IIRC it wasfunc.layout
); moving the call out of the macro fixed the warning but honestly I didn't give it too much thought. Is there a better way?
abrown submitted PR Review.
abrown updated PR #1324 from fix-warnings
to master
:
Prior to this I would see the following on
cargo build
:$ cargo build warning: identical conversion --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:63:26 | 63 | debug_assert_eq!(u8::from(self.rrr()), 0); | ^^^^^^^^^^^^^^^^^^^^ help: consider removing `u8::from()`: `self.rrr()` | = note: `#[warn(clippy::identity_conversion)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_conversion warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:64:23 | 64 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = note: `#[warn(clippy::clone_on_copy)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy warning: using `clone` on a `Copy` type --> cranelift-codegen/shared/src/isa/x86/encoding_bits.rs:73:23 | 73 | let mut enc = self.clone(); | ^^^^^^^^^^^^ help: try removing the `clone` call: `self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy Finished dev [unoptimized + debuginfo] target(s) in 0.04s
abrown merged PR #1324.
philipc submitted PR Review.
philipc created PR Review Comment:
Seems like a false positive to me, see this reduced case, and it's probably better to ignore clippy here if it's wrong.
Last updated: Nov 22 2024 at 16:03 UTC