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    Any,
38    Applicability,
39    ArrayIntoIter,
40    AsyncReadExt,
41    AsyncWriteExt,
42    BACKSLASH_SINGLE_QUOTE: r"\'",
43    BTreeEntry,
44    BTreeSet,
45    Binary,
46    BinaryHeap,
47    CLIPPY_ARGS,
48    CLIPPY_CONF_DIR,
49    CRLF: "\r\n",
50    Cargo_toml: "Cargo.toml",
51    Child,
52    Command,
53    Current,
54    DOUBLE_QUOTE: "\"",
55    DebugStruct,
56    Deserialize,
57    DirBuilder,
58    DoubleEndedIterator,
59    Duration,
60    EarlyContext,
61    EarlyLintPass,
62    Enumerate,
63    Error,
64    File,
65    FileType,
66    FsOpenOptions,
67    FsPermissions,
68    HashMapEntry,
69    Instant,
70    IntoIter,
71    IoBufRead,
72    IoLines,
73    IoRead,
74    IoSeek,
75    IoWrite,
76    IpAddr,
77    Ipv4Addr,
78    Ipv6Addr,
79    IterEmpty,
80    IterOnce,
81    IterPeekable,
82    Itertools,
83    LF: "\n",
84    LateContext,
85    Lazy,
86    LinkedList,
87    Lint,
88    LowerExp,
89    LowerHex,
90    MAX,
91    MIN,
92    MaybeDef,
93    MpmcReceiver,
94    MpmcSender,
95    MpscReceiver,
96    MpscSender,
97    MsrvStack,
98    Octal,
99    OpenOptions,
100    OsStr,
101    OsString,
102    Path,
103    PathBuf,
104    PathLookup,
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    clamp,
181    clippy_utils,
182    clone_into,
183    cloned,
184    cmp_max,
185    cmp_min,
186    cognitive_complexity,
187    collapsible_else_if,
188    collapsible_if,
189    collect,
190    const_ptr,
191    contains,
192    convert_identity,
193    copied,
194    copy_from,
195    copy_from_nonoverlapping,
196    copy_to,
197    copy_to_nonoverlapping,
198    core_arch,
199    core_panic_2021_macro,
200    count_ones,
201    create,
202    create_new,
203    cstring_as_c_str,
204    cx,
205    cycle,
206    cyclomatic_complexity,
207    de,
208    debug_struct,
209    deprecated_in_future,
210    deref_mut_method,
211    diagnostics,
212    disallowed_types,
213    drain,
214    dump,
215    duration_constructors,
216    ends_with,
217    enum_glob_use,
218    enumerate,
219    enumerate_method,
220    eprint_macro,
221    eprintln_macro,
222    err,
223    exp,
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    format_args_macro,
279    from_be_bytes,
280    from_bytes_with_nul,
281    from_bytes_with_nul_unchecked,
282    from_days,
283    from_fn,
284    from_hours,
285    from_iter_fn,
286    from_le_bytes,
287    from_micros,
288    from_millis,
289    from_mins,
290    from_nanos,
291    from_nanos_u128,
292    from_ne_bytes,
293    from_ptr,
294    from_raw,
295    from_raw_parts,
296    from_secs,
297    from_secs_f32,
298    from_secs_f64,
299    from_str_method,
300    from_str_radix,
301    from_weeks,
302    front,
303    fs,
304    fs_create_dir,
305    fuse,
306    futures_util,
307    get,
308    get_mut,
309    get_or_insert,
310    get_or_insert_with,
311    get_unchecked,
312    get_unchecked_mut,
313    has_significant_drop,
314    hashmap_contains_key,
315    hashmap_drain_ty,
316    hashmap_insert,
317    hashmap_iter_mut_ty,
318    hashmap_iter_ty,
319    hashmap_keys_ty,
320    hashmap_values_mut_ty,
321    hashmap_values_ty,
322    hashset_drain_ty,
323    hashset_iter,
324    hashset_iter_ty,
325    help,
326    hidden_glob_reexports,
327    hygiene,
328    i128_legacy_const_max,
329    i128_legacy_const_min,
330    i128_legacy_fn_max_value,
331    i128_legacy_fn_min_value,
332    i128_legacy_mod,
333    i16_legacy_const_max,
334    i16_legacy_const_min,
335    i16_legacy_fn_max_value,
336    i16_legacy_fn_min_value,
337    i16_legacy_mod,
338    i32_legacy_const_max,
339    i32_legacy_const_min,
340    i32_legacy_fn_max_value,
341    i32_legacy_fn_min_value,
342    i32_legacy_mod,
343    i64_legacy_const_max,
344    i64_legacy_const_min,
345    i64_legacy_fn_max_value,
346    i64_legacy_fn_min_value,
347    i64_legacy_mod,
348    i8_legacy_const_max,
349    i8_legacy_const_min,
350    i8_legacy_fn_max_value,
351    i8_legacy_fn_min_value,
352    i8_legacy_mod,
353    ilog,
354    include_bytes_macro,
355    include_str_macro,
356    insert,
357    insert_str,
358    inspect,
359    instant_now,
360    int_roundings,
361    into,
362    into_bytes,
363    into_ok,
364    into_owned,
365    intrinsics_unaligned_volatile_load,
366    intrinsics_unaligned_volatile_store,
367    io,
368    io_error_new,
369    io_errorkind,
370    io_stderr,
371    io_stdout,
372    is_ascii,
373    is_char_boundary,
374    is_diag_item,
375    is_diagnostic_item,
376    is_digit,
377    is_empty,
378    is_err,
379    is_file,
380    is_none,
381    is_none_or,
382    is_ok,
383    is_partitioned,
384    is_some,
385    is_some_and,
386    is_sorted_by_key,
387    isize_legacy_const_max,
388    isize_legacy_const_min,
389    isize_legacy_fn_max_value,
390    isize_legacy_fn_min_value,
391    isize_legacy_mod,
392    isqrt,
393    iter_cloned,
394    iter_copied,
395    iter_filter,
396    iter_repeat,
397    itertools,
398    join,
399    kw,
400    lazy_static,
401    leading_zeros,
402    lint_vec,
403    ln,
404    lock,
405    lock_api,
406    log,
407    log10,
408    log2,
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    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    powf,
481    powi,
482    print_macro,
483    println_macro,
484    process_abort,
485    process_exit,
486    product,
487    ptr_read_volatile,
488    ptr_slice_from_raw_parts,
489    ptr_slice_from_raw_parts_mut,
490    ptr_without_provenance,
491    ptr_without_provenance_mut,
492    push,
493    push_back,
494    push_front,
495    push_str,
496    range_step,
497    read,
498    read_exact,
499    read_line,
500    read_to_end,
501    read_to_string,
502    read_unaligned,
503    read_volatile,
504    reduce,
505    redundant_imports,
506    redundant_pub_crate,
507    regex,
508    rem_euclid,
509    repeat,
510    replace,
511    replacen,
512    res,
513    reserve,
514    resize,
515    restriction,
516    result_ok_method,
517    rev,
518    rfind,
519    rmatch_indices,
520    rmatches,
521    round,
522    rposition,
523    rsplit,
524    rsplit_once,
525    rsplit_terminator,
526    rsplitn,
527    rsplitn_mut,
528    rustc_errors,
529    rustc_lint,
530    rustc_lint_defs,
531    rustc_middle,
532    rustc_span,
533    rustfmt_skip,
534    rwlock,
535    saturating_abs,
536    saturating_div,
537    saturating_pow,
538    scan,
539    seek,
540    serde,
541    set_len,
542    set_mode,
543    set_readonly,
544    signum,
545    single_component_path_imports,
546    skip,
547    skip_while,
548    slice_from_ref,
549    slice_iter,
550    slice_mut_unchecked,
551    slice_unchecked,
552    sort,
553    sort_by,
554    sort_unstable_by,
555    span_help,
556    span_lint_and_then,
557    span_note,
558    span_suggestion,
559    split,
560    split_at,
561    split_at_checked,
562    split_at_mut,
563    split_at_mut_checked,
564    split_inclusive,
565    split_once,
566    split_terminator,
567    split_whitespace,
568    splitn,
569    splitn_mut,
570    sqrt,
571    starts_with,
572    std_detect,
573    step_by,
574    str_chars,
575    str_ends_with,
576    str_len,
577    str_split_whitespace,
578    str_starts_with,
579    str_trim,
580    str_trim_end,
581    str_trim_start,
582    string_as_mut_str,
583    string_as_str,
584    string_from_utf8,
585    string_insert_str,
586    string_new,
587    string_push_str,
588    strlen,
589    style,
590    subsec_micros,
591    subsec_nanos,
592    sum,
593    symbol,
594    take,
595    take_while,
596    tcx,
597    then,
598    then_some,
599    thread_local_macro,
600    to_ascii_lowercase,
601    to_ascii_uppercase,
602    to_be_bytes,
603    to_digit,
604    to_le_bytes,
605    to_lowercase,
606    to_ne_bytes,
607    to_os_string,
608    to_owned,
609    to_path_buf,
610    to_string_method,
611    to_uppercase,
612    todo_macro,
613    tokio,
614    trim,
615    trim_end,
616    trim_end_matches,
617    trim_start,
618    trim_start_matches,
619    truncate,
620    try_fold,
621    try_for_each,
622    try_from_fn,
623    unimplemented_macro,
624    unreachable_pub,
625    unsafe_removed_from_name,
626    unused,
627    unused_braces,
628    unused_extern_crates,
629    unused_import_braces,
630    unused_trait_names,
631    unwrap_err,
632    unwrap_err_unchecked,
633    unwrap_or_default,
634    unwrap_or_else,
635    unwrap_unchecked,
636    unzip,
637    utils,
638    vec_as_mut_slice,
639    vec_as_slice,
640    vec_from_elem,
641    vec_is_empty,
642    vec_macro,
643    vec_new,
644    vec_pop,
645    vec_with_capacity,
646    vecdeque_iter,
647    visit_str,
648    visit_string,
649    wake,
650    warnings,
651    wildcard_imports,
652    with_capacity,
653    wrapping_offset,
654    write,
655    write_unaligned,
656    write_volatile,
657    writeln,
658    zip,
659}