rust/clippy_utils/src/sym.rs
2025-05-07 13:52:11 +00:00

200 lines
3.2 KiB
Rust

#![allow(non_upper_case_globals)]
use rustc_span::symbol::PREDEFINED_SYMBOLS_COUNT;
#[doc(no_inline)]
pub use rustc_span::sym::*;
macro_rules! val {
($name:ident) => {
stringify!($name)
};
($name:ident $value:literal) => {
$value
};
}
macro_rules! generate {
($($name:ident $(: $value:literal)? ,)*) => {
/// To be supplied to `rustc_interface::Config`
pub const EXTRA_SYMBOLS: &[&str] = &[
$(
val!($name $($value)?),
)*
];
$(
pub const $name: rustc_span::Symbol = rustc_span::Symbol::new(PREDEFINED_SYMBOLS_COUNT + ${index()});
)*
};
}
generate! {
abs,
align_of,
ambiguous_glob_reexports,
as_bytes,
as_deref_mut,
as_deref,
as_mut,
AsyncReadExt,
AsyncWriteExt,
BACKSLASH_SINGLE_QUOTE: r"\'",
Binary,
build_hasher,
bytes,
cargo_clippy: "cargo-clippy",
Cargo_toml: "Cargo.toml",
cast,
chars,
CLIPPY_ARGS,
CLIPPY_CONF_DIR,
clippy_utils,
clone_into,
cloned,
collect,
const_ptr,
contains,
copied,
CRLF: "\r\n",
Current,
de,
Deserialize,
diagnostics,
disallowed_types,
DOUBLE_QUOTE: "\"",
EarlyLintPass,
ends_with,
enum_glob_use,
error,
ErrorKind,
exp,
extend,
finish_non_exhaustive,
finish,
flat_map,
for_each,
from_bytes_with_nul_unchecked,
from_bytes_with_nul,
from_ptr,
from_raw,
from_ref,
from_str_radix,
fs,
futures_util,
get,
hidden_glob_reexports,
hygiene,
insert,
int_roundings,
into_bytes,
into_owned,
IntoIter,
io,
is_ascii,
is_empty,
is_err,
is_none,
is_ok,
is_some,
itertools,
Itertools,
kw,
last,
lazy_static,
Lazy,
LF: "\n",
Lint,
ln,
lock_api,
log,
LowerExp,
LowerHex,
macro_use_imports,
map_or_else,
map_or,
max,
MAX,
mem,
min,
MIN,
mode,
module_name_repetitions,
msrv,
msrvs,
MsrvStack,
mut_ptr,
mutex,
needless_return,
next_tuple,
Octal,
once_cell,
OpenOptions,
or_default,
Other,
parse,
PathLookup,
paths,
powf,
powi,
push,
redundant_pub_crate,
regex,
Regex,
RegexBuilder,
RegexSet,
reserve,
resize,
restriction,
rustc_lint_defs,
rustc_lint,
rustc_span,
rustfmt_skip,
rwlock,
serde,
set_len,
set_mode,
set_readonly,
signum,
single_component_path_imports,
span_lint_and_then,
split_whitespace,
split,
sqrt,
Start,
Step,
style,
symbol,
Symbol,
SyntaxContext,
take,
TBD,
then_some,
to_ascii_lowercase,
to_ascii_uppercase,
to_digit,
to_lowercase,
to_owned,
to_uppercase,
tokio,
unreachable_pub,
unsafe_removed_from_name,
unused_braces,
unused_extern_crates,
unused_import_braces,
unused_trait_names,
unused,
unwrap_err,
unwrap_or_default,
unwrap_or_else,
UpperExp,
UpperHex,
V4,
V6,
Visitor,
warnings,
Weak,
wildcard_imports,
with_capacity,
wrapping_offset,
}