Skip to content

Commit

Permalink
Properly handle different defaults for severity of lints
Browse files Browse the repository at this point in the history
Previously all lints were assumed to be `#[warn]`, and we had a hand-coded list of `#[allow]` exceptions. Now the severity is autogenerated from rustdoc output.

Also support lints that change status between editions, and the `warnings` lint group.
  • Loading branch information
ChayimFriedman2 committed Dec 11, 2024
1 parent a18e38e commit 2950325
Show file tree
Hide file tree
Showing 15 changed files with 6,645 additions and 1,453 deletions.
6 changes: 6 additions & 0 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bda8e21c04aca2ae33ffc2fd8c23134f3cac46db123ba97bd9d3f3b8a4a85e1"

[[package]]
name = "edition"
version = "0.0.0"

[[package]]
name = "either"
version = "1.13.0"
Expand Down Expand Up @@ -1266,6 +1270,7 @@ name = "parser"
version = "0.0.0"
dependencies = [
"drop_bomb",
"edition",
"expect-test",
"limit",
"ra-ap-rustc_lexer",
Expand Down Expand Up @@ -2662,6 +2667,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"directories",
"edition",
"either",
"flate2",
"itertools",
Expand Down
1 change: 1 addition & 0 deletions src/tools/rust-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ toolchain = { path = "./crates/toolchain", version = "0.0.0" }
tt = { path = "./crates/tt", version = "0.0.0" }
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }
edition = { path = "./crates/edition", version = "0.0.0" }

ra-ap-rustc_lexer = { version = "0.85", default-features = false }
ra-ap-rustc_parse_format = { version = "0.85", default-features = false }
Expand Down
13 changes: 13 additions & 0 deletions src/tools/rust-analyzer/crates/edition/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "edition"
version = "0.0.0"
rust-version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true

[dependencies]

[lints]
workspace = true
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! The edition of the Rust language used in a crate.
// Ideally this would be defined in the span crate, but the dependency chain is all over the place
// wrt to span, parser and syntax.
// This should live in a separate crate because we use it in both actual code and codegen.
use std::fmt;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(super) fn complete_lint(
existing_lints: &[ast::Path],
lints_completions: &[Lint],
) {
for &Lint { label, description } in lints_completions {
for &Lint { label, description, .. } in lints_completions {
let (qual, name) = {
// FIXME: change `Lint`'s label to not store a path in it but split the prefix off instead?
let mut parts = label.split("::");
Expand Down
Loading

0 comments on commit 2950325

Please sign in to comment.