-
Notifications
You must be signed in to change notification settings - Fork 40
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
move clippy args to [workspace.lints.clippy]
#5715
Changes from 4 commits
2a85f42
1614dbc
587d3ad
b5f8bb3
82fed53
42384f2
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 |
---|---|---|
|
@@ -162,6 +162,43 @@ default-members = [ | |
] | ||
resolver = "2" | ||
|
||
# | ||
# Tree-wide lint configuration. | ||
# https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-lints-section | ||
# | ||
# For a list of Clippy lints, see | ||
# https://rust-lang.github.io/rust-clippy/master. | ||
# | ||
[workspace.lints.clippy] | ||
# Clippy's style nits are useful, but not worth keeping in CI. | ||
style = { level = "allow", priority = -1 } | ||
# But continue to warn on anything in the "disallowed_" namespace. | ||
disallowed_macros = "warn" | ||
disallowed_methods = "warn" | ||
disallowed_names = "warn" | ||
disallowed_script_idents = "warn" | ||
disallowed_types = "warn" | ||
# Warn on some more style lints that are relatively stable and make sense. | ||
iter_cloned_collect = "warn" | ||
iter_next_slice = "warn" | ||
iter_nth = "warn" | ||
iter_nth_zero = "warn" | ||
iter_skip_next = "warn" | ||
len_zero = "warn" | ||
redundant_field_names = "warn" | ||
# `declare_interior_mutable_const` is classified as a style lint, but it can | ||
# identify real bugs (e.g., declarying a `const Atomic` and using it like | ||
# a `static Atomic`). However, it is also subject to false positives (e.g., | ||
# idiomatically declaring a static array of atomics uses `const Atomic`). We | ||
# warn on this to catch the former, and expect any uses of the latter to allow | ||
# this locally. | ||
Comment on lines
+191
to
+194
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. take it or leave it: maybe worth also mentioning |
||
declare_interior_mutable_const = "warn" | ||
# Also warn on casts, preferring explicit conversions instead. | ||
# | ||
# We'd like to warn on lossy casts in the future, but lossless casts are the | ||
# easiest ones to convert over. | ||
cast_lossless = "warn" | ||
|
||
[workspace.dependencies] | ||
anyhow = "1.0" | ||
anstyle = "1.0.6" | ||
|
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.
what does
priority = -1
do? i assume it allows this to be overridden, but why do we only need to set it here?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.
Until
[lints]
, all methods for modifying lint levels had inherent ordering; either command line flags, or attributes in code. TOML tables are explicitly unordered, so Rust had to do something different here. Per the RFC any sorting beyond user-defined priorities is undefined (more detail);style
has to come first because otherwise it would re-allow thestyle
lints that happen to come before it once sorted.The default
priority
for any key in this table is 0, so setting this to -1 means it is ordered before the rest of the keys.