]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/clippy_utils/src/paths.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / src / tools / clippy / clippy_utils / src / paths.rs
1 //! This module contains paths to types and functions Clippy needs to know
2 //! about.
3 //!
4 //! Whenever possible, please consider diagnostic items over hardcoded paths.
5 //! See <https://github.com/rust-lang/rust-clippy/issues/5393> for more information.
6
7 #[cfg(feature = "internal")]
8 pub const APPLICABILITY: [&str; 2] = ["rustc_lint_defs", "Applicability"];
9 #[cfg(feature = "internal")]
10 pub const APPLICABILITY_VALUES: [[&str; 3]; 4] = [
11 ["rustc_lint_defs", "Applicability", "Unspecified"],
12 ["rustc_lint_defs", "Applicability", "HasPlaceholders"],
13 ["rustc_lint_defs", "Applicability", "MaybeIncorrect"],
14 ["rustc_lint_defs", "Applicability", "MachineApplicable"],
15 ];
16 #[cfg(feature = "internal")]
17 pub const DIAGNOSTIC_BUILDER: [&str; 3] = ["rustc_errors", "diagnostic_builder", "DiagnosticBuilder"];
18 pub const ARC_PTR_EQ: [&str; 4] = ["alloc", "sync", "Arc", "ptr_eq"];
19 pub const BTREEMAP_CONTAINS_KEY: [&str; 6] = ["alloc", "collections", "btree", "map", "BTreeMap", "contains_key"];
20 pub const BTREEMAP_INSERT: [&str; 6] = ["alloc", "collections", "btree", "map", "BTreeMap", "insert"];
21 pub const BTREESET_ITER: [&str; 6] = ["alloc", "collections", "btree", "set", "BTreeSet", "iter"];
22 pub const CLONE_TRAIT_METHOD: [&str; 4] = ["core", "clone", "Clone", "clone"];
23 pub const CORE_ITER_CLONED: [&str; 6] = ["core", "iter", "traits", "iterator", "Iterator", "cloned"];
24 pub const CORE_ITER_COPIED: [&str; 6] = ["core", "iter", "traits", "iterator", "Iterator", "copied"];
25 pub const CORE_ITER_FILTER: [&str; 6] = ["core", "iter", "traits", "iterator", "Iterator", "filter"];
26 pub const CSTRING_AS_C_STR: [&str; 5] = ["alloc", "ffi", "c_str", "CString", "as_c_str"];
27 pub const DEFAULT_TRAIT_METHOD: [&str; 4] = ["core", "default", "Default", "default"];
28 pub const DEREF_MUT_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "DerefMut", "deref_mut"];
29 #[cfg(feature = "internal")]
30 pub const EARLY_CONTEXT: [&str; 2] = ["rustc_lint", "EarlyContext"];
31 #[cfg(feature = "internal")]
32 pub const EARLY_LINT_PASS: [&str; 3] = ["rustc_lint", "passes", "EarlyLintPass"];
33 pub const EXIT: [&str; 3] = ["std", "process", "exit"];
34 pub const F32_EPSILON: [&str; 4] = ["core", "f32", "<impl f32>", "EPSILON"];
35 pub const F64_EPSILON: [&str; 4] = ["core", "f64", "<impl f64>", "EPSILON"];
36 pub const FROM_ITERATOR_METHOD: [&str; 6] = ["core", "iter", "traits", "collect", "FromIterator", "from_iter"];
37 pub const FROM_STR_METHOD: [&str; 5] = ["core", "str", "traits", "FromStr", "from_str"];
38 #[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
39 pub const FUTURES_IO_ASYNCREADEXT: [&str; 3] = ["futures_util", "io", "AsyncReadExt"];
40 #[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
41 pub const FUTURES_IO_ASYNCWRITEEXT: [&str; 3] = ["futures_util", "io", "AsyncWriteExt"];
42 pub const HASHMAP_CONTAINS_KEY: [&str; 6] = ["std", "collections", "hash", "map", "HashMap", "contains_key"];
43 pub const HASHMAP_INSERT: [&str; 6] = ["std", "collections", "hash", "map", "HashMap", "insert"];
44 pub const HASHSET_ITER: [&str; 6] = ["std", "collections", "hash", "set", "HashSet", "iter"];
45 #[cfg(feature = "internal")]
46 pub const IDENT: [&str; 3] = ["rustc_span", "symbol", "Ident"];
47 #[cfg(feature = "internal")]
48 pub const IDENT_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Ident", "as_str"];
49 pub const INSERT_STR: [&str; 4] = ["alloc", "string", "String", "insert_str"];
50 pub const ITER_EMPTY: [&str; 5] = ["core", "iter", "sources", "empty", "Empty"];
51 pub const ITERTOOLS_NEXT_TUPLE: [&str; 3] = ["itertools", "Itertools", "next_tuple"];
52 #[cfg(feature = "internal")]
53 pub const KW_MODULE: [&str; 3] = ["rustc_span", "symbol", "kw"];
54 #[cfg(feature = "internal")]
55 pub const LATE_CONTEXT: [&str; 2] = ["rustc_lint", "LateContext"];
56 #[cfg(feature = "internal")]
57 pub const LATE_LINT_PASS: [&str; 3] = ["rustc_lint", "passes", "LateLintPass"];
58 #[cfg(feature = "internal")]
59 pub const LINT: [&str; 2] = ["rustc_lint_defs", "Lint"];
60 pub const MEM_SWAP: [&str; 3] = ["core", "mem", "swap"];
61 #[cfg(feature = "internal")]
62 pub const MSRV: [&str; 3] = ["clippy_utils", "msrvs", "Msrv"];
63 pub const OPEN_OPTIONS: [&str; 3] = ["std", "fs", "OpenOptions"];
64 pub const OS_STRING_AS_OS_STR: [&str; 5] = ["std", "ffi", "os_str", "OsString", "as_os_str"];
65 pub const OS_STR_TO_OS_STRING: [&str; 5] = ["std", "ffi", "os_str", "OsStr", "to_os_string"];
66 pub const PARKING_LOT_MUTEX_GUARD: [&str; 3] = ["lock_api", "mutex", "MutexGuard"];
67 pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockReadGuard"];
68 pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 3] = ["lock_api", "rwlock", "RwLockWriteGuard"];
69 pub const PATH_BUF_AS_PATH: [&str; 4] = ["std", "path", "PathBuf", "as_path"];
70 pub const PATH_TO_PATH_BUF: [&str; 4] = ["std", "path", "Path", "to_path_buf"];
71 pub const PEEKABLE: [&str; 5] = ["core", "iter", "adapters", "peekable", "Peekable"];
72 pub const PERMISSIONS: [&str; 3] = ["std", "fs", "Permissions"];
73 #[cfg_attr(not(unix), allow(clippy::invalid_paths))]
74 pub const PERMISSIONS_FROM_MODE: [&str; 6] = ["std", "os", "unix", "fs", "PermissionsExt", "from_mode"];
75 pub const PTR_COPY: [&str; 3] = ["core", "intrinsics", "copy"];
76 pub const PTR_COPY_NONOVERLAPPING: [&str; 3] = ["core", "intrinsics", "copy_nonoverlapping"];
77 pub const PTR_EQ: [&str; 3] = ["core", "ptr", "eq"];
78 pub const PTR_SLICE_FROM_RAW_PARTS: [&str; 3] = ["core", "ptr", "slice_from_raw_parts"];
79 pub const PTR_SLICE_FROM_RAW_PARTS_MUT: [&str; 3] = ["core", "ptr", "slice_from_raw_parts_mut"];
80 pub const PTR_SWAP_NONOVERLAPPING: [&str; 3] = ["core", "ptr", "swap_nonoverlapping"];
81 pub const PTR_READ: [&str; 3] = ["core", "ptr", "read"];
82 pub const PTR_READ_UNALIGNED: [&str; 3] = ["core", "ptr", "read_unaligned"];
83 pub const PTR_READ_VOLATILE: [&str; 3] = ["core", "ptr", "read_volatile"];
84 pub const PTR_REPLACE: [&str; 3] = ["core", "ptr", "replace"];
85 pub const PTR_SWAP: [&str; 3] = ["core", "ptr", "swap"];
86 pub const PTR_UNALIGNED_VOLATILE_LOAD: [&str; 3] = ["core", "intrinsics", "unaligned_volatile_load"];
87 pub const PTR_UNALIGNED_VOLATILE_STORE: [&str; 3] = ["core", "intrinsics", "unaligned_volatile_store"];
88 pub const PTR_WRITE: [&str; 3] = ["core", "ptr", "write"];
89 pub const PTR_WRITE_BYTES: [&str; 3] = ["core", "intrinsics", "write_bytes"];
90 pub const PTR_WRITE_UNALIGNED: [&str; 3] = ["core", "ptr", "write_unaligned"];
91 pub const PTR_WRITE_VOLATILE: [&str; 3] = ["core", "ptr", "write_volatile"];
92 pub const PUSH_STR: [&str; 4] = ["alloc", "string", "String", "push_str"];
93 pub const RANGE_ARGUMENT_TRAIT: [&str; 3] = ["core", "ops", "RangeBounds"];
94 pub const RC_PTR_EQ: [&str; 4] = ["alloc", "rc", "Rc", "ptr_eq"];
95 pub const REFCELL_REF: [&str; 3] = ["core", "cell", "Ref"];
96 pub const REFCELL_REFMUT: [&str; 3] = ["core", "cell", "RefMut"];
97 pub const REGEX_BUILDER_NEW: [&str; 5] = ["regex", "re_builder", "unicode", "RegexBuilder", "new"];
98 pub const REGEX_BYTES_BUILDER_NEW: [&str; 5] = ["regex", "re_builder", "bytes", "RegexBuilder", "new"];
99 pub const REGEX_BYTES_NEW: [&str; 4] = ["regex", "re_bytes", "Regex", "new"];
100 pub const REGEX_BYTES_SET_NEW: [&str; 5] = ["regex", "re_set", "bytes", "RegexSet", "new"];
101 pub const REGEX_NEW: [&str; 4] = ["regex", "re_unicode", "Regex", "new"];
102 pub const REGEX_SET_NEW: [&str; 5] = ["regex", "re_set", "unicode", "RegexSet", "new"];
103 pub const SERDE_DESERIALIZE: [&str; 3] = ["serde", "de", "Deserialize"];
104 pub const SERDE_DE_VISITOR: [&str; 3] = ["serde", "de", "Visitor"];
105 pub const SLICE_FROM_RAW_PARTS: [&str; 4] = ["core", "slice", "raw", "from_raw_parts"];
106 pub const SLICE_FROM_RAW_PARTS_MUT: [&str; 4] = ["core", "slice", "raw", "from_raw_parts_mut"];
107 pub const SLICE_GET: [&str; 4] = ["core", "slice", "<impl [T]>", "get"];
108 pub const SLICE_INTO_VEC: [&str; 4] = ["alloc", "slice", "<impl [T]>", "into_vec"];
109 pub const SLICE_INTO: [&str; 4] = ["core", "slice", "<impl [T]>", "iter"];
110 pub const SLICE_ITER: [&str; 4] = ["core", "slice", "iter", "Iter"];
111 pub const STDERR: [&str; 4] = ["std", "io", "stdio", "stderr"];
112 pub const STDOUT: [&str; 4] = ["std", "io", "stdio", "stdout"];
113 pub const CONVERT_IDENTITY: [&str; 3] = ["core", "convert", "identity"];
114 pub const STD_FS_CREATE_DIR: [&str; 3] = ["std", "fs", "create_dir"];
115 pub const STD_IO_SEEK: [&str; 3] = ["std", "io", "Seek"];
116 pub const STD_IO_SEEK_FROM_CURRENT: [&str; 4] = ["std", "io", "SeekFrom", "Current"];
117 pub const STD_IO_SEEKFROM_START: [&str; 4] = ["std", "io", "SeekFrom", "Start"];
118 pub const STRING_AS_MUT_STR: [&str; 4] = ["alloc", "string", "String", "as_mut_str"];
119 pub const STRING_AS_STR: [&str; 4] = ["alloc", "string", "String", "as_str"];
120 pub const STRING_NEW: [&str; 4] = ["alloc", "string", "String", "new"];
121 pub const STR_BYTES: [&str; 4] = ["core", "str", "<impl str>", "bytes"];
122 pub const STR_CHARS: [&str; 4] = ["core", "str", "<impl str>", "chars"];
123 pub const STR_ENDS_WITH: [&str; 4] = ["core", "str", "<impl str>", "ends_with"];
124 pub const STR_FROM_UTF8: [&str; 4] = ["core", "str", "converts", "from_utf8"];
125 pub const STR_FROM_UTF8_UNCHECKED: [&str; 4] = ["core", "str", "converts", "from_utf8_unchecked"];
126 pub const STR_LEN: [&str; 4] = ["core", "str", "<impl str>", "len"];
127 pub const STR_STARTS_WITH: [&str; 4] = ["core", "str", "<impl str>", "starts_with"];
128 #[cfg(feature = "internal")]
129 pub const SYMBOL: [&str; 3] = ["rustc_span", "symbol", "Symbol"];
130 #[cfg(feature = "internal")]
131 pub const SYMBOL_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Symbol", "as_str"];
132 #[cfg(feature = "internal")]
133 pub const SYMBOL_INTERN: [&str; 4] = ["rustc_span", "symbol", "Symbol", "intern"];
134 #[cfg(feature = "internal")]
135 pub const SYMBOL_TO_IDENT_STRING: [&str; 4] = ["rustc_span", "symbol", "Symbol", "to_ident_string"];
136 #[cfg(feature = "internal")]
137 pub const SYM_MODULE: [&str; 3] = ["rustc_span", "symbol", "sym"];
138 #[cfg(feature = "internal")]
139 pub const SYNTAX_CONTEXT: [&str; 3] = ["rustc_span", "hygiene", "SyntaxContext"];
140 pub const TO_OWNED_METHOD: [&str; 4] = ["alloc", "borrow", "ToOwned", "to_owned"];
141 pub const TO_STRING_METHOD: [&str; 4] = ["alloc", "string", "ToString", "to_string"];
142 #[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
143 pub const TOKIO_IO_ASYNCREADEXT: [&str; 5] = ["tokio", "io", "util", "async_read_ext", "AsyncReadExt"];
144 #[expect(clippy::invalid_paths)] // internal lints do not know about all external crates
145 pub const TOKIO_IO_ASYNCWRITEEXT: [&str; 5] = ["tokio", "io", "util", "async_write_ext", "AsyncWriteExt"];
146 pub const TRY_FROM: [&str; 4] = ["core", "convert", "TryFrom", "try_from"];
147 pub const VEC_AS_MUT_SLICE: [&str; 4] = ["alloc", "vec", "Vec", "as_mut_slice"];
148 pub const VEC_AS_SLICE: [&str; 4] = ["alloc", "vec", "Vec", "as_slice"];
149 pub const VEC_DEQUE_ITER: [&str; 5] = ["alloc", "collections", "vec_deque", "VecDeque", "iter"];
150 pub const VEC_FROM_ELEM: [&str; 3] = ["alloc", "vec", "from_elem"];
151 pub const VEC_NEW: [&str; 4] = ["alloc", "vec", "Vec", "new"];
152 pub const VEC_RESIZE: [&str; 4] = ["alloc", "vec", "Vec", "resize"];
153 pub const WEAK_ARC: [&str; 3] = ["alloc", "sync", "Weak"];
154 pub const WEAK_RC: [&str; 3] = ["alloc", "rc", "Weak"];
155 pub const PTR_NON_NULL: [&str; 4] = ["core", "ptr", "non_null", "NonNull"];
156 pub const INSTANT_NOW: [&str; 4] = ["std", "time", "Instant", "now"];
157 pub const INSTANT: [&str; 3] = ["std", "time", "Instant"];