Skip to content

Commit 86e559b

Browse files
committed
Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
Use Cargo's [workspace.lints.*] to config clippy This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html). By this change, we make the configure more readable and simplify `xargo lint` more.
2 parents 1a0b772 + efc8709 commit 86e559b

File tree

44 files changed

+134
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+134
-2
lines changed

.cargo/config.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xtask = "run --package xtask --bin xtask --"
33
tq = "test -- -q"
44
qt = "tq"
5-
lint = "clippy --all-targets -- -Aclippy::collapsible_if -Aclippy::needless_pass_by_value -Aclippy::nonminimal_bool -Aclippy::redundant_pattern_matching --cap-lints warn"
5+
lint = "clippy --all-targets -- --cap-lints warn"
66

77
[target.x86_64-pc-windows-msvc]
88
linker = "rust-lld"

Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exclude = ["crates/proc-macro-srv/proc-macro-test/"]
44
resolver = "2"
55

66
[workspace.package]
7-
rust-version = "1.70"
7+
rust-version = "1.74"
88
edition = "2021"
99
license = "MIT OR Apache-2.0"
1010
authors = ["rust-analyzer team"]
@@ -133,3 +133,9 @@ xshell = "0.2.5"
133133

134134
# We need to freeze the version of the crate, as the raw-api feature is considered unstable
135135
dashmap = { version = "=5.5.3", features = ["raw-api"] }
136+
137+
[workspace.lints.clippy]
138+
collapsible_if = "allow"
139+
needless_pass_by_value = "allow"
140+
nonminimal_bool = "allow"
141+
redundant_pattern_matching = "allow"

crates/base-db/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ stdx.workspace = true
2525
syntax.workspace = true
2626
vfs.workspace = true
2727
span.workspace = true
28+
29+
[lints]
30+
workspace = true

crates/cfg/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ derive_arbitrary = "1.3.2"
2929
# local deps
3030
mbe.workspace = true
3131
syntax.workspace = true
32+
33+
[lints]
34+
workspace = true

crates/flycheck/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ command-group.workspace = true
2424
paths.workspace = true
2525
stdx.workspace = true
2626
toolchain.workspace = true
27+
28+
[lints]
29+
workspace = true

crates/hir-def/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ test-fixture.workspace = true
5454

5555
[features]
5656
in-rust-tree = ["rustc-dependencies/in-rust-tree"]
57+
58+
[lints]
59+
workspace = true

crates/hir-expand/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ span.workspace = true
3636

3737
[dev-dependencies]
3838
expect-test = "1.4.0"
39+
40+
[lints]
41+
workspace = true

crates/hir-ty/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ test-fixture.workspace = true
5858

5959
[features]
6060
in-rust-tree = ["rustc-dependencies/in-rust-tree"]
61+
62+
[lints]
63+
workspace = true

crates/hir/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ tt.workspace = true
3333

3434
[features]
3535
in-rust-tree = []
36+
37+
[lints]
38+
workspace = true

crates/ide-assists/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ sourcegen.workspace = true
3636

3737
[features]
3838
in-rust-tree = []
39+
40+
[lints]
41+
workspace = true

crates/ide-completion/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ expect-test = "1.4.0"
3636
# local deps
3737
test-utils.workspace = true
3838
test-fixture.workspace = true
39+
40+
[lints]
41+
workspace = true

crates/ide-db/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ xshell.workspace = true
5050
test-utils.workspace = true
5151
test-fixture.workspace = true
5252
sourcegen.workspace = true
53+
54+
[lints]
55+
workspace = true

crates/ide-diagnostics/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ sourcegen.workspace = true
3737

3838
[features]
3939
in-rust-tree = []
40+
41+
[lints]
42+
workspace = true

crates/ide-ssr/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ expect-test = "1.4.0"
3232
# local deps
3333
test-utils.workspace = true
3434
test-fixture.workspace = true
35+
36+
[lints]
37+
workspace = true

crates/ide/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ test-fixture.workspace = true
5454

5555
[features]
5656
in-rust-tree = ["ide-assists/in-rust-tree", "ide-diagnostics/in-rust-tree"]
57+
58+
[lints]
59+
workspace = true

crates/intern/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ dashmap.workspace = true
1818
hashbrown.workspace = true
1919
rustc-hash.workspace = true
2020
triomphe.workspace = true
21+
22+
[lints]
23+
workspace = true

crates/limit/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ rust-version.workspace = true
1111
[features]
1212
tracking = []
1313
default = ["tracking"]
14+
15+
[lints]
16+
workspace = true

crates/load-cargo/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ vfs-notify.workspace = true
2626
span.workspace = true
2727

2828
hir-expand.workspace = true
29+
30+
[lints]
31+
workspace = true

crates/mbe/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ span.workspace = true
2626

2727
[dev-dependencies]
2828
test-utils.workspace = true
29+
30+
[lints]
31+
workspace = true

crates/parser/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ sourcegen.workspace = true
2525

2626
[features]
2727
in-rust-tree = ["rustc-dependencies/in-rust-tree"]
28+
29+
[lints]
30+
workspace = true

crates/paths/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ doctest = false
1616
# serde-derive crate. Even though we don't activate the derive feature here,
1717
# someone else in the crate graph certainly does!
1818
# serde.workspace = true
19+
20+
[lints]
21+
workspace = true

crates/proc-macro-api/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ span.workspace = true
3838
# InternIds for the syntax context
3939
base-db.workspace = true
4040
la-arena.workspace = true
41+
42+
[lints]
43+
workspace = true

crates/proc-macro-srv-cli/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ sysroot-abi = ["proc-macro-srv/sysroot-abi"]
1818
[[bin]]
1919
name = "rust-analyzer-proc-macro-srv"
2020
path = "src/main.rs"
21+
22+
[lints]
23+
workspace = true

crates/proc-macro-srv/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ proc-macro-test.path = "./proc-macro-test"
3838

3939
[features]
4040
sysroot-abi = ["proc-macro-test/sysroot-abi"]
41+
42+
[lints]
43+
workspace = true

crates/profile/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ jemalloc = ["jemalloc-ctl"]
3131

3232
# Uncomment to enable for the whole crate graph
3333
# default = [ "cpu_profiler" ]
34+
35+
[lints]
36+
workspace = true

crates/project-model/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ toolchain.workspace = true
3333

3434
[dev-dependencies]
3535
expect-test = "1.4.0"
36+
37+
[lints]
38+
workspace = true

crates/rust-analyzer/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,6 @@ in-rust-tree = [
9494
"hir-def/in-rust-tree",
9595
"hir-ty/in-rust-tree",
9696
]
97+
98+
[lints]
99+
workspace = true

crates/rustc-dependencies/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ ra-ap-rustc_abi = { version = "0.21.0", default-features = false }
1818

1919
[features]
2020
in-rust-tree = []
21+
22+
[lints]
23+
workspace = true

crates/sourcegen/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ doctest = false
1414

1515
[dependencies]
1616
xshell.workspace = true
17+
18+
[lints]
19+
workspace = true

crates/span/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ rust-analyzer-salsa.workspace = true
1616
vfs.workspace = true
1717
syntax.workspace = true
1818
stdx.workspace = true
19+
20+
[lints]
21+
workspace = true

crates/stdx/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ winapi = { version = "0.3.9", features = ["winerror"] }
2727
[features]
2828
# Uncomment to enable for the whole crate graph
2929
# default = [ "backtrace" ]
30+
31+
[lints]
32+
workspace = true

crates/syntax/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ sourcegen.workspace = true
4242

4343
[features]
4444
in-rust-tree = ["rustc-dependencies/in-rust-tree"]
45+
46+
[lints]
47+
workspace = true

crates/syntax/fuzz/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ path = "fuzz_targets/parser.rs"
2424
[[bin]]
2525
name = "reparse"
2626
path = "fuzz_targets/reparse.rs"
27+
28+
[lints]
29+
workspace = true

crates/test-fixture/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ base-db.workspace = true
1616
rustc-hash.workspace = true
1717
span.workspace = true
1818
stdx.workspace = true
19+
20+
[lints]
21+
workspace = true

crates/test-utils/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ rustc-hash.workspace = true
1919

2020
stdx.workspace = true
2121
profile.workspace = true
22+
23+
[lints]
24+
workspace = true

crates/text-edit/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ doctest = false
1414
[dependencies]
1515
itertools.workspace = true
1616
text-size.workspace = true
17+
18+
[lints]
19+
workspace = true

crates/toolchain/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ doctest = false
1313

1414
[dependencies]
1515
home = "0.5.4"
16+
17+
[lints]
18+
workspace = true

crates/tt/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ stdx.workspace = true
1919

2020
# FIXME: Remove this dependency once the `Span` trait is gone (that is once Span::DUMMY has been removed)
2121
span.workspace = true
22+
23+
[lints]
24+
workspace = true

crates/vfs-notify/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ notify = "6.1.1"
2020
stdx.workspace = true
2121
vfs.workspace = true
2222
paths.workspace = true
23+
24+
[lints]
25+
workspace = true

crates/vfs/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ nohash-hasher.workspace = true
1919

2020
paths.workspace = true
2121
stdx.workspace = true
22+
23+
[lints]
24+
workspace = true

lib/la-arena/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ documentation = "https://docs.rs/la-arena"
88
categories = ["data-structures", "memory-management", "rust-patterns"]
99
edition = "2021"
1010
rust-version = "1.56"
11+
12+
[lints]
13+
workspace = true

lib/line-index/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ edition = "2021"
99
[dependencies]
1010
text-size = "1.1.1"
1111
nohash-hasher = "0.2.0"
12+
13+
[lints]
14+
workspace = true

lib/lsp-server/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ crossbeam-channel = "0.5.8"
1515
[dev-dependencies]
1616
lsp-types = "=0.95"
1717
ctrlc = "3.4.1"
18+
19+
[lints]
20+
workspace = true

xtask/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ xflags = "0.3.0"
1515
time = { version = "0.3", default-features = false }
1616
zip = { version = "0.6", default-features = false, features = ["deflate", "time"] }
1717
# Avoid adding more dependencies to this crate
18+
19+
[lints]
20+
workspace = true

0 commit comments

Comments
 (0)