-
Notifications
You must be signed in to change notification settings - Fork 94
Add comprehensive linting #1327
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 all commits
0c6b18b
8c4135c
dc4ec7c
098847c
d4c4ddd
3832092
403d991
812fdaf
8ea425c
bf89dec
ef1b7c8
af625ff
d9585dc
e2561cb
355732e
46a03d7
b604aab
808ac9a
412fd60
ebb079a
3c49f58
8f56c95
154c1d6
2af6c62
c7a3670
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 |
|---|---|---|
|
|
@@ -65,8 +65,26 @@ serde_json = "1.0" | |
| thiserror = "1.0" | ||
|
|
||
| [workspace.lints.clippy] | ||
|
Collaborator
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 guess my question would be why are these lints not enabled by default? Do we want to enable so many? I usually follow the defaults for lints as there is sometimes a reason why they are not enabled yet. As otherwise this can become an explosion of debates.
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. No clippy lints are enabled by default as far as I'm aware. The nice thing about making lints opt-out instead of opt-in is that there are a lot of lints and I think most of them are useful—I learned some new best practices in the course of making this PR, such as clippy::ptr_as_ptr. This PR has actually been something I've been working on for a while because it has been a useful exercise for me, and it has yielded other PRs in the process such as #1324 and #1321. So the effort was worthwhile in itself, even if this PR doesn't get merged.
Collaborator
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. Looking at https://doc.rust-lang.org/clippy/lints.html, it seems that by default only For that reason, I would not enable lints from the "pedantic" group by default. @jnbooth from your experience, are there any particular lints from the pedantic group that you feel have been specifically valuable? |
||
| all = { level = "warn", priority = -1 } | ||
| pedantic = { level = "warn", priority = -1 } | ||
| cast_possible_truncation = "allow" | ||
| cast_possible_wrap = "allow" | ||
| cast_sign_loss = "allow" | ||
| doc_link_with_quotes = "allow" | ||
| doc_markdown = "allow" | ||
| if_not_else = "allow" | ||
| incompatible_msrv = "deny" | ||
| if_not_else = "warn" | ||
| manual_let_else = "warn" | ||
| redundant_else = "warn" | ||
| single_match_else = "warn" | ||
| inline_always = "allow" | ||
| manual_let_else = "allow" | ||
| many_single_char_names = "allow" | ||
| map_unwrap_or = "allow" | ||
| match_wildcard_for_single_variants = "allow" | ||
| module_name_repetitions = "allow" | ||
| must_use_candidate = "allow" | ||
| redundant_else = "allow" | ||
| return_self_not_must_use = "allow" | ||
| should_panic_without_expect = "allow" | ||
| similar_names = "allow" | ||
| single_match_else = "allow" | ||
| struct_excessive_bools = "allow" | ||
| too_many_lines = "allow" | ||
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.
before we were testing in CI with our MSRV, do we not want to do this now?
Or instead should something like clippy be in it's own runner using a newer Rust toolchain 🤔
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.
IMO, clippy could also just be separate runner, as I think it doesn't share many build artifacts with the main build anyhow.