Skip to content

CI: Run Clippy for (nearly) all targets. - #447

Closed
briansmith wants to merge 2 commits into
rust-random:masterfrom
briansmith:b/clippy
Closed

CI: Run Clippy for (nearly) all targets.#447
briansmith wants to merge 2 commits into
rust-random:masterfrom
briansmith:b/clippy

Conversation

@briansmith

Copy link
Copy Markdown
Contributor

Ensure that Clippy is looking at as much of the target-specific code as practical.

@briansmith
briansmithforce-pushed the b/clippy branch 2 times, most recently from 2bfdbca to f40ba84CompareJune 1, 2024 18:58
Ensure that Clippy is looking at as much of the target-specific code as
practical.
Comment threadsrc/windows7.rs
pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
// Prevent overflow of u32
for chunk in dest.chunks_mut(u32::max_value() as usize) {
for chunk in dest.chunks_mut(u32::MAX as usize) {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

With the changes to tests.yml, clippy now sees this code.

@briansmith

Copy link
Copy Markdown
ContributorAuthor

The CI failure is the typical Windows wasm32 error.

- if: ${{ matrix.toolchain == 'nightly' }}
run: cargo test --benches
- if: ${{ matrix.toolchain == 'stable' }}
run: cargo clippy --all

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Running Clippy on stable would mean that we can get failing CI on new stable releases. Usually I prefer to fix Clippy version and bump it manually form time to time.

Maybe we should add a single Clippy job which will check a set of targets using cargo clippy --target?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 to using some fixed nightly Clippy and running it on a bunch of targets in a single job

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why Nightly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we want to run clippy on targets which don't have libstd pre built, we will have to use -Z build_std

@newpavlov

Copy link
Copy Markdown
Member

Closing in favor of #477.

Sign up for freeto 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.

3 participants

@briansmith@newpavlov@josephlr