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    MpscReceiver,
95    MsrvStack,
96    Octal,
97    OpenOptions,
98    OsStr,
99    OsString,
100    Path,
101    PathBuf,
102    PathLookup,
103    RangeBounds,
104    RefCellRef,
105    RefCellRefMut,
106    Regex,
107    RegexBuilder,
108    RegexSet,
109    Saturating,
110    SeekFrom,
111    SliceIter,
112    Start,
113    Stdin,
114    Symbol,
115    SyntaxContext,
116    TBD,
117    ToOwned,
118    ToString,
119    UpperExp,
120    UpperHex,
121    V4,
122    V6,
123    VecDeque,
124    Visitor,
125    Wake,
126    Waker,
127    Weak,
128    Wrapping,
129    abs,
130    ambiguous_glob_reexports,
131    app,
132    append,
133    applicability,
134    arg,
135    as_bytes,
136    as_deref,
137    as_deref_mut,
138    as_mut,
139    as_path,
140    as_ptr,
141    as_str,
142    assert_failed,
143    author,
144    back,
145    binary_heap_pop_if,
146    binaryheap_iter,
147    bool_then,
148    borrow,
149    borrow_mut,
150    box_assume_init_into_vec_unsafe,
151    btreemap_contains_key,
152    btreemap_insert,
153    btreeset_iter,
154    build_hasher,
155    by_ref,
156    bytes,
157    capacity,
158    cargo_clippy: "cargo-clippy",
159    cast,
160    cast_const,
161    cast_mut,
162    ceil,
163    ceil_char_boundary,
164    chain,
165    char_is_ascii,
166    char_to_digit,
167    chars,
168    check_attributes,
169    checked_abs,
170    checked_add,
171    checked_isqrt,
172    checked_mul,
173    checked_pow,
174    checked_rem_euclid,
175    checked_sub,
176    child_id,
177    child_kill,
178    clamp,
179    clippy_utils,
180    clone_into,
181    cloned,
182    cmp_max,
183    cmp_min,
184    cognitive_complexity,
185    collapsible_else_if,
186    collapsible_if,
187    collect,
188    const_ptr,
189    contains,
190    convert_identity,
191    copied,
192    copy_from,
193    copy_from_nonoverlapping,
194    copy_to,
195    copy_to_nonoverlapping,
196    core_arch,
197    core_panic_2021_macro,
198    count_ones,
199    create,
200    create_new,
201    cstring_as_c_str,
202    cx,
203    cycle,
204    cyclomatic_complexity,
205    dbg_macro,
206    de,
207    debug_struct,
208    deprecated_in_future,
209    deref_mut_method,
210    diagnostics,
211    disallowed_types,
212    drain,
213    dump,
214    duration_constructors,
215    ends_with,
216    enum_glob_use,
217    enumerate,
218    enumerate_method,
219    eprint_macro,
220    eprintln_macro,
221    err,
222    exp,
223    expect_err,
224    expn_data,
225    exported_private_dependencies,
226    extend,
227    f128_consts_mod,
228    f128_epsilon,
229    f16_consts_mod,
230    f16_epsilon,
231    f32_consts_mod,
232    f32_epsilon,
233    f32_legacy_const_digits,
234    f32_legacy_const_epsilon,
235    f32_legacy_const_infinity,
236    f32_legacy_const_mantissa_dig,
237    f32_legacy_const_max,
238    f32_legacy_const_max_10_exp,
239    f32_legacy_const_max_exp,
240    f32_legacy_const_min,
241    f32_legacy_const_min_10_exp,
242    f32_legacy_const_min_exp,
243    f32_legacy_const_min_positive,
244    f32_legacy_const_nan,
245    f32_legacy_const_neg_infinity,
246    f32_legacy_const_radix,
247    f64_consts_mod,
248    f64_epsilon,
249    f64_legacy_const_digits,
250    f64_legacy_const_epsilon,
251    f64_legacy_const_infinity,
252    f64_legacy_const_mantissa_dig,
253    f64_legacy_const_max,
254    f64_legacy_const_max_10_exp,
255    f64_legacy_const_max_exp,
256    f64_legacy_const_min,
257    f64_legacy_const_min_10_exp,
258    f64_legacy_const_min_exp,
259    f64_legacy_const_min_positive,
260    f64_legacy_const_nan,
261    f64_legacy_const_neg_infinity,
262    f64_legacy_const_radix,
263    file_options,
264    filter,
265    filter_map,
266    find,
267    find_map,
268    finish,
269    finish_non_exhaustive,
270    first,
271    flat_map,
272    flatten,
273    floor,
274    floor_char_boundary,
275    fold,
276    for_each,
277    format_args_macro,
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_iter_fn,
285    from_le_bytes,
286    from_micros,
287    from_millis,
288    from_mins,
289    from_nanos,
290    from_nanos_u128,
291    from_ne_bytes,
292    from_ptr,
293    from_raw,
294    from_raw_parts,
295    from_secs,
296    from_secs_f32,
297    from_secs_f64,
298    from_str_method,
299    from_str_radix,
300    from_weeks,
301    front,
302    fs,
303    fs_create_dir,
304    fuse,
305    futures_util,
306    get,
307    get_mut,
308    get_or_insert,
309    get_or_insert_with,
310    get_unchecked,
311    get_unchecked_mut,
312    has_significant_drop,
313    hashmap_contains_key,
314    hashmap_drain_ty,
315    hashmap_insert,
316    hashmap_iter_mut_ty,
317    hashmap_iter_ty,
318    hashmap_keys_ty,
319    hashmap_values_mut_ty,
320    hashmap_values_ty,
321    hashset_drain_ty,
322    hashset_iter,
323    hashset_iter_ty,
324    help,
325    hidden_glob_reexports,
326    hygiene,
327    i128_legacy_const_max,
328    i128_legacy_const_min,
329    i128_legacy_fn_max_value,
330    i128_legacy_fn_min_value,
331    i128_legacy_mod,
332    i16_legacy_const_max,
333    i16_legacy_const_min,
334    i16_legacy_fn_max_value,
335    i16_legacy_fn_min_value,
336    i16_legacy_mod,
337    i32_legacy_const_max,
338    i32_legacy_const_min,
339    i32_legacy_fn_max_value,
340    i32_legacy_fn_min_value,
341    i32_legacy_mod,
342    i64_legacy_const_max,
343    i64_legacy_const_min,
344    i64_legacy_fn_max_value,
345    i64_legacy_fn_min_value,
346    i64_legacy_mod,
347    i8_legacy_const_max,
348    i8_legacy_const_min,
349    i8_legacy_fn_max_value,
350    i8_legacy_fn_min_value,
351    i8_legacy_mod,
352    ilog,
353    include_bytes_macro,
354    include_str_macro,
355    insert,
356    insert_str,
357    inspect,
358    instant_now,
359    int_roundings,
360    into,
361    into_bytes,
362    into_ok,
363    into_owned,
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    log,
406    log10,
407    log2,
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    mut_ptr,
437    mutex,
438    needless_return,
439    next_back,
440    next_if,
441    next_if_eq,
442    next_multiple_of,
443    next_tuple,
444    nth,
445    ok,
446    ok_or,
447    once_cell,
448    open,
449    open_options_new,
450    option_expect,
451    option_unwrap,
452    or_default,
453    or_else,
454    or_insert,
455    or_insert_with,
456    os_str_to_os_string,
457    os_string_as_os_str,
458    outer_expn,
459    panic_any,
460    parse,
461    partition,
462    path_main_separator,
463    path_to_pathbuf,
464    pathbuf_as_path,
465    paths,
466    peek,
467    peek_mut,
468    peekable,
469    permissions_from_mode,
470    pin_macro,
471    pop,
472    pop_back,
473    pop_back_if,
474    pop_front,
475    pop_front_if,
476    pop_if,
477    position,
478    pow,
479    powf,
480    powi,
481    print_macro,
482    println_macro,
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_lint_defs,
530    rustc_middle,
531    rustc_span,
532    rustfmt_skip,
533    rwlock,
534    saturating_abs,
535    saturating_div,
536    saturating_pow,
537    scan,
538    seek,
539    serde,
540    set_len,
541    set_mode,
542    set_readonly,
543    signum,
544    single_component_path_imports,
545    skip,
546    skip_while,
547    slice_from_ref,
548    slice_iter,
549    slice_mut_unchecked,
550    slice_unchecked,
551    sort,
552    sort_by,
553    sort_unstable_by,
554    span_help,
555    span_lint_and_then,
556    span_note,
557    span_suggestion,
558    split,
559    split_at,
560    split_at_checked,
561    split_at_mut,
562    split_at_mut_checked,
563    split_inclusive,
564    split_once,
565    split_terminator,
566    split_whitespace,
567    splitn,
568    splitn_mut,
569    sqrt,
570    starts_with,
571    std_detect,
572    step_by,
573    str_chars,
574    str_ends_with,
575    str_len,
576    str_split_whitespace,
577    str_starts_with,
578    str_trim,
579    str_trim_end,
580    str_trim_start,
581    string_as_mut_str,
582    string_as_str,
583    string_from_utf8,
584    string_insert_str,
585    string_new,
586    string_push_str,
587    strlen,
588    style,
589    subsec_micros,
590    subsec_nanos,
591    sum,
592    symbol,
593    take,
594    take_while,
595    tcx,
596    then,
597    then_some,
598    thread_local_macro,
599    to_ascii_lowercase,
600    to_ascii_uppercase,
601    to_be_bytes,
602    to_digit,
603    to_le_bytes,
604    to_lowercase,
605    to_ne_bytes,
606    to_os_string,
607    to_owned,
608    to_path_buf,
609    to_string_method,
610    to_uppercase,
611    todo_macro,
612    tokio,
613    trim,
614    trim_end,
615    trim_end_matches,
616    trim_start,
617    trim_start_matches,
618    truncate,
619    try_fold,
620    try_for_each,
621    try_from_fn,
622    unimplemented_macro,
623    unreachable_pub,
624    unsafe_removed_from_name,
625    unused,
626    unused_braces,
627    unused_extern_crates,
628    unused_import_braces,
629    unused_trait_names,
630    unwrap_err,
631    unwrap_err_unchecked,
632    unwrap_or_default,
633    unwrap_or_else,
634    unwrap_unchecked,
635    unzip,
636    utils,
637    vec_as_mut_slice,
638    vec_as_slice,
639    vec_from_elem,
640    vec_is_empty,
641    vec_macro,
642    vec_new,
643    vec_pop,
644    vec_with_capacity,
645    vecdeque_iter,
646    visit_str,
647    visit_string,
648    wake,
649    warnings,
650    wildcard_imports,
651    with_capacity,
652    wrapping_offset,
653    write,
654    write_unaligned,
655    write_volatile,
656    writeln,
657    zip,
658}