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    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    FsOpenOptions,
68    FsPermissions,
69    HashMapEntry,
70    Instant,
71    IntoIter,
72    IoBufRead,
73    IoLines,
74    IoRead,
75    IoSeek,
76    IoWrite,
77    IpAddr,
78    Ipv4Addr,
79    Ipv6Addr,
80    IterEmpty,
81    IterOnce,
82    IterPeekable,
83    Itertools,
84    LF: "\n",
85    LateContext,
86    Lazy,
87    LinkedList,
88    Lint,
89    LowerExp,
90    LowerHex,
91    MAX,
92    MIN,
93    MaybeDef,
94    MpmcReceiver,
95    MpscReceiver,
96    MsrvStack,
97    Octal,
98    OpenOptions,
99    OsStr,
100    OsString,
101    Path,
102    PathBuf,
103    PathLookup,
104    PhantomPinned,
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    chunks_exact,
181    chunks_exact_mut,
182    clamp,
183    clippy_utils,
184    clone_into,
185    cloned,
186    cmp_max,
187    cmp_min,
188    cognitive_complexity,
189    collapsible_else_if,
190    collapsible_if,
191    collect,
192    const_ptr,
193    contains,
194    convert_identity,
195    copied,
196    copy_from,
197    copy_from_nonoverlapping,
198    copy_to,
199    copy_to_nonoverlapping,
200    core_arch,
201    core_panic_2021_macro,
202    count_ones,
203    create,
204    create_new,
205    cstring_as_c_str,
206    cx,
207    cycle,
208    cyclomatic_complexity,
209    dbg_macro,
210    de,
211    debug_struct,
212    deprecated_in_future,
213    deref_mut_method,
214    diagnostics,
215    disallowed_types,
216    drain,
217    dump,
218    duration_constructors,
219    ends_with,
220    enum_glob_use,
221    enumerate,
222    enumerate_method,
223    eprint_macro,
224    eprintln_macro,
225    err,
226    exp,
227    expect_err,
228    expn_data,
229    exported_private_dependencies,
230    extend,
231    f128_consts_mod,
232    f128_epsilon,
233    f16_consts_mod,
234    f16_epsilon,
235    f32_consts_mod,
236    f32_epsilon,
237    f32_legacy_const_digits,
238    f32_legacy_const_epsilon,
239    f32_legacy_const_infinity,
240    f32_legacy_const_mantissa_dig,
241    f32_legacy_const_max,
242    f32_legacy_const_max_10_exp,
243    f32_legacy_const_max_exp,
244    f32_legacy_const_min,
245    f32_legacy_const_min_10_exp,
246    f32_legacy_const_min_exp,
247    f32_legacy_const_min_positive,
248    f32_legacy_const_nan,
249    f32_legacy_const_neg_infinity,
250    f32_legacy_const_radix,
251    f64_consts_mod,
252    f64_epsilon,
253    f64_legacy_const_digits,
254    f64_legacy_const_epsilon,
255    f64_legacy_const_infinity,
256    f64_legacy_const_mantissa_dig,
257    f64_legacy_const_max,
258    f64_legacy_const_max_10_exp,
259    f64_legacy_const_max_exp,
260    f64_legacy_const_min,
261    f64_legacy_const_min_10_exp,
262    f64_legacy_const_min_exp,
263    f64_legacy_const_min_positive,
264    f64_legacy_const_nan,
265    f64_legacy_const_neg_infinity,
266    f64_legacy_const_radix,
267    file_options,
268    filter,
269    filter_map,
270    find,
271    find_map,
272    finish,
273    finish_non_exhaustive,
274    first,
275    flat_map,
276    flatten,
277    floor,
278    floor_char_boundary,
279    fold,
280    for_each,
281    format_args_macro,
282    from_be_bytes,
283    from_bytes_with_nul,
284    from_bytes_with_nul_unchecked,
285    from_days,
286    from_fn,
287    from_hours,
288    from_le_bytes,
289    from_micros,
290    from_millis,
291    from_mins,
292    from_nanos,
293    from_nanos_u128,
294    from_ne_bytes,
295    from_ptr,
296    from_raw,
297    from_raw_parts,
298    from_secs,
299    from_secs_f32,
300    from_secs_f64,
301    from_str_method,
302    from_str_radix,
303    from_weeks,
304    front,
305    fs,
306    fs_create_dir,
307    fuse,
308    futures_util,
309    get,
310    get_mut,
311    get_or_insert,
312    get_or_insert_with,
313    get_unchecked,
314    get_unchecked_mut,
315    has_significant_drop,
316    hashmap_contains_key,
317    hashmap_drain_ty,
318    hashmap_insert,
319    hashmap_iter_mut_ty,
320    hashmap_iter_ty,
321    hashmap_keys_ty,
322    hashmap_values_mut_ty,
323    hashmap_values_ty,
324    hashset_drain_ty,
325    hashset_iter,
326    hashset_iter_ty,
327    help,
328    hidden_glob_reexports,
329    hygiene,
330    i128_legacy_const_max,
331    i128_legacy_const_min,
332    i128_legacy_fn_max_value,
333    i128_legacy_fn_min_value,
334    i128_legacy_mod,
335    i16_legacy_const_max,
336    i16_legacy_const_min,
337    i16_legacy_fn_max_value,
338    i16_legacy_fn_min_value,
339    i16_legacy_mod,
340    i32_legacy_const_max,
341    i32_legacy_const_min,
342    i32_legacy_fn_max_value,
343    i32_legacy_fn_min_value,
344    i32_legacy_mod,
345    i64_legacy_const_max,
346    i64_legacy_const_min,
347    i64_legacy_fn_max_value,
348    i64_legacy_fn_min_value,
349    i64_legacy_mod,
350    i8_legacy_const_max,
351    i8_legacy_const_min,
352    i8_legacy_fn_max_value,
353    i8_legacy_fn_min_value,
354    i8_legacy_mod,
355    ilog,
356    include_bytes_macro,
357    include_str_macro,
358    insert,
359    insert_str,
360    inspect,
361    instant_now,
362    int_roundings,
363    into,
364    into_bytes,
365    into_ok,
366    into_owned,
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    log,
409    log10,
410    log2,
411    macro_concat,
412    macro_use_imports,
413    map_break,
414    map_continue,
415    map_or,
416    map_or_else,
417    map_while,
418    match_indices,
419    matches,
420    matches_macro,
421    max,
422    max_by,
423    max_by_key,
424    max_value,
425    maximum,
426    mem_align_of,
427    mem_replace,
428    mem_size_of,
429    mem_size_of_val,
430    min,
431    min_by,
432    min_by_key,
433    min_value,
434    minimum,
435    mode,
436    module_name_repetitions,
437    msrv,
438    msrvs,
439    mut_ptr,
440    mutex,
441    needless_return,
442    next_back,
443    next_if,
444    next_if_eq,
445    next_multiple_of,
446    next_tuple,
447    nth,
448    ok,
449    ok_or,
450    once_cell,
451    open,
452    open_options_new,
453    option_expect,
454    option_unwrap,
455    or_default,
456    or_else,
457    or_insert,
458    or_insert_with,
459    os_str_to_os_string,
460    os_string_as_os_str,
461    outer_expn,
462    panic_any,
463    parse,
464    partition,
465    path_main_separator,
466    path_to_pathbuf,
467    pathbuf_as_path,
468    paths,
469    peek,
470    peek_mut,
471    peekable,
472    permissions_from_mode,
473    pin_macro,
474    pop,
475    pop_back,
476    pop_back_if,
477    pop_front,
478    pop_front_if,
479    pop_if,
480    position,
481    pow,
482    powf,
483    powi,
484    print_macro,
485    println_macro,
486    process_abort,
487    process_exit,
488    product,
489    ptr_read_volatile,
490    ptr_slice_from_raw_parts,
491    ptr_slice_from_raw_parts_mut,
492    ptr_without_provenance,
493    ptr_without_provenance_mut,
494    push,
495    push_back,
496    push_front,
497    push_str,
498    range_step,
499    read,
500    read_exact,
501    read_line,
502    read_to_end,
503    read_to_string,
504    read_unaligned,
505    read_volatile,
506    reduce,
507    redundant_imports,
508    redundant_pub_crate,
509    regex,
510    rem_euclid,
511    repeat,
512    replace,
513    replacen,
514    res,
515    reserve,
516    resize,
517    restriction,
518    result_ok_method,
519    rev,
520    rfind,
521    rmatch_indices,
522    rmatches,
523    round,
524    rposition,
525    rsplit,
526    rsplit_once,
527    rsplit_terminator,
528    rsplitn,
529    rsplitn_mut,
530    rustc_errors,
531    rustc_lint,
532    rustc_lint_defs,
533    rustc_middle,
534    rustc_span,
535    rustfmt_skip,
536    rwlock,
537    saturating_abs,
538    saturating_div,
539    saturating_pow,
540    scan,
541    seek,
542    serde,
543    set_len,
544    set_mode,
545    set_readonly,
546    signum,
547    single_component_path_imports,
548    skip,
549    skip_while,
550    slice_from_ref,
551    slice_iter,
552    slice_mut_unchecked,
553    slice_unchecked,
554    sort,
555    sort_by,
556    sort_unstable_by,
557    span_help,
558    span_lint_and_then,
559    span_note,
560    span_suggestion,
561    split,
562    split_at,
563    split_at_checked,
564    split_at_mut,
565    split_at_mut_checked,
566    split_inclusive,
567    split_once,
568    split_terminator,
569    split_whitespace,
570    splitn,
571    splitn_mut,
572    sqrt,
573    starts_with,
574    std_detect,
575    step_by,
576    str_chars,
577    str_ends_with,
578    str_len,
579    str_split_whitespace,
580    str_starts_with,
581    str_trim,
582    str_trim_end,
583    str_trim_start,
584    string_as_mut_str,
585    string_as_str,
586    string_from_utf8,
587    string_insert_str,
588    string_new,
589    string_push_str,
590    strlen,
591    style,
592    subsec_micros,
593    subsec_nanos,
594    sum,
595    symbol,
596    take,
597    take_while,
598    tcx,
599    then,
600    then_some,
601    thread_local_macro,
602    to_ascii_lowercase,
603    to_ascii_uppercase,
604    to_be_bytes,
605    to_digit,
606    to_le_bytes,
607    to_lowercase,
608    to_ne_bytes,
609    to_os_string,
610    to_owned,
611    to_path_buf,
612    to_string_method,
613    to_uppercase,
614    todo_macro,
615    tokio,
616    trim,
617    trim_end,
618    trim_end_matches,
619    trim_start,
620    trim_start_matches,
621    truncate,
622    try_fold,
623    try_for_each,
624    try_from_fn,
625    unimplemented_macro,
626    unreachable_pub,
627    unsafe_removed_from_name,
628    unused,
629    unused_braces,
630    unused_extern_crates,
631    unused_import_braces,
632    unused_trait_names,
633    unwrap_err,
634    unwrap_err_unchecked,
635    unwrap_or_default,
636    unwrap_or_else,
637    unwrap_unchecked,
638    unzip,
639    utils,
640    vec_as_mut_slice,
641    vec_as_slice,
642    vec_from_elem,
643    vec_is_empty,
644    vec_macro,
645    vec_new,
646    vec_pop,
647    vec_with_capacity,
648    vecdeque_iter,
649    visit_str,
650    visit_string,
651    wake,
652    warnings,
653    wildcard_imports,
654    with_capacity,
655    wrapping_neg,
656    wrapping_offset,
657    write,
658    write_unaligned,
659    write_volatile,
660    writeln,
661    zip,
662}