Skip to main content

clippy_utils/
sym.rs

1#![expect(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    Any,
38    Applicability,
39    ArrayIntoIter,
40    AsyncReadExt,
41    AsyncWriteExt,
42    BACKSLASH_SINGLE_QUOTE: r"\'",
43    BITS,
44    BTreeEntry,
45    BTreeSet,
46    Binary,
47    BinaryHeap,
48    CLIPPY_ARGS,
49    CLIPPY_CONF_DIR,
50    CRLF: "\r\n",
51    Cargo_toml: "Cargo.toml",
52    Child,
53    Command,
54    Current,
55    DOUBLE_QUOTE: "\"",
56    DebugStruct,
57    Deserialize,
58    DirBuilder,
59    DoubleEndedIterator,
60    Duration,
61    EarlyContext,
62    EarlyLintPass,
63    Enumerate,
64    Error,
65    File,
66    FileType,
67    FsOpenOptions,
68    FsPermissions,
69    HashMapEntry,
70    Instant,
71    IntoIter,
72    IoBufRead,
73    IoLines,
74    IoRead,
75    IoSeek,
76    IoWrite,
77    IpAddr,
78    Ipv4Addr,
79    Ipv6Addr,
80    IterEmpty,
81    IterOnce,
82    IterPeekable,
83    Itertools,
84    LF: "\n",
85    LateContext,
86    Lazy,
87    LinkedList,
88    Lint,
89    LowerExp,
90    LowerHex,
91    MAX,
92    MIN,
93    MaybeDef,
94    MpmcReceiver,
95    MpscReceiver,
96    MsrvStack,
97    Octal,
98    OpenOptions,
99    OsStr,
100    OsString,
101    Path,
102    PathBuf,
103    PathLookup,
104    PhantomPinned,
105    RangeBounds,
106    RefCellRef,
107    RefCellRefMut,
108    Regex,
109    RegexBuilder,
110    RegexSet,
111    Saturating,
112    SeekFrom,
113    SliceIter,
114    Start,
115    Stdin,
116    Symbol,
117    SyntaxContext,
118    TBD,
119    ToOwned,
120    ToString,
121    UpperExp,
122    UpperHex,
123    V4,
124    V6,
125    VecDeque,
126    Visitor,
127    Wake,
128    Waker,
129    Weak,
130    Wrapping,
131    abs,
132    ambiguous_glob_reexports,
133    app,
134    append,
135    applicability,
136    arg,
137    as_bytes,
138    as_deref,
139    as_deref_mut,
140    as_mut,
141    as_path,
142    as_ptr,
143    as_str,
144    assert_failed,
145    author,
146    back,
147    binary_heap_pop_if,
148    binaryheap_iter,
149    bool_then,
150    borrow,
151    borrow_mut,
152    box_assume_init_into_vec_unsafe,
153    btreemap_contains_key,
154    btreemap_insert,
155    btreeset_iter,
156    build_hasher,
157    by_ref,
158    bytes,
159    capacity,
160    cargo_clippy: "cargo-clippy",
161    cast,
162    cast_const,
163    cast_mut,
164    ceil,
165    ceil_char_boundary,
166    chain,
167    char_is_ascii,
168    char_to_digit,
169    chars,
170    check_attributes,
171    checked_abs,
172    checked_add,
173    checked_isqrt,
174    checked_mul,
175    checked_pow,
176    checked_rem_euclid,
177    checked_sub,
178    child_id,
179    child_kill,
180    chunks_exact,
181    chunks_exact_mut,
182    clamp,
183    clippy_utils,
184    clone_into,
185    cloned,
186    cmp_max,
187    cmp_min,
188    cognitive_complexity,
189    collapsible_else_if,
190    collapsible_if,
191    collect,
192    const_ptr,
193    contains,
194    convert_identity,
195    copied,
196    copy_from,
197    copy_from_nonoverlapping,
198    copy_to,
199    copy_to_nonoverlapping,
200    core_arch,
201    core_panic_2021_macro,
202    count_ones,
203    create,
204    create_new,
205    cstring_as_c_str,
206    cx,
207    cycle,
208    cyclomatic_complexity,
209    dbg_macro,
210    de,
211    debug_struct,
212    deprecated_in_future,
213    deref_mut_method,
214    diagnostics,
215    disallowed_types,
216    drain,
217    dump,
218    duration_constructors,
219    ends_with,
220    enum_glob_use,
221    enumerate,
222    enumerate_method,
223    eprint_macro,
224    eprintln_macro,
225    err,
226    exp,
227    expect_err,
228    expn_data,
229    exported_private_dependencies,
230    extend,
231    f128_consts_mod,
232    f128_epsilon,
233    f16_consts_mod,
234    f16_epsilon,
235    f32_consts_mod,
236    f32_epsilon,
237    f32_legacy_const_digits,
238    f32_legacy_const_epsilon,
239    f32_legacy_const_infinity,
240    f32_legacy_const_mantissa_dig,
241    f32_legacy_const_max,
242    f32_legacy_const_max_10_exp,
243    f32_legacy_const_max_exp,
244    f32_legacy_const_min,
245    f32_legacy_const_min_10_exp,
246    f32_legacy_const_min_exp,
247    f32_legacy_const_min_positive,
248    f32_legacy_const_nan,
249    f32_legacy_const_neg_infinity,
250    f32_legacy_const_radix,
251    f64_consts_mod,
252    f64_epsilon,
253    f64_legacy_const_digits,
254    f64_legacy_const_epsilon,
255    f64_legacy_const_infinity,
256    f64_legacy_const_mantissa_dig,
257    f64_legacy_const_max,
258    f64_legacy_const_max_10_exp,
259    f64_legacy_const_max_exp,
260    f64_legacy_const_min,
261    f64_legacy_const_min_10_exp,
262    f64_legacy_const_min_exp,
263    f64_legacy_const_min_positive,
264    f64_legacy_const_nan,
265    f64_legacy_const_neg_infinity,
266    f64_legacy_const_radix,
267    file_options,
268    filter,
269    filter_map,
270    find,
271    find_map,
272    finish,
273    finish_non_exhaustive,
274    first,
275    flat_map,
276    flatten,
277    floor,
278    floor_char_boundary,
279    fold,
280    for_each,
281    format_args_macro,
282    from_be_bytes,
283    from_bytes_with_nul,
284    from_bytes_with_nul_unchecked,
285    from_days,
286    from_fn,
287    from_hours,
288    from_le_bytes,
289    from_micros,
290    from_millis,
291    from_mins,
292    from_nanos,
293    from_nanos_u128,
294    from_ne_bytes,
295    from_ptr,
296    from_raw,
297    from_raw_parts,
298    from_secs,
299    from_secs_f32,
300    from_secs_f64,
301    from_str_method,
302    from_str_radix,
303    from_weeks,
304    front,
305    fs,
306    fs_create_dir,
307    fuse,
308    futures_util,
309    get,
310    get_mut,
311    get_or_insert,
312    get_or_insert_with,
313    get_unchecked,
314    get_unchecked_mut,
315    has_significant_drop,
316    hashmap_contains_key,
317    hashmap_drain_ty,
318    hashmap_insert,
319    hashmap_iter_mut_ty,
320    hashmap_iter_ty,
321    hashmap_keys_ty,
322    hashmap_values_mut_ty,
323    hashmap_values_ty,
324    hashset_drain_ty,
325    hashset_iter,
326    hashset_iter_ty,
327    help,
328    hidden_glob_reexports,
329    hygiene,
330    i128_legacy_const_max,
331    i128_legacy_const_min,
332    i128_legacy_fn_max_value,
333    i128_legacy_fn_min_value,
334    i128_legacy_mod,
335    i16_legacy_const_max,
336    i16_legacy_const_min,
337    i16_legacy_fn_max_value,
338    i16_legacy_fn_min_value,
339    i16_legacy_mod,
340    i32_legacy_const_max,
341    i32_legacy_const_min,
342    i32_legacy_fn_max_value,
343    i32_legacy_fn_min_value,
344    i32_legacy_mod,
345    i64_legacy_const_max,
346    i64_legacy_const_min,
347    i64_legacy_fn_max_value,
348    i64_legacy_fn_min_value,
349    i64_legacy_mod,
350    i8_legacy_const_max,
351    i8_legacy_const_min,
352    i8_legacy_fn_max_value,
353    i8_legacy_fn_min_value,
354    i8_legacy_mod,
355    ilog,
356    include_bytes_macro,
357    include_str_macro,
358    insert,
359    insert_str,
360    inspect,
361    instant_now,
362    int_roundings,
363    into,
364    into_bytes,
365    into_ok,
366    into_owned,
367    into_raw,
368    intrinsics_unaligned_volatile_load,
369    intrinsics_unaligned_volatile_store,
370    io,
371    io_error_new,
372    io_errorkind,
373    io_stderr,
374    io_stdout,
375    is_ascii,
376    is_char_boundary,
377    is_diag_item,
378    is_diagnostic_item,
379    is_digit,
380    is_empty,
381    is_err,
382    is_file,
383    is_none,
384    is_none_or,
385    is_ok,
386    is_partitioned,
387    is_some,
388    is_some_and,
389    is_sorted_by_key,
390    isize_legacy_const_max,
391    isize_legacy_const_min,
392    isize_legacy_fn_max_value,
393    isize_legacy_fn_min_value,
394    isize_legacy_mod,
395    isqrt,
396    iter_cloned,
397    iter_copied,
398    iter_filter,
399    iter_repeat,
400    itertools,
401    join,
402    kw,
403    lazy_static,
404    leading_zeros,
405    lint_vec,
406    ln,
407    lock,
408    lock_api,
409    log,
410    log10,
411    log2,
412    macro_concat,
413    macro_use_imports,
414    map_break,
415    map_continue,
416    map_or,
417    map_or_else,
418    map_while,
419    match_indices,
420    matches,
421    matches_macro,
422    max,
423    max_by,
424    max_by_key,
425    max_value,
426    maximum,
427    mem_align_of,
428    mem_replace,
429    mem_size_of,
430    mem_size_of_val,
431    min,
432    min_by,
433    min_by_key,
434    min_value,
435    minimum,
436    mode,
437    module_name_repetitions,
438    msrv,
439    msrvs,
440    mut_ptr,
441    mutex,
442    needless_return,
443    next_back,
444    next_if,
445    next_if_eq,
446    next_multiple_of,
447    next_tuple,
448    nth,
449    ok,
450    ok_or,
451    once_cell,
452    open,
453    open_options_new,
454    option_expect,
455    option_unwrap,
456    or_default,
457    or_else,
458    or_insert,
459    or_insert_with,
460    os_str_to_os_string,
461    os_string_as_os_str,
462    outer_expn,
463    panic_any,
464    parse,
465    partition,
466    path_main_separator,
467    path_to_pathbuf,
468    pathbuf_as_path,
469    paths,
470    peek,
471    peek_mut,
472    peekable,
473    permissions_from_mode,
474    pin_macro,
475    pop,
476    pop_back,
477    pop_back_if,
478    pop_front,
479    pop_front_if,
480    pop_if,
481    position,
482    pow,
483    powf,
484    powi,
485    print_macro,
486    println_macro,
487    process_abort,
488    process_exit,
489    product,
490    ptr_read_volatile,
491    ptr_slice_from_raw_parts,
492    ptr_slice_from_raw_parts_mut,
493    ptr_without_provenance,
494    ptr_without_provenance_mut,
495    push,
496    push_back,
497    push_front,
498    push_str,
499    range_step,
500    read,
501    read_exact,
502    read_line,
503    read_to_end,
504    read_to_string,
505    read_unaligned,
506    read_volatile,
507    reduce,
508    redundant_imports,
509    redundant_pub_crate,
510    regex,
511    rem_euclid,
512    repeat,
513    replace,
514    replacen,
515    res,
516    reserve,
517    resize,
518    restriction,
519    result_ok_method,
520    rev,
521    rfind,
522    rmatch_indices,
523    rmatches,
524    round,
525    rposition,
526    rsplit,
527    rsplit_once,
528    rsplit_terminator,
529    rsplitn,
530    rsplitn_mut,
531    rustc_errors,
532    rustc_lint,
533    rustc_lint_defs,
534    rustc_middle,
535    rustc_span,
536    rustfmt_skip,
537    rwlock,
538    saturating_abs,
539    saturating_div,
540    saturating_pow,
541    scan,
542    seek,
543    serde,
544    set_len,
545    set_mode,
546    set_readonly,
547    signum,
548    single_component_path_imports,
549    skip,
550    skip_while,
551    slice_from_ref,
552    slice_iter,
553    slice_mut_unchecked,
554    slice_unchecked,
555    sort,
556    sort_by,
557    sort_unstable_by,
558    span_help,
559    span_lint_and_then,
560    span_note,
561    span_suggestion,
562    split,
563    split_at,
564    split_at_checked,
565    split_at_mut,
566    split_at_mut_checked,
567    split_inclusive,
568    split_once,
569    split_terminator,
570    split_whitespace,
571    splitn,
572    splitn_mut,
573    sqrt,
574    starts_with,
575    std_detect,
576    step_by,
577    str_chars,
578    str_ends_with,
579    str_len,
580    str_split_whitespace,
581    str_starts_with,
582    str_trim,
583    str_trim_end,
584    str_trim_start,
585    string_as_mut_str,
586    string_as_str,
587    string_from_utf8,
588    string_insert_str,
589    string_new,
590    string_push_str,
591    strlen,
592    style,
593    subsec_micros,
594    subsec_nanos,
595    sum,
596    symbol,
597    take,
598    take_while,
599    tcx,
600    then,
601    then_some,
602    thread_local_macro,
603    to_ascii_lowercase,
604    to_ascii_uppercase,
605    to_be_bytes,
606    to_digit,
607    to_le_bytes,
608    to_lowercase,
609    to_ne_bytes,
610    to_os_string,
611    to_owned,
612    to_path_buf,
613    to_string_method,
614    to_uppercase,
615    todo_macro,
616    tokio,
617    trim,
618    trim_end,
619    trim_end_matches,
620    trim_start,
621    trim_start_matches,
622    truncate,
623    try_fold,
624    try_for_each,
625    try_from_fn,
626    unimplemented_macro,
627    unreachable_pub,
628    unsafe_removed_from_name,
629    unused,
630    unused_braces,
631    unused_extern_crates,
632    unused_import_braces,
633    unused_trait_names,
634    unwrap_err,
635    unwrap_err_unchecked,
636    unwrap_or_default,
637    unwrap_or_else,
638    unwrap_unchecked,
639    unzip,
640    utils,
641    vec_as_mut_slice,
642    vec_as_slice,
643    vec_from_elem,
644    vec_is_empty,
645    vec_macro,
646    vec_new,
647    vec_pop,
648    vec_with_capacity,
649    vecdeque_iter,
650    visit_str,
651    visit_string,
652    wake,
653    warnings,
654    wildcard_imports,
655    with_capacity,
656    wrapping_neg,
657    wrapping_offset,
658    write,
659    write_unaligned,
660    write_volatile,
661    writeln,
662    zip,
663}