-
Notifications
You must be signed in to change notification settings - Fork 7
Enable clippy in Cargo.toml, fix associated issues #8
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| "rust-analyzer.cargo.target": "thumbv8m.main-none-eabihf", | ||
| "rust-analyzer.check.allTargets": false, | ||
| "rust-analyzer.check.command": "clippy", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this change is controversial. We should discuss whether this is a sensible default for all users in the rp-rs matrix channel.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is difficult to answer. I'm not even sure what my personal preference would be, I often switch between clippy and check.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current CI config fails if there's linting issues (checked with clippy), so it's important that the default IDE configuration points out these issues before pushing. This change simply reconciles the IDE config with the CI config. |
||
| "editor.formatOnSave": true | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,10 @@ edition = "2024" | |
| name = "rp235x-project-template" | ||
| version = "0.1.0" | ||
| license = "MIT OR Apache-2.0" | ||
| description = "Project template for rp235x-hal" | ||
| repository = "https://github.com/rp-rs/rp235x-project-template" | ||
| keywords = ["embedded", "rp235x", "hal", "rust", "template"] | ||
| categories = ["embedded", "hardware-support"] | ||
|
||
|
|
||
| [dependencies] | ||
| cortex-m = "0.7" | ||
|
|
@@ -64,3 +68,12 @@ debug = 2 | |
| debug-assertions = false | ||
| lto = 'fat' | ||
| opt-level = 3 | ||
|
|
||
| [lints.clippy] | ||
| all = { level = "warn", priority = -1 } | ||
| pedantic = { level = "warn", priority = -1 } | ||
| multiple_crate_versions = "allow" | ||
|
|
||
| nursery = { level = "warn", priority = -1 } | ||
| cargo = { level = "warn", priority = -1 } | ||
| # restriction = { level = "warn", priority = -1 } | ||
|
Comment on lines
+72
to
+79
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why these particular settings?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are basically all the stardard lints in an "all lints enabled" repo. It should be easy for people to start with a template that passes all lints, and they can disable linting if they choose. It's way more of a pain to offer a template that fails linting and that has to be fixed in every generated repo. Additionally, I suspect that this template is used by a decent number of people who are still new in Rust. Clippy is a fantastic way to offer "here's the best Rust way to do it" training to people as they write code. Again, easier to disable than enable in a generated repo.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think those are somewhat orthogonal issues. Having the template lint free with the most strict/pedantic selection makes sense. The template is there as a quick starter.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think those are somewhat orthogonal issues. Having the template lint free with the most strict/pedantic selection makes sense. The template is there as a quick starter.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest that writing code that satisfies the linter is the correct way to get going. Writing shitty code is a step of a lot of people's learning paths, but it certainly doesn't have to be. I wish someone gave me a linter when I was learning to code (in Python and C) - would have progressed me along a fair bit faster. Why do you think the default action of users of the template would be to "fiddle with the linter" (which I assume you're implying means to turn off the linter)? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You never mention this change in the PR notes either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being able to re-run CI arbitrarily is helpful in cases of failures, checking against the latest version of Rust (esp. when new linting rules are added), etc. Pretty minor note. I'd consider it a misconfiguration to not have this in basically all repos.