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    de,
206    debug_struct,
207    deprecated_in_future,
208    deref_mut_method,
209    diagnostics,
210    disallowed_types,
211    drain,
212    dump,
213    duration_constructors,
214    ends_with,
215    enum_glob_use,
216    enumerate,
217    enumerate_method,
218    eprint_macro,
219    eprintln_macro,
220    err,
221    exp,
222    expect_err,
223    expn_data,
224    exported_private_dependencies,
225    extend,
226    f128_consts_mod,
227    f128_epsilon,
228    f16_consts_mod,
229    f16_epsilon,
230    f32_consts_mod,
231    f32_epsilon,
232    f32_legacy_const_digits,
233    f32_legacy_const_epsilon,
234    f32_legacy_const_infinity,
235    f32_legacy_const_mantissa_dig,
236    f32_legacy_const_max,
237    f32_legacy_const_max_10_exp,
238    f32_legacy_const_max_exp,
239    f32_legacy_const_min,
240    f32_legacy_const_min_10_exp,
241    f32_legacy_const_min_exp,
242    f32_legacy_const_min_positive,
243    f32_legacy_const_nan,
244    f32_legacy_const_neg_infinity,
245    f32_legacy_const_radix,
246    f64_consts_mod,
247    f64_epsilon,
248    f64_legacy_const_digits,
249    f64_legacy_const_epsilon,
250    f64_legacy_const_infinity,
251    f64_legacy_const_mantissa_dig,
252    f64_legacy_const_max,
253    f64_legacy_const_max_10_exp,
254    f64_legacy_const_max_exp,
255    f64_legacy_const_min,
256    f64_legacy_const_min_10_exp,
257    f64_legacy_const_min_exp,
258    f64_legacy_const_min_positive,
259    f64_legacy_const_nan,
260    f64_legacy_const_neg_infinity,
261    f64_legacy_const_radix,
262    file_options,
263    filter,
264    filter_map,
265    find,
266    find_map,
267    finish,
268    finish_non_exhaustive,
269    first,
270    flat_map,
271    flatten,
272    floor,
273    floor_char_boundary,
274    fold,
275    for_each,
276    format_args_macro,
277    from_be_bytes,
278    from_bytes_with_nul,
279    from_bytes_with_nul_unchecked,
280    from_days,
281    from_fn,
282    from_hours,
283    from_iter_fn,
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    intrinsics_unaligned_volatile_load,
364    intrinsics_unaligned_volatile_store,
365    io,
366    io_error_new,
367    io_errorkind,
368    io_stderr,
369    io_stdout,
370    is_ascii,
371    is_char_boundary,
372    is_diag_item,
373    is_diagnostic_item,
374    is_digit,
375    is_empty,
376    is_err,
377    is_file,
378    is_none,
379    is_none_or,
380    is_ok,
381    is_partitioned,
382    is_some,
383    is_some_and,
384    is_sorted_by_key,
385    isize_legacy_const_max,
386    isize_legacy_const_min,
387    isize_legacy_fn_max_value,
388    isize_legacy_fn_min_value,
389    isize_legacy_mod,
390    isqrt,
391    iter_cloned,
392    iter_copied,
393    iter_filter,
394    iter_repeat,
395    itertools,
396    join,
397    kw,
398    lazy_static,
399    leading_zeros,
400    lint_vec,
401    ln,
402    lock,
403    lock_api,
404    log,
405    log10,
406    log2,
407    macro_concat,
408    macro_use_imports,
409    map_break,
410    map_continue,
411    map_or,
412    map_or_else,
413    map_while,
414    match_indices,
415    matches,
416    matches_macro,
417    max,
418    max_by,
419    max_by_key,
420    max_value,
421    maximum,
422    mem_align_of,
423    mem_replace,
424    mem_size_of,
425    mem_size_of_val,
426    min,
427    min_by,
428    min_by_key,
429    min_value,
430    minimum,
431    mode,
432    module_name_repetitions,
433    msrv,
434    msrvs,
435    mut_ptr,
436    mutex,
437    needless_return,
438    next_back,
439    next_if,
440    next_if_eq,
441    next_multiple_of,
442    next_tuple,
443    nth,
444    ok,
445    ok_or,
446    once_cell,
447    open,
448    open_options_new,
449    option_expect,
450    option_unwrap,
451    or_default,
452    or_else,
453    or_insert,
454    or_insert_with,
455    os_str_to_os_string,
456    os_string_as_os_str,
457    outer_expn,
458    panic_any,
459    parse,
460    partition,
461    path_main_separator,
462    path_to_pathbuf,
463    pathbuf_as_path,
464    paths,
465    peek,
466    peek_mut,
467    peekable,
468    permissions_from_mode,
469    pin_macro,
470    pop,
471    pop_back,
472    pop_back_if,
473    pop_front,
474    pop_front_if,
475    pop_if,
476    position,
477    pow,
478    powf,
479    powi,
480    print_macro,
481    println_macro,
482    process_abort,
483    process_exit,
484    product,
485    ptr_read_volatile,
486    ptr_slice_from_raw_parts,
487    ptr_slice_from_raw_parts_mut,
488    ptr_without_provenance,
489    ptr_without_provenance_mut,
490    push,
491    push_back,
492    push_front,
493    push_str,
494    range_step,
495    read,
496    read_exact,
497    read_line,
498    read_to_end,
499    read_to_string,
500    read_unaligned,
501    read_volatile,
502    reduce,
503    redundant_imports,
504    redundant_pub_crate,
505    regex,
506    rem_euclid,
507    repeat,
508    replace,
509    replacen,
510    res,
511    reserve,
512    resize,
513    restriction,
514    result_ok_method,
515    rev,
516    rfind,
517    rmatch_indices,
518    rmatches,
519    round,
520    rposition,
521    rsplit,
522    rsplit_once,
523    rsplit_terminator,
524    rsplitn,
525    rsplitn_mut,
526    rustc_errors,
527    rustc_lint,
528    rustc_lint_defs,
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    todo_macro,
611    tokio,
612    trim,
613    trim_end,
614    trim_end_matches,
615    trim_start,
616    trim_start_matches,
617    truncate,
618    try_fold,
619    try_for_each,
620    try_from_fn,
621    unimplemented_macro,
622    unreachable_pub,
623    unsafe_removed_from_name,
624    unused,
625    unused_braces,
626    unused_extern_crates,
627    unused_import_braces,
628    unused_trait_names,
629    unwrap_err,
630    unwrap_err_unchecked,
631    unwrap_or_default,
632    unwrap_or_else,
633    unwrap_unchecked,
634    unzip,
635    utils,
636    vec_as_mut_slice,
637    vec_as_slice,
638    vec_from_elem,
639    vec_is_empty,
640    vec_macro,
641    vec_new,
642    vec_pop,
643    vec_with_capacity,
644    vecdeque_iter,
645    visit_str,
646    visit_string,
647    wake,
648    warnings,
649    wildcard_imports,
650    with_capacity,
651    wrapping_offset,
652    write,
653    write_unaligned,
654    write_volatile,
655    writeln,
656    zip,
657}