Closed duskmoon314 closed 7 months ago
TLDR: This PR contains 1 commit:
&
ArrayElemAccessor
needless_borrow
Currently, the generated code contains two parts:
RawArrayAccessor
n
// An example of generated code #[doc = "0x58..0x74 - EMAC MAC Address High Register"] #[inline(always)] pub const fn emac_addr_high(&self, n: usize) -> &EMAC_ADDR_HIGH { #[allow(clippy::no_effect)] [(); 7][n]; unsafe { &*(self as *const Self).cast::<u8>().add(88).add(8 * n).cast() } } #[doc = "0x58 - EMAC MAC Address High Register"] #[inline(always)] pub const fn emac_addr_high1(&self) -> &EMAC_ADDR_HIGH { &self.emac_addr_high(0) }
It is needless to use & in emac_addr_high1.
emac_addr_high1
Consideration
I haven't checked whether there is another situation that ArrayElemAccessor needs &. If so, this PR can be adjusted to ignore clippy warning.
What version of cargo fmt do you use? Stable one with default configuration, please.
cargo fmt
What version of rustfmt do you use? Stable one, please.
I'm checking.
Sorry, I used nightly by mistake. I'm fixing now.
TLDR: This PR contains 1 commit:
&
) inArrayElemAccessor
to solve theneedless_borrow
warningCurrently, the generated code contains two parts:
RawArrayAccessor
takes an argumentn
and returns refArrayElemAccessor
wrapsRawArrayAccessor
It is needless to use
&
inemac_addr_high1
.Consideration
I haven't checked whether there is another situation that
ArrayElemAccessor
needs&
. If so, this PR can be adjusted to ignore clippy warning.