Skip to content

Conversation

@briansmith
Copy link
Contributor

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

@briansmith briansmith force-pushed the b/clippy branch 2 times, most recently from 2bfdbca to f40ba84 Compare June 1, 2024 18:58
Ensure that Clippy is looking at as much of the target-specific code as
practical.
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
Contributor Author

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
Contributor Author

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
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
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
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
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
Member

Closing in favor of #477.

@newpavlov newpavlov closed this Jun 14, 2024
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.

3 participants