Skip to main content

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    Applicability,
38    AsyncReadExt,
39    AsyncWriteExt,
40    BACKSLASH_SINGLE_QUOTE: r"\'",
41    Binary,
42    CLIPPY_ARGS,
43    CLIPPY_CONF_DIR,
44    CRLF: "\r\n",
45    Cargo_toml: "Cargo.toml",
46    Current,
47    DOUBLE_QUOTE: "\"",
48    Deserialize,
49    EarlyContext,
50    EarlyLintPass,
51    IntoIter,
52    Itertools,
53    LF: "\n",
54    LateContext,
55    Lazy,
56    Lint,
57    LowerExp,
58    LowerHex,
59    MAX,
60    MIN,
61    MaybeDef,
62    MsrvStack,
63    Octal,
64    OpenOptions,
65    PathLookup,
66    Regex,
67    RegexBuilder,
68    RegexSet,
69    Start,
70    Symbol,
71    SyntaxContext,
72    TBD,
73    UpperExp,
74    UpperHex,
75    V4,
76    V6,
77    Visitor,
78    Weak,
79    abs,
80    ambiguous_glob_reexports,
81    app,
82    append,
83    applicability,
84    arg,
85    as_bytes,
86    as_deref,
87    as_deref_mut,
88    as_mut,
89    as_path,
90    assert_failed,
91    author,
92    borrow,
93    borrow_mut,
94    build_hasher,
95    by_ref,
96    bytes,
97    capacity,
98    cargo_clippy: "cargo-clippy",
99    cast,
100    cast_const,
101    cast_mut,
102    ceil,
103    ceil_char_boundary,
104    chain,
105    chars,
106    check_attributes,
107    checked_abs,
108    checked_add,
109    checked_isqrt,
110    checked_mul,
111    checked_pow,
112    checked_rem_euclid,
113    checked_sub,
114    clamp,
115    clippy_utils,
116    clone_into,
117    cloned,
118    cognitive_complexity,
119    collapsible_else_if,
120    collapsible_if,
121    collect,
122    const_ptr,
123    contains,
124    copied,
125    copy_from,
126    copy_from_nonoverlapping,
127    copy_to,
128    copy_to_nonoverlapping,
129    core_arch,
130    count_ones,
131    create,
132    create_new,
133    cx,
134    cycle,
135    cyclomatic_complexity,
136    de,
137    deprecated_in_future,
138    diagnostics,
139    disallowed_types,
140    drain,
141    dump,
142    duration_constructors,
143    ends_with,
144    enum_glob_use,
145    enumerate,
146    err,
147    exp,
148    expect_err,
149    expn_data,
150    exported_private_dependencies,
151    extend,
152    filter,
153    filter_map,
154    find,
155    find_map,
156    finish,
157    finish_non_exhaustive,
158    first,
159    flat_map,
160    flatten,
161    floor,
162    floor_char_boundary,
163    fold,
164    for_each,
165    from_be_bytes,
166    from_bytes_with_nul,
167    from_bytes_with_nul_unchecked,
168    from_days,
169    from_hours,
170    from_le_bytes,
171    from_micros,
172    from_millis,
173    from_mins,
174    from_nanos,
175    from_ne_bytes,
176    from_ptr,
177    from_raw,
178    from_raw_parts,
179    from_secs,
180    from_str_radix,
181    from_weeks,
182    fs,
183    fuse,
184    futures_util,
185    get,
186    get_mut,
187    get_or_insert,
188    get_or_insert_with,
189    get_unchecked,
190    get_unchecked_mut,
191    has_significant_drop,
192    help,
193    hidden_glob_reexports,
194    hygiene,
195    ilog,
196    insert,
197    insert_str,
198    inspect,
199    int_roundings,
200    into,
201    into_bytes,
202    into_ok,
203    into_owned,
204    io,
205    is_ascii,
206    is_char_boundary,
207    is_diag_item,
208    is_diagnostic_item,
209    is_digit,
210    is_empty,
211    is_err,
212    is_file,
213    is_none,
214    is_none_or,
215    is_ok,
216    is_partitioned,
217    is_some,
218    is_some_and,
219    is_sorted_by_key,
220    isqrt,
221    itertools,
222    join,
223    kw,
224    lazy_static,
225    leading_zeros,
226    lint_vec,
227    ln,
228    lock,
229    lock_api,
230    log,
231    log10,
232    log2,
233    macro_use_imports,
234    map_break,
235    map_continue,
236    map_or,
237    map_or_else,
238    map_while,
239    match_indices,
240    matches,
241    max,
242    max_by,
243    max_by_key,
244    max_value,
245    maximum,
246    min,
247    min_by,
248    min_by_key,
249    min_value,
250    minimum,
251    mode,
252    module_name_repetitions,
253    msrv,
254    msrvs,
255    mut_ptr,
256    mutex,
257    needless_return,
258    next_back,
259    next_if,
260    next_if_eq,
261    next_multiple_of,
262    next_tuple,
263    nth,
264    ok,
265    ok_or,
266    once_cell,
267    open,
268    or_default,
269    or_else,
270    or_insert,
271    or_insert_with,
272    outer_expn,
273    panic_str,
274    parse,
275    partition,
276    paths,
277    peek,
278    peek_mut,
279    peekable,
280    pow,
281    powf,
282    powi,
283    product,
284    push,
285    push_back,
286    push_front,
287    push_str,
288    read,
289    read_exact,
290    read_line,
291    read_to_end,
292    read_to_string,
293    read_unaligned,
294    read_volatile,
295    reduce,
296    redundant_imports,
297    redundant_pub_crate,
298    regex,
299    rem_euclid,
300    repeat,
301    replace,
302    replacen,
303    res,
304    reserve,
305    resize,
306    restriction,
307    rev,
308    rfind,
309    rmatch_indices,
310    rmatches,
311    round,
312    rposition,
313    rsplit,
314    rsplit_once,
315    rsplit_terminator,
316    rsplitn,
317    rsplitn_mut,
318    rustc_errors,
319    rustc_lint,
320    rustc_lint_defs,
321    rustc_middle,
322    rustc_span,
323    rustfmt_skip,
324    rwlock,
325    saturating_abs,
326    saturating_pow,
327    scan,
328    seek,
329    serde,
330    set_len,
331    set_mode,
332    set_readonly,
333    signum,
334    single_component_path_imports,
335    skip_while,
336    slice_mut_unchecked,
337    slice_unchecked,
338    sort,
339    sort_by,
340    sort_unstable_by,
341    span_help,
342    span_lint_and_then,
343    span_note,
344    span_suggestion,
345    split,
346    split_at,
347    split_at_checked,
348    split_at_mut,
349    split_at_mut_checked,
350    split_inclusive,
351    split_once,
352    split_terminator,
353    split_whitespace,
354    splitn,
355    splitn_mut,
356    sqrt,
357    starts_with,
358    std_detect,
359    step_by,
360    strlen,
361    style,
362    subsec_micros,
363    subsec_nanos,
364    sum,
365    symbol,
366    take,
367    take_while,
368    tcx,
369    then,
370    then_some,
371    to_ascii_lowercase,
372    to_ascii_uppercase,
373    to_be_bytes,
374    to_digit,
375    to_le_bytes,
376    to_lowercase,
377    to_ne_bytes,
378    to_os_string,
379    to_owned,
380    to_path_buf,
381    to_uppercase,
382    tokio,
383    trim,
384    trim_end,
385    trim_end_matches,
386    trim_start,
387    trim_start_matches,
388    truncate,
389    try_fold,
390    try_for_each,
391    unreachable_pub,
392    unsafe_removed_from_name,
393    unused,
394    unused_braces,
395    unused_extern_crates,
396    unused_import_braces,
397    unused_trait_names,
398    unwrap_err,
399    unwrap_err_unchecked,
400    unwrap_or_default,
401    unwrap_or_else,
402    unwrap_unchecked,
403    unzip,
404    utils,
405    visit_str,
406    visit_string,
407    wake,
408    warnings,
409    wildcard_imports,
410    with_capacity,
411    wrapping_offset,
412    write,
413    write_unaligned,
414    write_volatile,
415    writeln,
416    zip,
417}