clippy_utils/
sym.rs

1#![allow(non_upper_case_globals)]
2
3use rustc_span::symbol::PREDEFINED_SYMBOLS_COUNT;
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: rustc_span::Symbol = rustc_span::Symbol::new(PREDEFINED_SYMBOLS_COUNT + ${index()});
28        )*
29    };
30}
31
32// List of extra symbols to be included in Clippy (for example, as `sym::ambiguous_glob_reexports`).
33// An alternative content can be specified using a colon after the symbol name.
34//
35// `cargo dev fmt` ensures that the content of the `generate!()` macro call stays sorted.
36generate! {
37    AsyncReadExt,
38    AsyncWriteExt,
39    BACKSLASH_SINGLE_QUOTE: r"\'",
40    Binary,
41    CLIPPY_ARGS,
42    CLIPPY_CONF_DIR,
43    CRLF: "\r\n",
44    Cargo_toml: "Cargo.toml",
45    Current,
46    DOUBLE_QUOTE: "\"",
47    Deserialize,
48    EarlyLintPass,
49    ErrorKind,
50    IntoIter,
51    Itertools,
52    LF: "\n",
53    Lazy,
54    Lint,
55    LowerExp,
56    LowerHex,
57    MAX,
58    MIN,
59    MsrvStack,
60    Octal,
61    OpenOptions,
62    Other,
63    PathLookup,
64    Regex,
65    RegexBuilder,
66    RegexSet,
67    Start,
68    Step,
69    Symbol,
70    SyntaxContext,
71    TBD,
72    UpperExp,
73    UpperHex,
74    V4,
75    V6,
76    Visitor,
77    Weak,
78    abs,
79    align_of,
80    ambiguous_glob_reexports,
81    append,
82    arg,
83    as_bytes,
84    as_deref,
85    as_deref_mut,
86    as_mut,
87    assert_failed,
88    author,
89    borrow,
90    borrow_mut,
91    build_hasher,
92    by_ref,
93    bytes,
94    capacity,
95    cargo_clippy: "cargo-clippy",
96    cast,
97    cast_const,
98    cast_mut,
99    ceil,
100    ceil_char_boundary,
101    chain,
102    chars,
103    checked_abs,
104    checked_add,
105    checked_isqrt,
106    checked_mul,
107    checked_pow,
108    checked_rem_euclid,
109    checked_sub,
110    clamp,
111    clippy_utils,
112    clone_into,
113    cloned,
114    cognitive_complexity,
115    collect,
116    const_ptr,
117    contains,
118    copied,
119    copy_from,
120    copy_from_nonoverlapping,
121    copy_to,
122    copy_to_nonoverlapping,
123    count_ones,
124    cycle,
125    cyclomatic_complexity,
126    de,
127    diagnostics,
128    disallowed_types,
129    drain,
130    dump,
131    ends_with,
132    enum_glob_use,
133    enumerate,
134    err,
135    error,
136    exp,
137    expect_err,
138    expn_data,
139    extend,
140    filter,
141    filter_map,
142    find,
143    find_map,
144    finish,
145    finish_non_exhaustive,
146    first,
147    flat_map,
148    flatten,
149    floor,
150    floor_char_boundary,
151    fold,
152    for_each,
153    from_bytes_with_nul,
154    from_bytes_with_nul_unchecked,
155    from_ptr,
156    from_raw,
157    from_ref,
158    from_str,
159    from_str_radix,
160    fs,
161    fuse,
162    futures_util,
163    get,
164    get_mut,
165    get_or_insert_with,
166    get_unchecked,
167    get_unchecked_mut,
168    has_significant_drop,
169    hidden_glob_reexports,
170    hygiene,
171    if_chain,
172    insert,
173    inspect,
174    int_roundings,
175    into,
176    into_bytes,
177    into_ok,
178    into_owned,
179    io,
180    is_ascii,
181    is_char_boundary,
182    is_digit,
183    is_empty,
184    is_err,
185    is_file,
186    is_none,
187    is_ok,
188    is_some,
189    isqrt,
190    itertools,
191    join,
192    kw,
193    last,
194    lazy_static,
195    ln,
196    lock,
197    lock_api,
198    log,
199    log10,
200    log2,
201    macro_use_imports,
202    map_break,
203    map_continue,
204    map_or,
205    map_or_else,
206    match_indices,
207    matches,
208    max,
209    max_by,
210    max_by_key,
211    max_value,
212    maximum,
213    mem,
214    min,
215    min_by,
216    min_by_key,
217    min_value,
218    minimum,
219    mode,
220    module_name_repetitions,
221    msrv,
222    msrvs,
223    mut_ptr,
224    mutex,
225    needless_return,
226    next_back,
227    next_if,
228    next_if_eq,
229    next_tuple,
230    nth,
231    ok,
232    ok_or,
233    once_cell,
234    open,
235    or_default,
236    or_else,
237    or_insert,
238    or_insert_with,
239    outer_expn,
240    panic_cold_display,
241    panic_cold_explicit,
242    panic_display,
243    panic_str,
244    parse,
245    partition,
246    paths,
247    peek,
248    peek_mut,
249    peekable,
250    pow,
251    powf,
252    powi,
253    product,
254    push,
255    read_line,
256    read_to_end,
257    read_to_string,
258    redundant_pub_crate,
259    regex,
260    rem_euclid,
261    repeat,
262    replace,
263    replacen,
264    reserve,
265    resize,
266    restriction,
267    rev,
268    rfind,
269    rmatch_indices,
270    rmatches,
271    round,
272    rposition,
273    rsplit,
274    rsplit_once,
275    rsplit_terminator,
276    rsplitn,
277    rsplitn_mut,
278    rustc_lint,
279    rustc_lint_defs,
280    rustc_span,
281    rustfmt_skip,
282    rwlock,
283    saturating_abs,
284    saturating_pow,
285    scan,
286    seek,
287    serde,
288    set_len,
289    set_mode,
290    set_readonly,
291    signum,
292    single_component_path_imports,
293    skip_while,
294    slice_mut_unchecked,
295    slice_unchecked,
296    sort,
297    sort_by,
298    sort_unstable_by,
299    span_lint_and_then,
300    split,
301    split_at,
302    split_at_checked,
303    split_at_mut,
304    split_at_mut_checked,
305    split_inclusive,
306    split_once,
307    split_terminator,
308    split_whitespace,
309    splitn,
310    splitn_mut,
311    sqrt,
312    starts_with,
313    step_by,
314    strlen,
315    style,
316    subsec_micros,
317    subsec_nanos,
318    sum,
319    symbol,
320    take,
321    take_while,
322    then,
323    then_some,
324    to_ascii_lowercase,
325    to_ascii_uppercase,
326    to_digit,
327    to_lowercase,
328    to_os_string,
329    to_owned,
330    to_path_buf,
331    to_uppercase,
332    tokio,
333    trim,
334    trim_end_matches,
335    trim_start_matches,
336    unreachable_pub,
337    unsafe_removed_from_name,
338    unused,
339    unused_braces,
340    unused_extern_crates,
341    unused_import_braces,
342    unused_trait_names,
343    unwrap_err,
344    unwrap_err_unchecked,
345    unwrap_or_default,
346    unwrap_or_else,
347    unwrap_unchecked,
348    unzip,
349    utils,
350    wake,
351    warnings,
352    wildcard_imports,
353    with_capacity,
354    wrapping_offset,
355    write,
356    writeln,
357    zip,
358}