]> git.lizzy.rs Git - rust.git/blob - clippy_utils/src/paths.rs
b0c3fe1e5a7121d56cafc32e45a0f872536d633b
[rust.git] / 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 pub const ANY_TRAIT: [&str; 3] = ["core", "any", "Any"];
8 #[cfg(feature = "metadata-collector-lint")]
9 pub const APPLICABILITY: [&str; 2] = ["rustc_lint_defs", "Applicability"];
10 #[cfg(feature = "metadata-collector-lint")]
11 pub const APPLICABILITY_VALUES: [[&str; 3]; 4] = [
12     ["rustc_lint_defs", "Applicability", "Unspecified"],
13     ["rustc_lint_defs", "Applicability", "HasPlaceholders"],
14     ["rustc_lint_defs", "Applicability", "MaybeIncorrect"],
15     ["rustc_lint_defs", "Applicability", "MachineApplicable"],
16 ];
17 #[cfg(feature = "metadata-collector-lint")]
18 pub const DIAGNOSTIC_BUILDER: [&str; 3] = ["rustc_errors", "diagnostic_builder", "DiagnosticBuilder"];
19 pub const ARC_PTR_EQ: [&str; 4] = ["alloc", "sync", "Arc", "ptr_eq"];
20 pub const ASMUT_TRAIT: [&str; 3] = ["core", "convert", "AsMut"];
21 pub const ASREF_TRAIT: [&str; 3] = ["core", "convert", "AsRef"];
22 pub(super) const BEGIN_PANIC: [&str; 3] = ["std", "panicking", "begin_panic"];
23 pub(super) const BEGIN_PANIC_FMT: [&str; 3] = ["std", "panicking", "begin_panic_fmt"];
24 /// Preferably use the diagnostic item `sym::Borrow` where possible
25 pub const BORROW_TRAIT: [&str; 3] = ["core", "borrow", "Borrow"];
26 pub const BTREEMAP_CONTAINS_KEY: [&str; 6] = ["alloc", "collections", "btree", "map", "BTreeMap", "contains_key"];
27 pub const BTREEMAP_ENTRY: [&str; 6] = ["alloc", "collections", "btree", "map", "entry", "Entry"];
28 pub const BTREEMAP_INSERT: [&str; 6] = ["alloc", "collections", "btree", "map", "BTreeMap", "insert"];
29 pub const CLONE_TRAIT_METHOD: [&str; 4] = ["core", "clone", "Clone", "clone"];
30 pub const CMP_MAX: [&str; 3] = ["core", "cmp", "max"];
31 pub const CMP_MIN: [&str; 3] = ["core", "cmp", "min"];
32 pub const COW: [&str; 3] = ["alloc", "borrow", "Cow"];
33 pub const CSTRING_AS_C_STR: [&str; 5] = ["std", "ffi", "c_str", "CString", "as_c_str"];
34 pub const DEFAULT_TRAIT_METHOD: [&str; 4] = ["core", "default", "Default", "default"];
35 pub const DEREF_MUT_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "DerefMut", "deref_mut"];
36 /// Preferably use the diagnostic item `sym::deref_method` where possible
37 pub const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", "deref"];
38 pub const DIR_BUILDER: [&str; 3] = ["std", "fs", "DirBuilder"];
39 pub const DISPLAY_TRAIT: [&str; 3] = ["core", "fmt", "Display"];
40 pub const DOUBLE_ENDED_ITERATOR: [&str; 4] = ["core", "iter", "traits", "DoubleEndedIterator"];
41 pub const DROP: [&str; 3] = ["core", "mem", "drop"];
42 pub const DURATION: [&str; 3] = ["core", "time", "Duration"];
43 #[cfg(feature = "internal-lints")]
44 pub const EARLY_CONTEXT: [&str; 2] = ["rustc_lint", "EarlyContext"];
45 pub const EXIT: [&str; 3] = ["std", "process", "exit"];
46 pub const F32_EPSILON: [&str; 4] = ["core", "f32", "<impl f32>", "EPSILON"];
47 pub const F64_EPSILON: [&str; 4] = ["core", "f64", "<impl f64>", "EPSILON"];
48 pub const FILE: [&str; 3] = ["std", "fs", "File"];
49 pub const FILE_TYPE: [&str; 3] = ["std", "fs", "FileType"];
50 pub const FROM_FROM: [&str; 4] = ["core", "convert", "From", "from"];
51 pub const FROM_ITERATOR: [&str; 5] = ["core", "iter", "traits", "collect", "FromIterator"];
52 pub const FROM_ITERATOR_METHOD: [&str; 6] = ["core", "iter", "traits", "collect", "FromIterator", "from_iter"];
53 pub const FROM_STR_METHOD: [&str; 5] = ["core", "str", "traits", "FromStr", "from_str"];
54 pub const FUTURE_FROM_GENERATOR: [&str; 3] = ["core", "future", "from_generator"];
55 pub const HASH: [&str; 3] = ["core", "hash", "Hash"];
56 pub const HASHMAP_CONTAINS_KEY: [&str; 6] = ["std", "collections", "hash", "map", "HashMap", "contains_key"];
57 pub const HASHMAP_ENTRY: [&str; 5] = ["std", "collections", "hash", "map", "Entry"];
58 pub const HASHMAP_INSERT: [&str; 6] = ["std", "collections", "hash", "map", "HashMap", "insert"];
59 #[cfg(feature = "internal-lints")]
60 pub const IDENT: [&str; 3] = ["rustc_span", "symbol", "Ident"];
61 #[cfg(feature = "internal-lints")]
62 pub const IDENT_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Ident", "as_str"];
63 pub const INDEX: [&str; 3] = ["core", "ops", "Index"];
64 pub const INDEX_MUT: [&str; 3] = ["core", "ops", "IndexMut"];
65 pub const INSERT_STR: [&str; 4] = ["alloc", "string", "String", "insert_str"];
66 pub const IO_READ: [&str; 3] = ["std", "io", "Read"];
67 pub const IO_WRITE: [&str; 3] = ["std", "io", "Write"];
68 pub const IPADDR_V4: [&str; 5] = ["std", "net", "ip", "IpAddr", "V4"];
69 pub const IPADDR_V6: [&str; 5] = ["std", "net", "ip", "IpAddr", "V6"];
70 pub const ITER_REPEAT: [&str; 5] = ["core", "iter", "sources", "repeat", "repeat"];
71 #[cfg(feature = "internal-lints")]
72 pub const KW_MODULE: [&str; 3] = ["rustc_span", "symbol", "kw"];
73 #[cfg(feature = "internal-lints")]
74 pub const LATE_CONTEXT: [&str; 2] = ["rustc_lint", "LateContext"];
75 pub const LIBC_STRLEN: [&str; 2] = ["libc", "strlen"];
76 #[cfg(any(feature = "internal-lints", feature = "metadata-collector-lint"))]
77 pub const LINT: [&str; 2] = ["rustc_lint_defs", "Lint"];
78 pub const MEM_DISCRIMINANT: [&str; 3] = ["core", "mem", "discriminant"];
79 pub const MEM_FORGET: [&str; 3] = ["core", "mem", "forget"];
80 pub const MEM_MANUALLY_DROP: [&str; 4] = ["core", "mem", "manually_drop", "ManuallyDrop"];
81 pub const MEM_MAYBEUNINIT: [&str; 4] = ["core", "mem", "maybe_uninit", "MaybeUninit"];
82 pub const MEM_MAYBEUNINIT_UNINIT: [&str; 5] = ["core", "mem", "maybe_uninit", "MaybeUninit", "uninit"];
83 pub const MEM_REPLACE: [&str; 3] = ["core", "mem", "replace"];
84 pub const MEM_SIZE_OF: [&str; 3] = ["core", "mem", "size_of"];
85 pub const MEM_SIZE_OF_VAL: [&str; 3] = ["core", "mem", "size_of_val"];
86 pub const MUTEX_GUARD: [&str; 4] = ["std", "sync", "mutex", "MutexGuard"];
87 pub const OPEN_OPTIONS: [&str; 3] = ["std", "fs", "OpenOptions"];
88 pub const OPS_MODULE: [&str; 2] = ["core", "ops"];
89 /// Preferably use the diagnostic item `sym::option_type` where possible
90 pub const OPTION: [&str; 3] = ["core", "option", "Option"];
91 pub const OPTION_NONE: [&str; 4] = ["core", "option", "Option", "None"];
92 pub const OPTION_SOME: [&str; 4] = ["core", "option", "Option", "Some"];
93 pub const ORD: [&str; 3] = ["core", "cmp", "Ord"];
94 pub const OS_STRING_AS_OS_STR: [&str; 5] = ["std", "ffi", "os_str", "OsString", "as_os_str"];
95 pub const OS_STR_TO_OS_STRING: [&str; 5] = ["std", "ffi", "os_str", "OsStr", "to_os_string"];
96 pub(super) const PANICKING_PANIC: [&str; 3] = ["core", "panicking", "panic"];
97 pub(super) const PANICKING_PANIC_FMT: [&str; 3] = ["core", "panicking", "panic_fmt"];
98 pub(super) const PANICKING_PANIC_STR: [&str; 3] = ["core", "panicking", "panic_str"];
99 pub(super) const PANIC_ANY: [&str; 3] = ["std", "panic", "panic_any"];
100 pub const PARKING_LOT_MUTEX_GUARD: [&str; 2] = ["parking_lot", "MutexGuard"];
101 pub const PARKING_LOT_RWLOCK_READ_GUARD: [&str; 2] = ["parking_lot", "RwLockReadGuard"];
102 pub const PARKING_LOT_RWLOCK_WRITE_GUARD: [&str; 2] = ["parking_lot", "RwLockWriteGuard"];
103 pub const PATH_BUF_AS_PATH: [&str; 4] = ["std", "path", "PathBuf", "as_path"];
104 pub const PATH_TO_PATH_BUF: [&str; 4] = ["std", "path", "Path", "to_path_buf"];
105 pub const PERMISSIONS: [&str; 3] = ["std", "fs", "Permissions"];
106 pub const PERMISSIONS_FROM_MODE: [&str; 7] = ["std", "os", "imp", "unix", "fs", "PermissionsExt", "from_mode"];
107 pub const POLL: [&str; 4] = ["core", "task", "poll", "Poll"];
108 pub const POLL_PENDING: [&str; 5] = ["core", "task", "poll", "Poll", "Pending"];
109 pub const POLL_READY: [&str; 5] = ["core", "task", "poll", "Poll", "Ready"];
110 pub const PTR_COPY: [&str; 3] = ["core", "intrinsics", "copy"];
111 pub const PTR_COPY_NONOVERLAPPING: [&str; 3] = ["core", "intrinsics", "copy_nonoverlapping"];
112 pub const PTR_EQ: [&str; 3] = ["core", "ptr", "eq"];
113 pub const PTR_SLICE_FROM_RAW_PARTS: [&str; 3] = ["core", "ptr", "slice_from_raw_parts"];
114 pub const PTR_SLICE_FROM_RAW_PARTS_MUT: [&str; 3] = ["core", "ptr", "slice_from_raw_parts_mut"];
115 pub const PTR_SWAP_NONOVERLAPPING: [&str; 3] = ["core", "ptr", "swap_nonoverlapping"];
116 pub const PTR_READ: [&str; 3] = ["core", "ptr", "read"];
117 pub const PTR_READ_UNALIGNED: [&str; 3] = ["core", "ptr", "read_unaligned"];
118 pub const PTR_READ_VOLATILE: [&str; 3] = ["core", "ptr", "read_volatile"];
119 pub const PTR_REPLACE: [&str; 3] = ["core", "ptr", "replace"];
120 pub const PTR_SWAP: [&str; 3] = ["core", "ptr", "swap"];
121 pub const PTR_WRITE: [&str; 3] = ["core", "ptr", "write"];
122 pub const PTR_WRITE_BYTES: [&str; 3] = ["core", "intrinsics", "write_bytes"];
123 pub const PTR_WRITE_UNALIGNED: [&str; 3] = ["core", "ptr", "write_unaligned"];
124 pub const PTR_WRITE_VOLATILE: [&str; 3] = ["core", "ptr", "write_volatile"];
125 pub const PUSH_STR: [&str; 4] = ["alloc", "string", "String", "push_str"];
126 pub const RANGE_ARGUMENT_TRAIT: [&str; 3] = ["core", "ops", "RangeBounds"];
127 pub const RC_PTR_EQ: [&str; 4] = ["alloc", "rc", "Rc", "ptr_eq"];
128 pub const REFCELL_REF: [&str; 3] = ["core", "cell", "Ref"];
129 pub const REFCELL_REFMUT: [&str; 3] = ["core", "cell", "RefMut"];
130 pub const REGEX_BUILDER_NEW: [&str; 5] = ["regex", "re_builder", "unicode", "RegexBuilder", "new"];
131 pub const REGEX_BYTES_BUILDER_NEW: [&str; 5] = ["regex", "re_builder", "bytes", "RegexBuilder", "new"];
132 pub const REGEX_BYTES_NEW: [&str; 4] = ["regex", "re_bytes", "Regex", "new"];
133 pub const REGEX_BYTES_SET_NEW: [&str; 5] = ["regex", "re_set", "bytes", "RegexSet", "new"];
134 pub const REGEX_NEW: [&str; 4] = ["regex", "re_unicode", "Regex", "new"];
135 pub const REGEX_SET_NEW: [&str; 5] = ["regex", "re_set", "unicode", "RegexSet", "new"];
136 /// Preferably use the diagnostic item `sym::result_type` where possible
137 pub const RESULT: [&str; 3] = ["core", "result", "Result"];
138 pub const RESULT_ERR: [&str; 4] = ["core", "result", "Result", "Err"];
139 pub const RESULT_OK: [&str; 4] = ["core", "result", "Result", "Ok"];
140 pub const RWLOCK_READ_GUARD: [&str; 4] = ["std", "sync", "rwlock", "RwLockReadGuard"];
141 pub const RWLOCK_WRITE_GUARD: [&str; 4] = ["std", "sync", "rwlock", "RwLockWriteGuard"];
142 pub const SERDE_DESERIALIZE: [&str; 3] = ["serde", "de", "Deserialize"];
143 pub const SERDE_DE_VISITOR: [&str; 3] = ["serde", "de", "Visitor"];
144 pub const SLICE_FROM_RAW_PARTS: [&str; 4] = ["core", "slice", "raw", "from_raw_parts"];
145 pub const SLICE_FROM_RAW_PARTS_MUT: [&str; 4] = ["core", "slice", "raw", "from_raw_parts_mut"];
146 pub const SLICE_INTO_VEC: [&str; 4] = ["alloc", "slice", "<impl [T]>", "into_vec"];
147 pub const SLICE_ITER: [&str; 4] = ["core", "slice", "iter", "Iter"];
148 pub const STDERR: [&str; 4] = ["std", "io", "stdio", "stderr"];
149 pub const STDOUT: [&str; 4] = ["std", "io", "stdio", "stdout"];
150 pub const CONVERT_IDENTITY: [&str; 3] = ["core", "convert", "identity"];
151 pub const STD_FS_CREATE_DIR: [&str; 3] = ["std", "fs", "create_dir"];
152 pub const STRING_AS_MUT_STR: [&str; 4] = ["alloc", "string", "String", "as_mut_str"];
153 pub const STRING_AS_STR: [&str; 4] = ["alloc", "string", "String", "as_str"];
154 pub const STR_ENDS_WITH: [&str; 4] = ["core", "str", "<impl str>", "ends_with"];
155 pub const STR_FROM_UTF8: [&str; 4] = ["core", "str", "converts", "from_utf8"];
156 pub const STR_LEN: [&str; 4] = ["core", "str", "<impl str>", "len"];
157 pub const STR_STARTS_WITH: [&str; 4] = ["core", "str", "<impl str>", "starts_with"];
158 #[cfg(feature = "internal-lints")]
159 pub const SYMBOL: [&str; 3] = ["rustc_span", "symbol", "Symbol"];
160 #[cfg(feature = "internal-lints")]
161 pub const SYMBOL_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Symbol", "as_str"];
162 #[cfg(feature = "internal-lints")]
163 pub const SYMBOL_INTERN: [&str; 4] = ["rustc_span", "symbol", "Symbol", "intern"];
164 #[cfg(feature = "internal-lints")]
165 pub const SYMBOL_TO_IDENT_STRING: [&str; 4] = ["rustc_span", "symbol", "Symbol", "to_ident_string"];
166 #[cfg(feature = "internal-lints")]
167 pub const SYM_MODULE: [&str; 3] = ["rustc_span", "symbol", "sym"];
168 #[cfg(feature = "internal-lints")]
169 pub const SYNTAX_CONTEXT: [&str; 3] = ["rustc_span", "hygiene", "SyntaxContext"];
170 pub const TO_OWNED_METHOD: [&str; 4] = ["alloc", "borrow", "ToOwned", "to_owned"];
171 pub const TO_STRING_METHOD: [&str; 4] = ["alloc", "string", "ToString", "to_string"];
172 pub const TRY_FROM: [&str; 4] = ["core", "convert", "TryFrom", "try_from"];
173 pub const VEC_AS_MUT_SLICE: [&str; 4] = ["alloc", "vec", "Vec", "as_mut_slice"];
174 pub const VEC_AS_SLICE: [&str; 4] = ["alloc", "vec", "Vec", "as_slice"];
175 pub const VEC_FROM_ELEM: [&str; 3] = ["alloc", "vec", "from_elem"];
176 pub const VEC_NEW: [&str; 4] = ["alloc", "vec", "Vec", "new"];
177 pub const VEC_RESIZE: [&str; 4] = ["alloc", "vec", "Vec", "resize"];
178 pub const WEAK_ARC: [&str; 3] = ["alloc", "sync", "Weak"];
179 pub const WEAK_RC: [&str; 3] = ["alloc", "rc", "Weak"];