You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
svd2rust will generate code which clippy does not like:
error: this operation will always return zero.This is likely not the intended outcome
--> va416xx/src/watch_dog/wdogload.rs:60:23
|
60 | self.w.bits = (self.w.bits& !0xffff_ffff) | (value asu32&0xffff_ffff);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help:for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#erasing_op
warning: the operation is ineffective.Consider reducing it to `value as u32`
--> va416xx/src/watch_dog/wdogload.rs:60:54
|
60 | self.w.bits = (self.w.bits & !0xffff_ffff) | (value as u32&0xffff_ffff);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help:for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
warning: the operation is ineffective.Consider reducing it to `self.bits`
--> va416xx/src/watch_dog/wdogload.rs:68:20
|
68 | CNT_R::new((self.bits &0xffff_ffff) as u32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help:for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
warning: the operation is ineffective.Consider reducing it to `self.bits`
--> va416xx/src/watch_dog/wdogvalue.rs:35:20
|
35 | CNT_R::new((self.bits &0xffff_ffff) as u32)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help:for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op
This probably requires svd2rust to check whether
Only one fields exists
That field has a width of 32 bits.
In that case, the code can be simplified. For example, this code:
impl<'a>CNT_W<'a>{#[doc = r"Writes raw bits to the field"]#[inline(always)]pubunsafefnbits(self,value:u32) -> &'a mutW{self.w.bits = (self.w.bits& !0xffff_ffff) | (value asu32&0xffff_ffff);self.w}}
would become
impl<'a>CNT_W<'a>{#[doc = r"Writes raw bits to the field"]#[inline(always)]pubunsafefnbits(self,value:u32) -> &'a mutW{self.w.bits = value;self.w}}
The text was updated successfully, but these errors were encountered:
This is a bit of a luxury problem but maybe something that could be addressed so I don't need to patch a SVD file which is ok in my opinion.
When faced with a register definitions like this:
svd2rust
will generate code which clippy does not like:This probably requires
svd2rust
to check whetherIn that case, the code can be simplified. For example, this code:
would become
The text was updated successfully, but these errors were encountered: