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    allow_attributes,
134    ambiguous_glob_reexports,
135    app,
136    append,
137    applicability,
138    arg,
139    as_bytes,
140    as_deref,
141    as_deref_mut,
142    as_mut,
143    as_mut_ptr,
144    as_mut_slice,
145    as_path,
146    as_ptr,
147    as_slice,
148    as_str,
149    assert_failed,
150    author,
151    back,
152    binary_heap_pop_if,
153    binaryheap_iter,
154    bool_then,
155    borrow,
156    borrow_mut,
157    box_assume_init_into_vec_unsafe,
158    btreemap_contains_key,
159    btreemap_insert,
160    btreeset_iter,
161    build_hasher,
162    by_ref,
163    bytes,
164    capacity,
165    cargo_clippy: "cargo-clippy",
166    cast,
167    cast_const,
168    cast_mut,
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_char_boundary,
279    fold,
280    for_each,
281    from_be_bytes,
282    from_bytes_with_nul,
283    from_bytes_with_nul_unchecked,
284    from_days,
285    from_fn,
286    from_hours,
287    from_le_bytes,
288    from_micros,
289    from_millis,
290    from_mins,
291    from_nanos,
292    from_nanos_u128,
293    from_ne_bytes,
294    from_ptr,
295    from_raw,
296    from_raw_parts,
297    from_secs,
298    from_secs_f32,
299    from_secs_f64,
300    from_str_method,
301    from_str_radix,
302    from_weeks,
303    front,
304    fs,
305    fs_create_dir,
306    fuse,
307    futures_util,
308    get,
309    get_mut,
310    get_or_insert,
311    get_or_insert_with,
312    get_unchecked,
313    get_unchecked_mut,
314    has_significant_drop,
315    hashmap_contains_key,
316    hashmap_drain_ty,
317    hashmap_insert,
318    hashmap_iter_mut_ty,
319    hashmap_iter_ty,
320    hashmap_keys_ty,
321    hashmap_values_mut_ty,
322    hashmap_values_ty,
323    hashset_drain_ty,
324    hashset_iter,
325    hashset_iter_ty,
326    help,
327    hidden_glob_reexports,
328    hygiene,
329    i128_legacy_const_max,
330    i128_legacy_const_min,
331    i128_legacy_fn_max_value,
332    i128_legacy_fn_min_value,
333    i128_legacy_mod,
334    i16_legacy_const_max,
335    i16_legacy_const_min,
336    i16_legacy_fn_max_value,
337    i16_legacy_fn_min_value,
338    i16_legacy_mod,
339    i32_legacy_const_max,
340    i32_legacy_const_min,
341    i32_legacy_fn_max_value,
342    i32_legacy_fn_min_value,
343    i32_legacy_mod,
344    i64_legacy_const_max,
345    i64_legacy_const_min,
346    i64_legacy_fn_max_value,
347    i64_legacy_fn_min_value,
348    i64_legacy_mod,
349    i8_legacy_const_max,
350    i8_legacy_const_min,
351    i8_legacy_fn_max_value,
352    i8_legacy_fn_min_value,
353    i8_legacy_mod,
354    ilog,
355    include_bytes_macro,
356    include_str_macro,
357    insert,
358    insert_str,
359    inspect,
360    instant_now,
361    int_roundings,
362    into,
363    into_bytes,
364    into_ok,
365    into_owned,
366    into_raw,
367    intrinsics_unaligned_volatile_load,
368    intrinsics_unaligned_volatile_store,
369    io,
370    io_error_new,
371    io_errorkind,
372    io_stderr,
373    io_stdout,
374    is_ascii,
375    is_char_boundary,
376    is_diag_item,
377    is_diagnostic_item,
378    is_digit,
379    is_empty,
380    is_err,
381    is_file,
382    is_none,
383    is_none_or,
384    is_ok,
385    is_partitioned,
386    is_some,
387    is_some_and,
388    is_sorted_by_key,
389    isize_legacy_const_max,
390    isize_legacy_const_min,
391    isize_legacy_fn_max_value,
392    isize_legacy_fn_min_value,
393    isize_legacy_mod,
394    isqrt,
395    iter_cloned,
396    iter_copied,
397    iter_filter,
398    iter_repeat,
399    itertools,
400    join,
401    kw,
402    lazy_static,
403    leading_zeros,
404    lint_vec,
405    ln,
406    lock,
407    lock_api,
408    macro_concat,
409    macro_use_imports,
410    map_break,
411    map_continue,
412    map_or,
413    map_or_else,
414    map_while,
415    match_indices,
416    matches,
417    matches_macro,
418    max,
419    max_by,
420    max_by_key,
421    max_value,
422    maximum,
423    mem_align_of,
424    mem_replace,
425    mem_size_of,
426    mem_size_of_val,
427    min,
428    min_by,
429    min_by_key,
430    min_value,
431    minimum,
432    mode,
433    module_name_repetitions,
434    msrv,
435    msrvs,
436    mul_add,
437    mut_ptr,
438    mutex,
439    needless_return,
440    next_back,
441    next_if,
442    next_if_eq,
443    next_multiple_of,
444    next_tuple,
445    nth,
446    ok,
447    ok_or,
448    once_cell,
449    open,
450    open_options_new,
451    option_expect,
452    option_unwrap,
453    or_default,
454    or_else,
455    or_insert,
456    or_insert_with,
457    os_str_to_os_string,
458    os_string_as_os_str,
459    outer_expn,
460    panic_any,
461    parse,
462    partition,
463    path_main_separator,
464    path_to_pathbuf,
465    pathbuf_as_path,
466    paths,
467    peek,
468    peek_mut,
469    peekable,
470    permissions_from_mode,
471    pin_macro,
472    pop,
473    pop_back,
474    pop_back_if,
475    pop_front,
476    pop_front_if,
477    pop_if,
478    position,
479    pow,
480    process_abort,
481    process_exit,
482    product,
483    ptr_read_volatile,
484    ptr_slice_from_raw_parts,
485    ptr_slice_from_raw_parts_mut,
486    ptr_without_provenance,
487    ptr_without_provenance_mut,
488    push,
489    push_back,
490    push_front,
491    push_str,
492    range_step,
493    read,
494    read_exact,
495    read_line,
496    read_to_end,
497    read_to_string,
498    read_unaligned,
499    read_volatile,
500    reduce,
501    redundant_imports,
502    redundant_pub_crate,
503    regex,
504    rem_euclid,
505    repeat,
506    replace,
507    replacen,
508    res,
509    reserve,
510    resize,
511    restriction,
512    result_ok_method,
513    rev,
514    rfind,
515    rmatch_indices,
516    rmatches,
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    starts_with,
565    std_detect,
566    step_by,
567    str_chars,
568    str_ends_with,
569    str_len,
570    str_split_whitespace,
571    str_starts_with,
572    str_trim,
573    str_trim_end,
574    str_trim_start,
575    string_as_mut_str,
576    string_as_str,
577    string_from_utf8,
578    string_insert_str,
579    string_new,
580    string_push_str,
581    strlen,
582    style,
583    subsec_micros,
584    subsec_nanos,
585    sum,
586    symbol,
587    take,
588    take_while,
589    tcx,
590    then,
591    then_some,
592    thread_local_macro,
593    to_ascii_lowercase,
594    to_ascii_uppercase,
595    to_be_bytes,
596    to_digit,
597    to_le_bytes,
598    to_lowercase,
599    to_ne_bytes,
600    to_os_string,
601    to_owned,
602    to_path_buf,
603    to_string_method,
604    to_uppercase,
605    tokio,
606    trim,
607    trim_end,
608    trim_end_matches,
609    trim_start,
610    trim_start_matches,
611    truncate,
612    try_fold,
613    try_for_each,
614    try_from_fn,
615    unreachable_pub,
616    unsafe_removed_from_name,
617    unused,
618    unused_braces,
619    unused_extern_crates,
620    unused_import_braces,
621    unused_trait_names,
622    unwrap_err,
623    unwrap_err_unchecked,
624    unwrap_or_default,
625    unwrap_or_else,
626    unwrap_unchecked,
627    unzip,
628    utils,
629    vec_as_mut_slice,
630    vec_as_slice,
631    vec_from_elem,
632    vec_is_empty,
633    vec_macro,
634    vec_new,
635    vec_pop,
636    vec_with_capacity,
637    vecdeque_iter,
638    visit_str,
639    visit_string,
640    wake,
641    warnings,
642    wildcard_imports,
643    with_capacity,
644    wrapping_neg,
645    wrapping_offset,
646    write,
647    write_unaligned,
648    write_volatile,
649    writeln,
650    zip,
651}