Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some clippy lints triggered by rust beta #802

Merged
merged 1 commit into from
Jun 30, 2024
Merged

Conversation

jannic
Copy link
Member

@jannic jannic commented May 4, 2024

No description provided.

@jannic
Copy link
Member Author

jannic commented May 4, 2024

Fails on older rust versions with:

unknown lint: `clippy::missing_transmute_annotations`

I wonder what's the best way to handle this:

  • also add #[allow(unknown_lints)]
  • add type annotations to all transmute calls to fix the lint (a lot of noise, IMHO)
  • do nothing and live with the clippy warning in beta for now

@jannic
Copy link
Member Author

jannic commented May 24, 2024

I think I was too quick with my suggestion to add #![allow(clippy::missing_transmute_annotations)] - the transmutes nightly clippy warns about are actually buggy. 😨

Eg.:

warning: transmute used without annotations
   --> rp2040-hal/src/gpio/pin/pin_sealed.rs:144:37
    |
144 |                     0 => core::mem::transmute(&qspi.gpio_qspi_sclk()),
    |                                     ^^^^^^^^^ help: consider adding missing annotations: `transmute::<&&rp2040_pac::generic::Reg<rp2040_pac::pads_qspi::gpio_qspi_sclk::GPIO_QSPI_SCLK_SPEC>, &rp2040_pac::generic::Reg<rp2040_pac::pads_bank0::gpio::GPIO_SPEC>>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations
    = note: `#[warn(clippy::missing_transmute_annotations)]` on by default

Note that it transmutes from &&Reg to &Reg which is obviously bogus.
I'll fix this in a separate ticket.

@jannic jannic marked this pull request as draft May 24, 2024 15:48
@jannic jannic marked this pull request as ready for review May 24, 2024 21:22
@jannic jannic changed the title Fix or disable some clippy lints triggered by rust beta Fix some clippy lints triggered by rust beta May 24, 2024
@ithinuel ithinuel merged commit 6263d70 into rp-rs:main Jun 30, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants