clippy_utils/
sym.rs

1#![allow(non_upper_case_globals)]
2
3use rustc_span::symbol::{PREDEFINED_SYMBOLS_COUNT, Symbol};
4
5#[doc(no_inline)]
6pub use rustc_span::sym::*;
7
8macro_rules! val {
9    ($name:ident) => {
10        stringify!($name)
11    };
12    ($name:ident $value:literal) => {
13        $value
14    };
15}
16
17macro_rules! generate {
18    ($($name:ident $(: $value:literal)? ,)*) => {
19        /// To be supplied to `rustc_interface::Config`
20        pub const EXTRA_SYMBOLS: &[&str] = &[
21            $(
22                val!($name $($value)?),
23            )*
24        ];
25
26        $(
27            pub const $name: Symbol = Symbol::new(PREDEFINED_SYMBOLS_COUNT + ${index()});
28        )*
29    };
30}
31
32generate! {
33    abs,
34    as_bytes,
35    as_deref_mut,
36    as_deref,
37    as_mut,
38    Binary,
39    build_hasher,
40    cargo_clippy: "cargo-clippy",
41    Cargo_toml: "Cargo.toml",
42    cast,
43    chars,
44    CLIPPY_ARGS,
45    CLIPPY_CONF_DIR,
46    clone_into,
47    cloned,
48    collect,
49    contains,
50    copied,
51    CRLF: "\r\n",
52    Current,
53    ends_with,
54    exp,
55    extend,
56    finish_non_exhaustive,
57    finish,
58    flat_map,
59    for_each,
60    from_raw,
61    from_str_radix,
62    get,
63    insert,
64    int_roundings,
65    into_bytes,
66    into_owned,
67    IntoIter,
68    is_ascii,
69    is_empty,
70    is_err,
71    is_none,
72    is_ok,
73    is_some,
74    last,
75    LF: "\n",
76    LowerExp,
77    LowerHex,
78    max,
79    min,
80    mode,
81    msrv,
82    Octal,
83    or_default,
84    parse,
85    push,
86    regex,
87    reserve,
88    resize,
89    restriction,
90    rustfmt_skip,
91    set_len,
92    set_mode,
93    set_readonly,
94    signum,
95    split_whitespace,
96    split,
97    Start,
98    take,
99    TBD,
100    then_some,
101    to_digit,
102    to_owned,
103    unused_extern_crates,
104    unwrap_err,
105    unwrap_or_default,
106    UpperExp,
107    UpperHex,
108    V4,
109    V6,
110    Weak,
111    with_capacity,
112    wrapping_offset,
113}