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    PhantomPinned,
104    RangeBounds,
105    RefCellRef,
106    RefCellRefMut,
107    Regex,
108    RegexBuilder,
109    RegexSet,
110    Saturating,
111    SeekFrom,
112    SliceIter,
113    Start,
114    Stdin,
115    Symbol,
116    SyntaxContext,
117    TBD,
118    ToOwned,
119    ToString,
120    UpperExp,
121    UpperHex,
122    V4,
123    V6,
124    VecDeque,
125    Visitor,
126    Wake,
127    Waker,
128    Weak,
129    Wrapping,
130    abs,
131    ambiguous_glob_reexports,
132    app,
133    append,
134    applicability,
135    arg,
136    as_bytes,
137    as_deref,
138    as_deref_mut,
139    as_mut,
140    as_path,
141    as_ptr,
142    as_str,
143    assert_failed,
144    author,
145    back,
146    binary_heap_pop_if,
147    binaryheap_iter,
148    bool_then,
149    borrow,
150    borrow_mut,
151    box_assume_init_into_vec_unsafe,
152    btreemap_contains_key,
153    btreemap_insert,
154    btreeset_iter,
155    build_hasher,
156    by_ref,
157    bytes,
158    capacity,
159    cargo_clippy: "cargo-clippy",
160    cast,
161    cast_const,
162    cast_mut,
163    ceil,
164    ceil_char_boundary,
165    chain,
166    char_is_ascii,
167    char_to_digit,
168    chars,
169    check_attributes,
170    checked_abs,
171    checked_add,
172    checked_isqrt,
173    checked_mul,
174    checked_pow,
175    checked_rem_euclid,
176    checked_sub,
177    child_id,
178    child_kill,
179    clamp,
180    clippy_utils,
181    clone_into,
182    cloned,
183    cmp_max,
184    cmp_min,
185    cognitive_complexity,
186    collapsible_else_if,
187    collapsible_if,
188    collect,
189    const_ptr,
190    contains,
191    convert_identity,
192    copied,
193    copy_from,
194    copy_from_nonoverlapping,
195    copy_to,
196    copy_to_nonoverlapping,
197    core_arch,
198    core_panic_2021_macro,
199    count_ones,
200    create,
201    create_new,
202    cstring_as_c_str,
203    cx,
204    cycle,
205    cyclomatic_complexity,
206    dbg_macro,
207    de,
208    debug_struct,
209    deprecated_in_future,
210    deref_mut_method,
211    diagnostics,
212    disallowed_profile,
213    disallowed_profiles,
214    disallowed_types,
215    drain,
216    dump,
217    duration_constructors,
218    ends_with,
219    enum_glob_use,
220    enumerate,
221    enumerate_method,
222    eprint_macro,
223    eprintln_macro,
224    err,
225    exp,
226    expect_err,
227    expn_data,
228    exported_private_dependencies,
229    extend,
230    f128_consts_mod,
231    f128_epsilon,
232    f16_consts_mod,
233    f16_epsilon,
234    f32_consts_mod,
235    f32_epsilon,
236    f32_legacy_const_digits,
237    f32_legacy_const_epsilon,
238    f32_legacy_const_infinity,
239    f32_legacy_const_mantissa_dig,
240    f32_legacy_const_max,
241    f32_legacy_const_max_10_exp,
242    f32_legacy_const_max_exp,
243    f32_legacy_const_min,
244    f32_legacy_const_min_10_exp,
245    f32_legacy_const_min_exp,
246    f32_legacy_const_min_positive,
247    f32_legacy_const_nan,
248    f32_legacy_const_neg_infinity,
249    f32_legacy_const_radix,
250    f64_consts_mod,
251    f64_epsilon,
252    f64_legacy_const_digits,
253    f64_legacy_const_epsilon,
254    f64_legacy_const_infinity,
255    f64_legacy_const_mantissa_dig,
256    f64_legacy_const_max,
257    f64_legacy_const_max_10_exp,
258    f64_legacy_const_max_exp,
259    f64_legacy_const_min,
260    f64_legacy_const_min_10_exp,
261    f64_legacy_const_min_exp,
262    f64_legacy_const_min_positive,
263    f64_legacy_const_nan,
264    f64_legacy_const_neg_infinity,
265    f64_legacy_const_radix,
266    file_options,
267    filter,
268    filter_map,
269    find,
270    find_map,
271    finish,
272    finish_non_exhaustive,
273    first,
274    flat_map,
275    flatten,
276    floor,
277    floor_char_boundary,
278    fold,
279    for_each,
280    format_args_macro,
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    intrinsics_unaligned_volatile_load,
367    intrinsics_unaligned_volatile_store,
368    io,
369    io_error_new,
370    io_errorkind,
371    io_stderr,
372    io_stdout,
373    is_ascii,
374    is_char_boundary,
375    is_diag_item,
376    is_diagnostic_item,
377    is_digit,
378    is_empty,
379    is_err,
380    is_file,
381    is_none,
382    is_none_or,
383    is_ok,
384    is_partitioned,
385    is_some,
386    is_some_and,
387    is_sorted_by_key,
388    isize_legacy_const_max,
389    isize_legacy_const_min,
390    isize_legacy_fn_max_value,
391    isize_legacy_fn_min_value,
392    isize_legacy_mod,
393    isqrt,
394    iter_cloned,
395    iter_copied,
396    iter_filter,
397    iter_repeat,
398    itertools,
399    join,
400    kw,
401    lazy_static,
402    leading_zeros,
403    lint_vec,
404    ln,
405    lock,
406    lock_api,
407    log,
408    log10,
409    log2,
410    macro_concat,
411    macro_use_imports,
412    map_break,
413    map_continue,
414    map_or,
415    map_or_else,
416    map_while,
417    match_indices,
418    matches,
419    matches_macro,
420    max,
421    max_by,
422    max_by_key,
423    max_value,
424    maximum,
425    mem_align_of,
426    mem_replace,
427    mem_size_of,
428    mem_size_of_val,
429    min,
430    min_by,
431    min_by_key,
432    min_value,
433    minimum,
434    mode,
435    module_name_repetitions,
436    msrv,
437    msrvs,
438    mut_ptr,
439    mutex,
440    needless_return,
441    next_back,
442    next_if,
443    next_if_eq,
444    next_multiple_of,
445    next_tuple,
446    nth,
447    ok,
448    ok_or,
449    once_cell,
450    open,
451    open_options_new,
452    option_expect,
453    option_unwrap,
454    or_default,
455    or_else,
456    or_insert,
457    or_insert_with,
458    os_str_to_os_string,
459    os_string_as_os_str,
460    outer_expn,
461    panic_any,
462    parse,
463    partition,
464    path_main_separator,
465    path_to_pathbuf,
466    pathbuf_as_path,
467    paths,
468    peek,
469    peek_mut,
470    peekable,
471    permissions_from_mode,
472    pin_macro,
473    pop,
474    pop_back,
475    pop_back_if,
476    pop_front,
477    pop_front_if,
478    pop_if,
479    position,
480    pow,
481    powf,
482    powi,
483    print_macro,
484    println_macro,
485    process_abort,
486    process_exit,
487    product,
488    ptr_read_volatile,
489    ptr_slice_from_raw_parts,
490    ptr_slice_from_raw_parts_mut,
491    ptr_without_provenance,
492    ptr_without_provenance_mut,
493    push,
494    push_back,
495    push_front,
496    push_str,
497    range_step,
498    read,
499    read_exact,
500    read_line,
501    read_to_end,
502    read_to_string,
503    read_unaligned,
504    read_volatile,
505    reduce,
506    redundant_imports,
507    redundant_pub_crate,
508    regex,
509    rem_euclid,
510    repeat,
511    replace,
512    replacen,
513    res,
514    reserve,
515    resize,
516    restriction,
517    result_ok_method,
518    rev,
519    rfind,
520    rmatch_indices,
521    rmatches,
522    round,
523    rposition,
524    rsplit,
525    rsplit_once,
526    rsplit_terminator,
527    rsplitn,
528    rsplitn_mut,
529    rustc_errors,
530    rustc_lint,
531    rustc_lint_defs,
532    rustc_middle,
533    rustc_span,
534    rustfmt_skip,
535    rwlock,
536    saturating_abs,
537    saturating_div,
538    saturating_pow,
539    scan,
540    seek,
541    serde,
542    set_len,
543    set_mode,
544    set_readonly,
545    signum,
546    single_component_path_imports,
547    skip,
548    skip_while,
549    slice_from_ref,
550    slice_iter,
551    slice_mut_unchecked,
552    slice_unchecked,
553    sort,
554    sort_by,
555    sort_unstable_by,
556    span_help,
557    span_lint_and_then,
558    span_note,
559    span_suggestion,
560    split,
561    split_at,
562    split_at_checked,
563    split_at_mut,
564    split_at_mut_checked,
565    split_inclusive,
566    split_once,
567    split_terminator,
568    split_whitespace,
569    splitn,
570    splitn_mut,
571    sqrt,
572    starts_with,
573    std_detect,
574    step_by,
575    str_chars,
576    str_ends_with,
577    str_len,
578    str_split_whitespace,
579    str_starts_with,
580    str_trim,
581    str_trim_end,
582    str_trim_start,
583    string_as_mut_str,
584    string_as_str,
585    string_from_utf8,
586    string_insert_str,
587    string_new,
588    string_push_str,
589    strlen,
590    style,
591    subsec_micros,
592    subsec_nanos,
593    sum,
594    symbol,
595    take,
596    take_while,
597    tcx,
598    then,
599    then_some,
600    thread_local_macro,
601    to_ascii_lowercase,
602    to_ascii_uppercase,
603    to_be_bytes,
604    to_digit,
605    to_le_bytes,
606    to_lowercase,
607    to_ne_bytes,
608    to_os_string,
609    to_owned,
610    to_path_buf,
611    to_string_method,
612    to_uppercase,
613    todo_macro,
614    tokio,
615    trim,
616    trim_end,
617    trim_end_matches,
618    trim_start,
619    trim_start_matches,
620    truncate,
621    try_fold,
622    try_for_each,
623    try_from_fn,
624    unimplemented_macro,
625    unreachable_pub,
626    unsafe_removed_from_name,
627    unused,
628    unused_braces,
629    unused_extern_crates,
630    unused_import_braces,
631    unused_trait_names,
632    unwrap_err,
633    unwrap_err_unchecked,
634    unwrap_or_default,
635    unwrap_or_else,
636    unwrap_unchecked,
637    unzip,
638    utils,
639    vec_as_mut_slice,
640    vec_as_slice,
641    vec_from_elem,
642    vec_is_empty,
643    vec_macro,
644    vec_new,
645    vec_pop,
646    vec_with_capacity,
647    vecdeque_iter,
648    visit_str,
649    visit_string,
650    wake,
651    warnings,
652    wildcard_imports,
653    with_capacity,
654    wrapping_neg,
655    wrapping_offset,
656    write,
657    write_unaligned,
658    write_volatile,
659    writeln,
660    zip,
661}