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    FromStr,
68    FsOpenOptions,
69    FsPermissions,
70    HashMapEntry,
71    Instant,
72    IntoIter,
73    IoBufRead,
74    IoLines,
75    IoRead,
76    IoSeek,
77    IoWrite,
78    IpAddr,
79    Ipv4Addr,
80    Ipv6Addr,
81    IterEmpty,
82    IterOnce,
83    IterPeekable,
84    Itertools,
85    LF: "\n",
86    LateContext,
87    Lazy,
88    LinkedList,
89    Lint,
90    LowerExp,
91    LowerHex,
92    MAX,
93    MIN,
94    MaybeDef,
95    MpmcReceiver,
96    MpscReceiver,
97    MsrvStack,
98    Octal,
99    OpenOptions,
100    OsStr,
101    OsString,
102    Path,
103    PathBuf,
104    PathLookup,
105    PhantomPinned,
106    RangeBounds,
107    RefCellRef,
108    RefCellRefMut,
109    Regex,
110    RegexBuilder,
111    RegexSet,
112    Saturating,
113    SeekFrom,
114    SliceIter,
115    Start,
116    Stdin,
117    Symbol,
118    SyntaxContext,
119    TBD,
120    ToOwned,
121    ToString,
122    UpperExp,
123    UpperHex,
124    V4,
125    V6,
126    VecDeque,
127    Visitor,
128    Wake,
129    Waker,
130    Weak,
131    Wrapping,
132    abs,
133    ambiguous_glob_reexports,
134    app,
135    append,
136    applicability,
137    arg,
138    as_bytes,
139    as_deref,
140    as_deref_mut,
141    as_mut,
142    as_mut_ptr,
143    as_mut_slice,
144    as_path,
145    as_ptr,
146    as_slice,
147    as_str,
148    assert_failed,
149    author,
150    back,
151    binary_heap_pop_if,
152    binaryheap_iter,
153    bool_then,
154    borrow,
155    borrow_mut,
156    box_assume_init_into_vec_unsafe,
157    btreemap_contains_key,
158    btreemap_insert,
159    btreeset_iter,
160    build_hasher,
161    by_ref,
162    bytes,
163    capacity,
164    cargo_clippy: "cargo-clippy",
165    cast,
166    cast_const,
167    cast_mut,
168    ceil,
169    ceil_char_boundary,
170    chain,
171    char_is_ascii,
172    char_to_digit,
173    chars,
174    check_attributes,
175    checked_abs,
176    checked_add,
177    checked_isqrt,
178    checked_mul,
179    checked_pow,
180    checked_rem_euclid,
181    checked_sub,
182    child_id,
183    child_kill,
184    chunks_exact,
185    chunks_exact_mut,
186    clamp,
187    clippy_utils,
188    clone_into,
189    cloned,
190    cmp_max,
191    cmp_min,
192    cognitive_complexity,
193    collapsible_else_if,
194    collapsible_if,
195    collect,
196    const_ptr,
197    contains,
198    convert_identity,
199    copied,
200    copy_from,
201    copy_from_nonoverlapping,
202    copy_to,
203    copy_to_nonoverlapping,
204    core_arch,
205    core_panic_2021_macro,
206    count_ones,
207    create,
208    create_new,
209    cstring_as_c_str,
210    cx,
211    cycle,
212    cyclomatic_complexity,
213    dbg_macro,
214    de,
215    debug_struct,
216    deprecated_in_future,
217    deref_mut_method,
218    diagnostics,
219    disallowed_types,
220    drain,
221    dump,
222    duration_constructors,
223    ends_with,
224    enum_glob_use,
225    enumerate,
226    enumerate_method,
227    err,
228    expect_err,
229    expn_data,
230    exported_private_dependencies,
231    extend,
232    f128_consts_mod,
233    f128_epsilon,
234    f16_consts_mod,
235    f16_epsilon,
236    f32_consts_mod,
237    f32_epsilon,
238    f32_legacy_const_digits,
239    f32_legacy_const_epsilon,
240    f32_legacy_const_infinity,
241    f32_legacy_const_mantissa_dig,
242    f32_legacy_const_max,
243    f32_legacy_const_max_10_exp,
244    f32_legacy_const_max_exp,
245    f32_legacy_const_min,
246    f32_legacy_const_min_10_exp,
247    f32_legacy_const_min_exp,
248    f32_legacy_const_min_positive,
249    f32_legacy_const_nan,
250    f32_legacy_const_neg_infinity,
251    f32_legacy_const_radix,
252    f64_consts_mod,
253    f64_epsilon,
254    f64_legacy_const_digits,
255    f64_legacy_const_epsilon,
256    f64_legacy_const_infinity,
257    f64_legacy_const_mantissa_dig,
258    f64_legacy_const_max,
259    f64_legacy_const_max_10_exp,
260    f64_legacy_const_max_exp,
261    f64_legacy_const_min,
262    f64_legacy_const_min_10_exp,
263    f64_legacy_const_min_exp,
264    f64_legacy_const_min_positive,
265    f64_legacy_const_nan,
266    f64_legacy_const_neg_infinity,
267    f64_legacy_const_radix,
268    file_options,
269    filter,
270    filter_map,
271    find,
272    find_map,
273    finish,
274    finish_non_exhaustive,
275    first,
276    flat_map,
277    flatten,
278    floor,
279    floor_char_boundary,
280    fold,
281    for_each,
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    macro_concat,
410    macro_use_imports,
411    map_break,
412    map_continue,
413    map_or,
414    map_or_else,
415    map_while,
416    match_indices,
417    matches,
418    matches_macro,
419    max,
420    max_by,
421    max_by_key,
422    max_value,
423    maximum,
424    mem_align_of,
425    mem_replace,
426    mem_size_of,
427    mem_size_of_val,
428    min,
429    min_by,
430    min_by_key,
431    min_value,
432    minimum,
433    mode,
434    module_name_repetitions,
435    msrv,
436    msrvs,
437    mul_add,
438    mut_ptr,
439    mutex,
440    needless_return,
441    next_back,
442    next_if,
443    next_if_eq,
444    next_multiple_of,
445    next_tuple,
446    nth,
447    ok,
448    ok_or,
449    once_cell,
450    open,
451    open_options_new,
452    option_expect,
453    option_unwrap,
454    or_default,
455    or_else,
456    or_insert,
457    or_insert_with,
458    os_str_to_os_string,
459    os_string_as_os_str,
460    outer_expn,
461    panic_any,
462    parse,
463    partition,
464    path_main_separator,
465    path_to_pathbuf,
466    pathbuf_as_path,
467    paths,
468    peek,
469    peek_mut,
470    peekable,
471    permissions_from_mode,
472    pin_macro,
473    pop,
474    pop_back,
475    pop_back_if,
476    pop_front,
477    pop_front_if,
478    pop_if,
479    position,
480    pow,
481    powf,
482    powi,
483    process_abort,
484    process_exit,
485    product,
486    ptr_read_volatile,
487    ptr_slice_from_raw_parts,
488    ptr_slice_from_raw_parts_mut,
489    ptr_without_provenance,
490    ptr_without_provenance_mut,
491    push,
492    push_back,
493    push_front,
494    push_str,
495    range_step,
496    read,
497    read_exact,
498    read_line,
499    read_to_end,
500    read_to_string,
501    read_unaligned,
502    read_volatile,
503    reduce,
504    redundant_imports,
505    redundant_pub_crate,
506    regex,
507    rem_euclid,
508    repeat,
509    replace,
510    replacen,
511    res,
512    reserve,
513    resize,
514    restriction,
515    result_ok_method,
516    rev,
517    rfind,
518    rmatch_indices,
519    rmatches,
520    round,
521    rposition,
522    rsplit,
523    rsplit_once,
524    rsplit_terminator,
525    rsplitn,
526    rsplitn_mut,
527    rustc_errors,
528    rustc_lint,
529    rustc_middle,
530    rustc_span,
531    rustfmt_skip,
532    rwlock,
533    saturating_abs,
534    saturating_div,
535    saturating_pow,
536    scan,
537    seek,
538    serde,
539    set_len,
540    set_mode,
541    set_readonly,
542    signum,
543    single_component_path_imports,
544    skip,
545    skip_while,
546    slice_from_ref,
547    slice_iter,
548    slice_mut_unchecked,
549    slice_unchecked,
550    sort,
551    sort_by,
552    sort_unstable_by,
553    span_help,
554    span_lint_and_then,
555    span_note,
556    span_suggestion,
557    split,
558    split_at,
559    split_at_checked,
560    split_at_mut,
561    split_at_mut_checked,
562    split_inclusive,
563    split_once,
564    split_terminator,
565    split_whitespace,
566    splitn,
567    splitn_mut,
568    sqrt,
569    starts_with,
570    std_detect,
571    step_by,
572    str_chars,
573    str_ends_with,
574    str_len,
575    str_split_whitespace,
576    str_starts_with,
577    str_trim,
578    str_trim_end,
579    str_trim_start,
580    string_as_mut_str,
581    string_as_str,
582    string_from_utf8,
583    string_insert_str,
584    string_new,
585    string_push_str,
586    strlen,
587    style,
588    subsec_micros,
589    subsec_nanos,
590    sum,
591    symbol,
592    take,
593    take_while,
594    tcx,
595    then,
596    then_some,
597    thread_local_macro,
598    to_ascii_lowercase,
599    to_ascii_uppercase,
600    to_be_bytes,
601    to_digit,
602    to_le_bytes,
603    to_lowercase,
604    to_ne_bytes,
605    to_os_string,
606    to_owned,
607    to_path_buf,
608    to_string_method,
609    to_uppercase,
610    tokio,
611    trim,
612    trim_end,
613    trim_end_matches,
614    trim_start,
615    trim_start_matches,
616    truncate,
617    try_fold,
618    try_for_each,
619    try_from_fn,
620    unreachable_pub,
621    unsafe_removed_from_name,
622    unused,
623    unused_braces,
624    unused_extern_crates,
625    unused_import_braces,
626    unused_trait_names,
627    unwrap_err,
628    unwrap_err_unchecked,
629    unwrap_or_default,
630    unwrap_or_else,
631    unwrap_unchecked,
632    unzip,
633    utils,
634    vec_as_mut_slice,
635    vec_as_slice,
636    vec_from_elem,
637    vec_is_empty,
638    vec_macro,
639    vec_new,
640    vec_pop,
641    vec_with_capacity,
642    vecdeque_iter,
643    visit_str,
644    visit_string,
645    wake,
646    warnings,
647    wildcard_imports,
648    with_capacity,
649    wrapping_neg,
650    wrapping_offset,
651    write,
652    write_unaligned,
653    write_volatile,
654    writeln,
655    zip,
656}