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    err,
224    expect_err,
225    expn_data,
226    exported_private_dependencies,
227    extend,
228    f128_consts_mod,
229    f128_epsilon,
230    f16_consts_mod,
231    f16_epsilon,
232    f32_consts_mod,
233    f32_epsilon,
234    f32_legacy_const_digits,
235    f32_legacy_const_epsilon,
236    f32_legacy_const_infinity,
237    f32_legacy_const_mantissa_dig,
238    f32_legacy_const_max,
239    f32_legacy_const_max_10_exp,
240    f32_legacy_const_max_exp,
241    f32_legacy_const_min,
242    f32_legacy_const_min_10_exp,
243    f32_legacy_const_min_exp,
244    f32_legacy_const_min_positive,
245    f32_legacy_const_nan,
246    f32_legacy_const_neg_infinity,
247    f32_legacy_const_radix,
248    f64_consts_mod,
249    f64_epsilon,
250    f64_legacy_const_digits,
251    f64_legacy_const_epsilon,
252    f64_legacy_const_infinity,
253    f64_legacy_const_mantissa_dig,
254    f64_legacy_const_max,
255    f64_legacy_const_max_10_exp,
256    f64_legacy_const_max_exp,
257    f64_legacy_const_min,
258    f64_legacy_const_min_10_exp,
259    f64_legacy_const_min_exp,
260    f64_legacy_const_min_positive,
261    f64_legacy_const_nan,
262    f64_legacy_const_neg_infinity,
263    f64_legacy_const_radix,
264    file_options,
265    filter,
266    filter_map,
267    find,
268    find_map,
269    finish,
270    finish_non_exhaustive,
271    first,
272    flat_map,
273    flatten,
274    floor,
275    floor_char_boundary,
276    fold,
277    for_each,
278    from_be_bytes,
279    from_bytes_with_nul,
280    from_bytes_with_nul_unchecked,
281    from_days,
282    from_fn,
283    from_hours,
284    from_le_bytes,
285    from_micros,
286    from_millis,
287    from_mins,
288    from_nanos,
289    from_nanos_u128,
290    from_ne_bytes,
291    from_ptr,
292    from_raw,
293    from_raw_parts,
294    from_secs,
295    from_secs_f32,
296    from_secs_f64,
297    from_str_method,
298    from_str_radix,
299    from_weeks,
300    front,
301    fs,
302    fs_create_dir,
303    fuse,
304    futures_util,
305    get,
306    get_mut,
307    get_or_insert,
308    get_or_insert_with,
309    get_unchecked,
310    get_unchecked_mut,
311    has_significant_drop,
312    hashmap_contains_key,
313    hashmap_drain_ty,
314    hashmap_insert,
315    hashmap_iter_mut_ty,
316    hashmap_iter_ty,
317    hashmap_keys_ty,
318    hashmap_values_mut_ty,
319    hashmap_values_ty,
320    hashset_drain_ty,
321    hashset_iter,
322    hashset_iter_ty,
323    help,
324    hidden_glob_reexports,
325    hygiene,
326    i128_legacy_const_max,
327    i128_legacy_const_min,
328    i128_legacy_fn_max_value,
329    i128_legacy_fn_min_value,
330    i128_legacy_mod,
331    i16_legacy_const_max,
332    i16_legacy_const_min,
333    i16_legacy_fn_max_value,
334    i16_legacy_fn_min_value,
335    i16_legacy_mod,
336    i32_legacy_const_max,
337    i32_legacy_const_min,
338    i32_legacy_fn_max_value,
339    i32_legacy_fn_min_value,
340    i32_legacy_mod,
341    i64_legacy_const_max,
342    i64_legacy_const_min,
343    i64_legacy_fn_max_value,
344    i64_legacy_fn_min_value,
345    i64_legacy_mod,
346    i8_legacy_const_max,
347    i8_legacy_const_min,
348    i8_legacy_fn_max_value,
349    i8_legacy_fn_min_value,
350    i8_legacy_mod,
351    ilog,
352    include_bytes_macro,
353    include_str_macro,
354    insert,
355    insert_str,
356    inspect,
357    instant_now,
358    int_roundings,
359    into,
360    into_bytes,
361    into_ok,
362    into_owned,
363    into_raw,
364    intrinsics_unaligned_volatile_load,
365    intrinsics_unaligned_volatile_store,
366    io,
367    io_error_new,
368    io_errorkind,
369    io_stderr,
370    io_stdout,
371    is_ascii,
372    is_char_boundary,
373    is_diag_item,
374    is_diagnostic_item,
375    is_digit,
376    is_empty,
377    is_err,
378    is_file,
379    is_none,
380    is_none_or,
381    is_ok,
382    is_partitioned,
383    is_some,
384    is_some_and,
385    is_sorted_by_key,
386    isize_legacy_const_max,
387    isize_legacy_const_min,
388    isize_legacy_fn_max_value,
389    isize_legacy_fn_min_value,
390    isize_legacy_mod,
391    isqrt,
392    iter_cloned,
393    iter_copied,
394    iter_filter,
395    iter_repeat,
396    itertools,
397    join,
398    kw,
399    lazy_static,
400    leading_zeros,
401    lint_vec,
402    ln,
403    lock,
404    lock_api,
405    macro_concat,
406    macro_use_imports,
407    map_break,
408    map_continue,
409    map_or,
410    map_or_else,
411    map_while,
412    match_indices,
413    matches,
414    matches_macro,
415    max,
416    max_by,
417    max_by_key,
418    max_value,
419    maximum,
420    mem_align_of,
421    mem_replace,
422    mem_size_of,
423    mem_size_of_val,
424    min,
425    min_by,
426    min_by_key,
427    min_value,
428    minimum,
429    mode,
430    module_name_repetitions,
431    msrv,
432    msrvs,
433    mul_add,
434    mut_ptr,
435    mutex,
436    needless_return,
437    next_back,
438    next_if,
439    next_if_eq,
440    next_multiple_of,
441    next_tuple,
442    nth,
443    ok,
444    ok_or,
445    once_cell,
446    open,
447    open_options_new,
448    option_expect,
449    option_unwrap,
450    or_default,
451    or_else,
452    or_insert,
453    or_insert_with,
454    os_str_to_os_string,
455    os_string_as_os_str,
456    outer_expn,
457    panic_any,
458    parse,
459    partition,
460    path_main_separator,
461    path_to_pathbuf,
462    pathbuf_as_path,
463    paths,
464    peek,
465    peek_mut,
466    peekable,
467    permissions_from_mode,
468    pin_macro,
469    pop,
470    pop_back,
471    pop_back_if,
472    pop_front,
473    pop_front_if,
474    pop_if,
475    position,
476    pow,
477    powf,
478    powi,
479    process_abort,
480    process_exit,
481    product,
482    ptr_read_volatile,
483    ptr_slice_from_raw_parts,
484    ptr_slice_from_raw_parts_mut,
485    ptr_without_provenance,
486    ptr_without_provenance_mut,
487    push,
488    push_back,
489    push_front,
490    push_str,
491    range_step,
492    read,
493    read_exact,
494    read_line,
495    read_to_end,
496    read_to_string,
497    read_unaligned,
498    read_volatile,
499    reduce,
500    redundant_imports,
501    redundant_pub_crate,
502    regex,
503    rem_euclid,
504    repeat,
505    replace,
506    replacen,
507    res,
508    reserve,
509    resize,
510    restriction,
511    result_ok_method,
512    rev,
513    rfind,
514    rmatch_indices,
515    rmatches,
516    round,
517    rposition,
518    rsplit,
519    rsplit_once,
520    rsplit_terminator,
521    rsplitn,
522    rsplitn_mut,
523    rustc_errors,
524    rustc_lint,
525    rustc_middle,
526    rustc_span,
527    rustfmt_skip,
528    rwlock,
529    saturating_abs,
530    saturating_div,
531    saturating_pow,
532    scan,
533    seek,
534    serde,
535    set_len,
536    set_mode,
537    set_readonly,
538    signum,
539    single_component_path_imports,
540    skip,
541    skip_while,
542    slice_from_ref,
543    slice_iter,
544    slice_mut_unchecked,
545    slice_unchecked,
546    sort,
547    sort_by,
548    sort_unstable_by,
549    span_help,
550    span_lint_and_then,
551    span_note,
552    span_suggestion,
553    split,
554    split_at,
555    split_at_checked,
556    split_at_mut,
557    split_at_mut_checked,
558    split_inclusive,
559    split_once,
560    split_terminator,
561    split_whitespace,
562    splitn,
563    splitn_mut,
564    sqrt,
565    starts_with,
566    std_detect,
567    step_by,
568    str_chars,
569    str_ends_with,
570    str_len,
571    str_split_whitespace,
572    str_starts_with,
573    str_trim,
574    str_trim_end,
575    str_trim_start,
576    string_as_mut_str,
577    string_as_str,
578    string_from_utf8,
579    string_insert_str,
580    string_new,
581    string_push_str,
582    strlen,
583    style,
584    subsec_micros,
585    subsec_nanos,
586    sum,
587    symbol,
588    take,
589    take_while,
590    tcx,
591    then,
592    then_some,
593    thread_local_macro,
594    to_ascii_lowercase,
595    to_ascii_uppercase,
596    to_be_bytes,
597    to_digit,
598    to_le_bytes,
599    to_lowercase,
600    to_ne_bytes,
601    to_os_string,
602    to_owned,
603    to_path_buf,
604    to_string_method,
605    to_uppercase,
606    tokio,
607    trim,
608    trim_end,
609    trim_end_matches,
610    trim_start,
611    trim_start_matches,
612    truncate,
613    try_fold,
614    try_for_each,
615    try_from_fn,
616    unreachable_pub,
617    unsafe_removed_from_name,
618    unused,
619    unused_braces,
620    unused_extern_crates,
621    unused_import_braces,
622    unused_trait_names,
623    unwrap_err,
624    unwrap_err_unchecked,
625    unwrap_or_default,
626    unwrap_or_else,
627    unwrap_unchecked,
628    unzip,
629    utils,
630    vec_as_mut_slice,
631    vec_as_slice,
632    vec_from_elem,
633    vec_is_empty,
634    vec_macro,
635    vec_new,
636    vec_pop,
637    vec_with_capacity,
638    vecdeque_iter,
639    visit_str,
640    visit_string,
641    wake,
642    warnings,
643    wildcard_imports,
644    with_capacity,
645    wrapping_neg,
646    wrapping_offset,
647    write,
648    write_unaligned,
649    write_volatile,
650    writeln,
651    zip,
652}