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

Run clippy in the CI with warnings disallowed #23

Merged
merged 4 commits into from Oct 25, 2022

Conversation

MarijnS95
Copy link
Contributor

Depends on #21, and #22 as the latest bindgen fixes clippy lints in generated code

As discussed previously it'd be nice to keep ispc-rs "free" of simple "code smells" commonly pointed out by clippy. This is easy to guard by disallowing any clippy warnings from trickling into the codebase through PRs via an extra CI check.

Downside is that Rust upgrades every 6 weeks and usually enables new or improves existing lints, resulting in unrelated CI errors caused by existing code being punted on unsuspecting contributors in newly opened PRs. But these are typically easy to resolve in a separate PR, or to be caught early when (also) running the CI job on a schedule.

Commit ad85f13 ("Seems like edition in workspace isn't applied? Update
all to 2021") found that `workspace.edition` isn't a valid key and added
it to most crates' individual `[package]` table, but didn't remove the
key from `[workspace]` nor added it to the `compile` and `runtime`
crates.

Note that `[workspace.package] edition = "2021"` exists since Rust 1.64,
but still requires `[package] edition.workspace = true` to be repeated
in every individual `Cargo.toml` for it to be inherited:
https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table
As announced earlier in Twinklebear#20 when introducing `BindgenOptions`, upstream
`bindgen` didn't yet allow cloning nor copying their `Builder` struct,
limiting it to generate a single binding per `Builder` object.  This
doesn't fit with ispc-rs's `Config` struct which explicitly allows
multiple libraries to be compiled using (partially) the same
base configuration (barring any side-effects from `fn compile(&mut self,
lib)` updating various fields depending on `lib`).

This issue has since been addressed upstream, and now allows us to move
and clone the `bindgen::Builder` around instead of implementing a very
limited subset of config fields and manually reconstructing the builder
every time.
As discussed previously it'd be nice to keep `ispc-rs` "free" of simple
"code smells" commonly pointed out by `clippy`.  This is easy to guard
by disallowing any clippy warnings from trickling into the codebase
through PRs via an extra CI check.

Downside is that Rust upgrades every 6 weeks and usually enables new or
improves existing lints, resulting in unrelated CI errors caused by
existing code being punted on unsuspecting contributors in newly opened
PRs.  But these are typically easy to resolve in a separate PR, or to be
caught early when (also) running the CI job on a schedule.
@Twinklebear
Copy link
Owner

Thanks @MarijnS95 , this looks good! I think it makes sense to be strict in CI to catch warnings and fix them early. I'll have to look into how to run the GH actions pipeline on a schedule, since this repo is more in maintenance mode than development so the commit frequency is not so high. I'm just re-running the CI pipelines now after merging your other PRs and will merge when they pass

Though it would be good to work on ISPC GPU support if I can find the time 😄

@Twinklebear Twinklebear merged commit 26d8d2e into Twinklebear:master Oct 25, 2022
@Twinklebear
Copy link
Owner

I merged this one in manually to add in some commits fixing additional warnings/errors that clippy was finding. I also added a scheduled CI run every week so I can catch new lints as they're added

@MarijnS95
Copy link
Contributor Author

@Twinklebear Thanks, looks good!

@MarijnS95 MarijnS95 deleted the clippy branch October 25, 2022 12:06
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.

None yet

2 participants