Skip to content

Commit 13d5732

Browse files
committed
Categorise paths in clippy_utils::paths
1 parent b2eebee commit 13d5732

File tree

1 file changed

+20
-13
lines changed
  • src/tools/clippy/clippy_utils/src

1 file changed

+20
-13
lines changed

src/tools/clippy/clippy_utils/src/paths.rs

+20-13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! Whenever possible, please consider diagnostic items over hardcoded paths.
55
//! See <https://github.com/rust-lang/rust-clippy/issues/5393> for more information.
66
7+
// Paths inside rustc
78
pub const APPLICABILITY: [&str; 2] = ["rustc_lint_defs", "Applicability"];
89
pub const APPLICABILITY_VALUES: [[&str; 3]; 4] = [
910
["rustc_lint_defs", "Applicability", "Unspecified"],
@@ -14,18 +15,32 @@ pub const APPLICABILITY_VALUES: [[&str; 3]; 4] = [
1415
pub const DIAG: [&str; 2] = ["rustc_errors", "Diag"];
1516
pub const EARLY_CONTEXT: [&str; 2] = ["rustc_lint", "EarlyContext"];
1617
pub const EARLY_LINT_PASS: [&str; 3] = ["rustc_lint", "passes", "EarlyLintPass"];
17-
#[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
18-
pub const FUTURES_IO_ASYNCREADEXT: [&str; 3] = ["futures_util", "io", "AsyncReadExt"];
19-
#[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
20-
pub const FUTURES_IO_ASYNCWRITEEXT: [&str; 3] = ["futures_util", "io", "AsyncWriteExt"];
2118
pub const IDENT: [&str; 3] = ["rustc_span", "symbol", "Ident"];
2219
pub const IDENT_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Ident", "as_str"];
23-
pub const ITERTOOLS_NEXT_TUPLE: [&str; 3] = ["itertools", "Itertools", "next_tuple"];
2420
pub const KW_MODULE: [&str; 3] = ["rustc_span", "symbol", "kw"];
2521
pub const LATE_CONTEXT: [&str; 2] = ["rustc_lint", "LateContext"];
2622
pub const LATE_LINT_PASS: [&str; 3] = ["rustc_lint", "passes", "LateLintPass"];
2723
pub const LINT: [&str; 2] = ["rustc_lint_defs", "Lint"];
24+
pub const SYMBOL: [&str; 3] = ["rustc_span", "symbol", "Symbol"];
25+
pub const SYMBOL_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Symbol", "as_str"];
26+
pub const SYMBOL_INTERN: [&str; 4] = ["rustc_span", "symbol", "Symbol", "intern"];
27+
pub const SYMBOL_TO_IDENT_STRING: [&str; 4] = ["rustc_span", "symbol", "Symbol", "to_ident_string"];
28+
pub const SYM_MODULE: [&str; 3] = ["rustc_span", "symbol", "sym"];
29+
pub const SYNTAX_CONTEXT: [&str; 3] = ["rustc_span", "hygiene", "SyntaxContext"];
30+
31+
// Paths in `core`/`alloc`/`std`. This should be avoided and cleaned up by adding diagnostic items.
32+
pub const STD_IO_SEEK_FROM_CURRENT: [&str; 4] = ["std", "io", "SeekFrom", "Current"];
33+
pub const STD_IO_SEEKFROM_START: [&str; 4] = ["std", "io", "SeekFrom", "Start"];
34+
35+
// Paths in clippy itself
2836
pub const MSRV: [&str; 3] = ["clippy_config", "msrvs", "Msrv"];
37+
38+
// Paths in external crates
39+
#[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
40+
pub const FUTURES_IO_ASYNCREADEXT: [&str; 3] = ["futures_util", "io", "AsyncReadExt"];
41+
#[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
42+
pub const FUTURES_IO_ASYNCWRITEEXT: [&str; 3] = ["futures_util", "io", "AsyncWriteExt"];
43+
pub const ITERTOOLS_NEXT_TUPLE: [&str; 3] = ["itertools", "Itertools", "next_tuple"];
2944
pub const PARKING_LOT_MUTEX_GUARD: [&str; 3] = ["lock_api", "mutex", "MutexGuard"];
3045
pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockReadGuard"];
3146
pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockWriteGuard"];
@@ -37,14 +52,6 @@ pub const REGEX_NEW: [&str; 3] = ["regex", "Regex", "new"];
3752
pub const REGEX_SET_NEW: [&str; 3] = ["regex", "RegexSet", "new"];
3853
pub const SERDE_DESERIALIZE: [&str; 3] = ["serde", "de", "Deserialize"];
3954
pub const SERDE_DE_VISITOR: [&str; 3] = ["serde", "de", "Visitor"];
40-
pub const STD_IO_SEEK_FROM_CURRENT: [&str; 4] = ["std", "io", "SeekFrom", "Current"];
41-
pub const STD_IO_SEEKFROM_START: [&str; 4] = ["std", "io", "SeekFrom", "Start"];
42-
pub const SYMBOL: [&str; 3] = ["rustc_span", "symbol", "Symbol"];
43-
pub const SYMBOL_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Symbol", "as_str"];
44-
pub const SYMBOL_INTERN: [&str; 4] = ["rustc_span", "symbol", "Symbol", "intern"];
45-
pub const SYMBOL_TO_IDENT_STRING: [&str; 4] = ["rustc_span", "symbol", "Symbol", "to_ident_string"];
46-
pub const SYM_MODULE: [&str; 3] = ["rustc_span", "symbol", "sym"];
47-
pub const SYNTAX_CONTEXT: [&str; 3] = ["rustc_span", "hygiene", "SyntaxContext"];
4855
#[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
4956
pub const TOKIO_FILE_OPTIONS: [&str; 5] = ["tokio", "fs", "file", "File", "options"];
5057
#[expect(clippy::invalid_paths)] // internal lints do not know about all external crates

0 commit comments

Comments
 (0)