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    Cow,
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    MsrvStack,
95    Octal,
96    OpenOptions,
97    OsStr,
98    OsString,
99    Path,
100    PathBuf,
101    PathLookup,
102    RangeBounds,
103    Receiver,
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    Waker,
126    Weak,
127    Wrapping,
128    abs,
129    ambiguous_glob_reexports,
130    app,
131    append,
132    applicability,
133    arg,
134    as_bytes,
135    as_deref,
136    as_deref_mut,
137    as_mut,
138    as_path,
139    as_ptr,
140    as_str,
141    assert_failed,
142    author,
143    back,
144    binaryheap_iter,
145    bool_then,
146    borrow,
147    borrow_mut,
148    box_assume_init_into_vec_unsafe,
149    btreemap_contains_key,
150    btreemap_insert,
151    btreeset_iter,
152    build_hasher,
153    by_ref,
154    bytes,
155    capacity,
156    cargo_clippy: "cargo-clippy",
157    cast,
158    cast_const,
159    cast_mut,
160    ceil,
161    ceil_char_boundary,
162    chain,
163    char_is_ascii,
164    char_to_digit,
165    chars,
166    check_attributes,
167    checked_abs,
168    checked_add,
169    checked_isqrt,
170    checked_mul,
171    checked_pow,
172    checked_rem_euclid,
173    checked_sub,
174    child_id,
175    child_kill,
176    clamp,
177    clippy_utils,
178    clone_into,
179    cloned,
180    cmp_max,
181    cmp_min,
182    cognitive_complexity,
183    collapsible_else_if,
184    collapsible_if,
185    collect,
186    const_ptr,
187    contains,
188    convert_identity,
189    copied,
190    copy_from,
191    copy_from_nonoverlapping,
192    copy_to,
193    copy_to_nonoverlapping,
194    core_arch,
195    core_panic_2021_macro,
196    count_ones,
197    create,
198    create_new,
199    cstring_as_c_str,
200    cx,
201    cycle,
202    cyclomatic_complexity,
203    dbg_macro,
204    de,
205    debug_struct,
206    deprecated_in_future,
207    deref_mut_method,
208    diagnostics,
209    disallowed_types,
210    drain,
211    dump,
212    duration_constructors,
213    ends_with,
214    enum_glob_use,
215    enumerate,
216    enumerate_method,
217    eprint_macro,
218    eprintln_macro,
219    err,
220    exp,
221    expect_err,
222    expn_data,
223    exported_private_dependencies,
224    extend,
225    f128_consts_mod,
226    f128_epsilon,
227    f16_consts_mod,
228    f16_epsilon,
229    f32_consts_mod,
230    f32_epsilon,
231    f32_legacy_const_digits,
232    f32_legacy_const_epsilon,
233    f32_legacy_const_infinity,
234    f32_legacy_const_mantissa_dig,
235    f32_legacy_const_max,
236    f32_legacy_const_max_10_exp,
237    f32_legacy_const_max_exp,
238    f32_legacy_const_min,
239    f32_legacy_const_min_10_exp,
240    f32_legacy_const_min_exp,
241    f32_legacy_const_min_positive,
242    f32_legacy_const_nan,
243    f32_legacy_const_neg_infinity,
244    f32_legacy_const_radix,
245    f64_consts_mod,
246    f64_epsilon,
247    f64_legacy_const_digits,
248    f64_legacy_const_epsilon,
249    f64_legacy_const_infinity,
250    f64_legacy_const_mantissa_dig,
251    f64_legacy_const_max,
252    f64_legacy_const_max_10_exp,
253    f64_legacy_const_max_exp,
254    f64_legacy_const_min,
255    f64_legacy_const_min_10_exp,
256    f64_legacy_const_min_exp,
257    f64_legacy_const_min_positive,
258    f64_legacy_const_nan,
259    f64_legacy_const_neg_infinity,
260    f64_legacy_const_radix,
261    file_options,
262    filter,
263    filter_map,
264    find,
265    find_map,
266    finish,
267    finish_non_exhaustive,
268    first,
269    flat_map,
270    flatten,
271    floor,
272    floor_char_boundary,
273    fold,
274    for_each,
275    format_args_macro,
276    from_be_bytes,
277    from_bytes_with_nul,
278    from_bytes_with_nul_unchecked,
279    from_days,
280    from_fn,
281    from_hours,
282    from_iter_fn,
283    from_le_bytes,
284    from_micros,
285    from_millis,
286    from_mins,
287    from_nanos,
288    from_nanos_u128,
289    from_ne_bytes,
290    from_ptr,
291    from_raw,
292    from_raw_parts,
293    from_secs,
294    from_secs_f32,
295    from_secs_f64,
296    from_str_method,
297    from_str_radix,
298    from_weeks,
299    front,
300    fs,
301    fs_create_dir,
302    fuse,
303    futures_util,
304    get,
305    get_mut,
306    get_or_insert,
307    get_or_insert_with,
308    get_unchecked,
309    get_unchecked_mut,
310    has_significant_drop,
311    hashmap_contains_key,
312    hashmap_drain_ty,
313    hashmap_insert,
314    hashmap_iter_mut_ty,
315    hashmap_iter_ty,
316    hashmap_keys_ty,
317    hashmap_values_mut_ty,
318    hashmap_values_ty,
319    hashset_drain_ty,
320    hashset_iter,
321    hashset_iter_ty,
322    help,
323    hidden_glob_reexports,
324    hygiene,
325    i128_legacy_const_max,
326    i128_legacy_const_min,
327    i128_legacy_fn_max_value,
328    i128_legacy_fn_min_value,
329    i128_legacy_mod,
330    i16_legacy_const_max,
331    i16_legacy_const_min,
332    i16_legacy_fn_max_value,
333    i16_legacy_fn_min_value,
334    i16_legacy_mod,
335    i32_legacy_const_max,
336    i32_legacy_const_min,
337    i32_legacy_fn_max_value,
338    i32_legacy_fn_min_value,
339    i32_legacy_mod,
340    i64_legacy_const_max,
341    i64_legacy_const_min,
342    i64_legacy_fn_max_value,
343    i64_legacy_fn_min_value,
344    i64_legacy_mod,
345    i8_legacy_const_max,
346    i8_legacy_const_min,
347    i8_legacy_fn_max_value,
348    i8_legacy_fn_min_value,
349    i8_legacy_mod,
350    ilog,
351    include_bytes_macro,
352    include_str_macro,
353    insert,
354    insert_str,
355    inspect,
356    instant_now,
357    int_roundings,
358    into,
359    into_bytes,
360    into_ok,
361    into_owned,
362    intrinsics_unaligned_volatile_load,
363    intrinsics_unaligned_volatile_store,
364    io,
365    io_error_new,
366    io_errorkind,
367    io_stderr,
368    io_stdout,
369    is_ascii,
370    is_char_boundary,
371    is_diag_item,
372    is_diagnostic_item,
373    is_digit,
374    is_empty,
375    is_err,
376    is_file,
377    is_none,
378    is_none_or,
379    is_ok,
380    is_partitioned,
381    is_some,
382    is_some_and,
383    is_sorted_by_key,
384    isize_legacy_const_max,
385    isize_legacy_const_min,
386    isize_legacy_fn_max_value,
387    isize_legacy_fn_min_value,
388    isize_legacy_mod,
389    isqrt,
390    iter_cloned,
391    iter_copied,
392    iter_filter,
393    iter_repeat,
394    itertools,
395    join,
396    kw,
397    lazy_static,
398    leading_zeros,
399    lint_vec,
400    ln,
401    lock,
402    lock_api,
403    log,
404    log10,
405    log2,
406    macro_concat,
407    macro_use_imports,
408    map_break,
409    map_continue,
410    map_or,
411    map_or_else,
412    map_while,
413    match_indices,
414    matches,
415    matches_macro,
416    max,
417    max_by,
418    max_by_key,
419    max_value,
420    maximum,
421    mem_align_of,
422    mem_replace,
423    mem_size_of,
424    mem_size_of_val,
425    min,
426    min_by,
427    min_by_key,
428    min_value,
429    minimum,
430    mode,
431    module_name_repetitions,
432    msrv,
433    msrvs,
434    mut_ptr,
435    mutex,
436    needless_return,
437    next_back,
438    next_if,
439    next_if_eq,
440    next_multiple_of,
441    next_tuple,
442    nth,
443    ok,
444    ok_or,
445    once_cell,
446    open,
447    open_options_new,
448    option_expect,
449    option_unwrap,
450    or_default,
451    or_else,
452    or_insert,
453    or_insert_with,
454    os_str_to_os_string,
455    os_string_as_os_str,
456    outer_expn,
457    panic_any,
458    parse,
459    partition,
460    path_main_separator,
461    path_to_pathbuf,
462    pathbuf_as_path,
463    paths,
464    peek,
465    peek_mut,
466    peekable,
467    permissions_from_mode,
468    pin_macro,
469    pop,
470    pop_back,
471    pop_back_if,
472    pop_front,
473    pop_front_if,
474    pop_if,
475    position,
476    pow,
477    powf,
478    powi,
479    print_macro,
480    println_macro,
481    process_abort,
482    process_exit,
483    product,
484    ptr_read_volatile,
485    ptr_slice_from_raw_parts,
486    ptr_slice_from_raw_parts_mut,
487    ptr_without_provenance,
488    ptr_without_provenance_mut,
489    push,
490    push_back,
491    push_front,
492    push_str,
493    range_step,
494    read,
495    read_exact,
496    read_line,
497    read_to_end,
498    read_to_string,
499    read_unaligned,
500    read_volatile,
501    reduce,
502    redundant_imports,
503    redundant_pub_crate,
504    regex,
505    rem_euclid,
506    repeat,
507    replace,
508    replacen,
509    res,
510    reserve,
511    resize,
512    restriction,
513    result_ok_method,
514    rev,
515    rfind,
516    rmatch_indices,
517    rmatches,
518    round,
519    rposition,
520    rsplit,
521    rsplit_once,
522    rsplit_terminator,
523    rsplitn,
524    rsplitn_mut,
525    rustc_errors,
526    rustc_lint,
527    rustc_lint_defs,
528    rustc_middle,
529    rustc_span,
530    rustfmt_skip,
531    rwlock,
532    saturating_abs,
533    saturating_div,
534    saturating_pow,
535    scan,
536    seek,
537    serde,
538    set_len,
539    set_mode,
540    set_readonly,
541    signum,
542    single_component_path_imports,
543    skip,
544    skip_while,
545    slice_from_ref,
546    slice_iter,
547    slice_mut_unchecked,
548    slice_unchecked,
549    sort,
550    sort_by,
551    sort_unstable_by,
552    span_help,
553    span_lint_and_then,
554    span_note,
555    span_suggestion,
556    split,
557    split_at,
558    split_at_checked,
559    split_at_mut,
560    split_at_mut_checked,
561    split_inclusive,
562    split_once,
563    split_terminator,
564    split_whitespace,
565    splitn,
566    splitn_mut,
567    sqrt,
568    starts_with,
569    std_detect,
570    step_by,
571    str_chars,
572    str_ends_with,
573    str_len,
574    str_split_whitespace,
575    str_starts_with,
576    str_trim,
577    str_trim_end,
578    str_trim_start,
579    string_as_mut_str,
580    string_as_str,
581    string_from_utf8,
582    string_insert_str,
583    string_new,
584    string_push_str,
585    strlen,
586    style,
587    subsec_micros,
588    subsec_nanos,
589    sum,
590    symbol,
591    take,
592    take_while,
593    tcx,
594    then,
595    then_some,
596    thread_local_macro,
597    to_ascii_lowercase,
598    to_ascii_uppercase,
599    to_be_bytes,
600    to_digit,
601    to_le_bytes,
602    to_lowercase,
603    to_ne_bytes,
604    to_os_string,
605    to_owned,
606    to_owned_method,
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}