8000 arch: fix clippy warnings by bradjc · Pull Request #4117 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

arch: fix clippy warnings #4117

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

Merged
merged 2 commits into from
Jul 23, 2024
Merged

arch: fix clippy warnings #4117

merged 2 commits into from
Jul 23, 2024

Conversation

bradjc
Copy link
Contributor
@bradjc bradjc commented Jul 22, 2024

Pull Request Overview

For reasons, clippy does not fully check our arch crates. Once #4075 lands, running cargo clippy in a board directly will check more code than we are today, and this fixes the new warnings that come up.

This also adds two fairly arbitrarily selected boards to the clippy CI to automate these checks somewhat.

Testing Strategy

Running cargo clippy on #4075

TODO or Help Wanted

I picked one cortex-m board and one risc-v board. I'm not sure we want to run all boards in CI. Maybe this is good enough? Thoughts?

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

bradjc added 2 commits July 22, 2024 14:40
These only happen when a specific target is selected.
This uses the configured target to check more code.
@github-actions github-actions bot added the risc-v RISC-V architecture label Jul 22, 2024
Comment on lines +402 to +403
@cd boards/nordic/nrf52840dk && cargo clippy -- -D warnings
@cd boards/hifive1 && cargo clippy -- -D warnings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this, I feel like this is destined to go out of sync. That being said, I don't have a better idea. This is, again, caused by conditional compilation, and so I don't have a better idea that does not involve adding a new #[cfg(any(clippy, ... -- for which I know there will be opposition (#4059 (comment)).

Copy link
Contributor Author

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried out that flag and it seems to be everything I want. cargo clippy and cargo check just work as expected, and cargo test fails because we don't have any way to test on an embedded device.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume it would totally break hail on stable, as it would depend on the cortex-m crates and those can't then be compiled with a stable Cargo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

❯ make
error: failed to load manifest for workspace member `/Users/bradjc/git/tock/arch/cortex-m`
referenced by workspace at `/Users/bradjc/git/tock/Cargo.toml`

Caused by:
  failed to parse manifest at `/Users/bradjc/git/tock/arch/cortex-m/Cargo.toml`

Caused by:
  the cargo feature `per-package-target` requires a nightly version of Cargo, but this is the `stable` channel
  See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
  See https://doc.rust-lang.org/cargo/reference/unstable.html#per-package-target for more information about using this feature.
make: *** [/Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail] Error 101
```.

@alevy alevy added the last-call Final review period for a pull request. label Jul 23, 2024
@alevy alevy added this pull request to the merge queue Jul 23, 2024
Merged via the queue into master with commit bbcec36 Jul 23, 2024
18 checks passed
@alevy alevy deleted the clippy-check-arch branch July 23, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
last-call Final review period for a pull request. risc-v RISC-V architecture
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0