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    binaryheap_iter,
144    bool_then,
145    borrow,
146    borrow_mut,
147    box_assume_init_into_vec_unsafe,
148    btreemap_contains_key,
149    btreemap_insert,
150    btreeset_iter,
151    build_hasher,
152    by_ref,
153    bytes,
154    capacity,
155    cargo_clippy: "cargo-clippy",
156    cast,
157    cast_const,
158    cast_mut,
159    ceil,
160    ceil_char_boundary,
161    chain,
162    char_is_ascii,
163    char_to_digit,
164    chars,
165    check_attributes,
166    checked_abs,
167    checked_add,
168    checked_isqrt,
169    checked_mul,
170    checked_pow,
171    checked_rem_euclid,
172    checked_sub,
173    child_id,
174    child_kill,
175    clamp,
176    clippy_utils,
177    clone_into,
178    cloned,
179    cmp_max,
180    cmp_min,
181    cognitive_complexity,
182    collapsible_else_if,
183    collapsible_if,
184    collect,
185    const_ptr,
186    contains,
187    convert_identity,
188    copied,
189    copy_from,
190    copy_from_nonoverlapping,
191    copy_to,
192    copy_to_nonoverlapping,
193    core_arch,
194    core_panic_2021_macro,
195    count_ones,
196    create,
197    create_new,
198    cstring_as_c_str,
199    cx,
200    cycle,
201    cyclomatic_complexity,
202    dbg_macro,
203    de,
204    debug_struct,
205    deprecated_in_future,
206    deref_mut_method,
207    diagnostics,
208    disallowed_types,
209    drain,
210    dump,
211    duration_constructors,
212    ends_with,
213    enum_glob_use,
214    enumerate,
215    enumerate_method,
216    eprint_macro,
217    eprintln_macro,
218    err,
219    exp,
220    expect_err,
221    expn_data,
222    exported_private_dependencies,
223    extend,
224    f128_consts_mod,
225    f128_epsilon,
226    f16_consts_mod,
227    f16_epsilon,
228    f32_consts_mod,
229    f32_epsilon,
230    f32_legacy_const_digits,
231    f32_legacy_const_epsilon,
232    f32_legacy_const_infinity,
233    f32_legacy_const_mantissa_dig,
234    f32_legacy_const_max,
235    f32_legacy_const_max_10_exp,
236    f32_legacy_const_max_exp,
237    f32_legacy_const_min,
238    f32_legacy_const_min_10_exp,
239    f32_legacy_const_min_exp,
240    f32_legacy_const_min_positive,
241    f32_legacy_const_nan,
242    f32_legacy_const_neg_infinity,
243    f32_legacy_const_radix,
244    f64_consts_mod,
245    f64_epsilon,
246    f64_legacy_const_digits,
247    f64_legacy_const_epsilon,
248    f64_legacy_const_infinity,
249    f64_legacy_const_mantissa_dig,
250    f64_legacy_const_max,
251    f64_legacy_const_max_10_exp,
252    f64_legacy_const_max_exp,
253    f64_legacy_const_min,
254    f64_legacy_const_min_10_exp,
255    f64_legacy_const_min_exp,
256    f64_legacy_const_min_positive,
257    f64_legacy_const_nan,
258    f64_legacy_const_neg_infinity,
259    f64_legacy_const_radix,
260    field,
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    fs,
300    fs_create_dir,
301    fuse,
302    futures_util,
303    get,
304    get_mut,
305    get_or_insert,
306    get_or_insert_with,
307    get_unchecked,
308    get_unchecked_mut,
309    has_significant_drop,
310    hashmap_contains_key,
311    hashmap_drain_ty,
312    hashmap_insert,
313    hashmap_iter_mut_ty,
314    hashmap_iter_ty,
315    hashmap_keys_ty,
316    hashmap_values_mut_ty,
317    hashmap_values_ty,
318    hashset_drain_ty,
319    hashset_iter,
320    hashset_iter_ty,
321    help,
322    hidden_glob_reexports,
323    hygiene,
324    i128_legacy_const_max,
325    i128_legacy_const_min,
326    i128_legacy_fn_max_value,
327    i128_legacy_fn_min_value,
328    i128_legacy_mod,
329    i16_legacy_const_max,
330    i16_legacy_const_min,
331    i16_legacy_fn_max_value,
332    i16_legacy_fn_min_value,
333    i16_legacy_mod,
334    i32_legacy_const_max,
335    i32_legacy_const_min,
336    i32_legacy_fn_max_value,
337    i32_legacy_fn_min_value,
338    i32_legacy_mod,
339    i64_legacy_const_max,
340    i64_legacy_const_min,
341    i64_legacy_fn_max_value,
342    i64_legacy_fn_min_value,
343    i64_legacy_mod,
344    i8_legacy_const_max,
345    i8_legacy_const_min,
346    i8_legacy_fn_max_value,
347    i8_legacy_fn_min_value,
348    i8_legacy_mod,
349    ilog,
350    include_bytes_macro,
351    include_str_macro,
352    insert,
353    insert_str,
354    inspect,
355    instant_now,
356    int_roundings,
357    into,
358    into_bytes,
359    into_ok,
360    into_owned,
361    intrinsics_unaligned_volatile_load,
362    intrinsics_unaligned_volatile_store,
363    io,
364    io_error_new,
365    io_errorkind,
366    io_stderr,
367    io_stdout,
368    is_ascii,
369    is_char_boundary,
370    is_diag_item,
371    is_diagnostic_item,
372    is_digit,
373    is_empty,
374    is_err,
375    is_file,
376    is_none,
377    is_none_or,
378    is_ok,
379    is_partitioned,
380    is_some,
381    is_some_and,
382    is_sorted_by_key,
383    isize_legacy_const_max,
384    isize_legacy_const_min,
385    isize_legacy_fn_max_value,
386    isize_legacy_fn_min_value,
387    isize_legacy_mod,
388    isqrt,
389    iter_cloned,
390    iter_copied,
391    iter_filter,
392    iter_repeat,
393    itertools,
394    join,
395    kw,
396    lazy_static,
397    leading_zeros,
398    lint_vec,
399    ln,
400    lock,
401    lock_api,
402    log,
403    log10,
404    log2,
405    macro_concat,
406    macro_use_imports,
407    map_break,
408    map_continue,
409    map_or,
410    map_or_else,
411    map_while,
412    match_indices,
413    matches,
414    matches_macro,
415    max,
416    max_by,
417    max_by_key,
418    max_value,
419    maximum,
420    mem_align_of,
421    mem_replace,
422    mem_size_of,
423    mem_size_of_val,
424    min,
425    min_by,
426    min_by_key,
427    min_value,
428    minimum,
429    mode,
430    module_name_repetitions,
431    msrv,
432    msrvs,
433    mut_ptr,
434    mutex,
435    needless_return,
436    next_back,
437    next_if,
438    next_if_eq,
439    next_multiple_of,
440    next_tuple,
441    nth,
442    ok,
443    ok_or,
444    once_cell,
445    open,
446    open_options_new,
447    option_expect,
448    option_unwrap,
449    or_default,
450    or_else,
451    or_insert,
452    or_insert_with,
453    os_str_to_os_string,
454    os_string_as_os_str,
455    outer_expn,
456    panic_any,
457    panic_str,
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    position,
470    pow,
471    powf,
472    powi,
473    print_macro,
474    println_macro,
475    process_abort,
476    process_exit,
477    product,
478    ptr_read_volatile,
479    ptr_slice_from_raw_parts,
480    ptr_slice_from_raw_parts_mut,
481    ptr_without_provenance,
482    ptr_without_provenance_mut,
483    push,
484    push_back,
485    push_front,
486    push_str,
487    range_step,
488    read,
489    read_exact,
490    read_line,
491    read_to_end,
492    read_to_string,
493    read_unaligned,
494    read_volatile,
495    reduce,
496    redundant_imports,
497    redundant_pub_crate,
498    regex,
499    rem_euclid,
500    repeat,
501    replace,
502    replacen,
503    res,
504    reserve,
505    resize,
506    restriction,
507    result_ok_method,
508    rev,
509    rfind,
510    rmatch_indices,
511    rmatches,
512    round,
513    rposition,
514    rsplit,
515    rsplit_once,
516    rsplit_terminator,
517    rsplitn,
518    rsplitn_mut,
519    rustc_errors,
520    rustc_lint,
521    rustc_lint_defs,
522    rustc_middle,
523    rustc_span,
524    rustfmt_skip,
525    rwlock,
526    saturating_abs,
527    saturating_div,
528    saturating_pow,
529    scan,
530    seek,
531    serde,
532    set_len,
533    set_mode,
534    set_readonly,
535    signum,
536    single_component_path_imports,
537    skip,
538    skip_while,
539    slice_from_ref,
540    slice_into_vec,
541    slice_iter,
542    slice_mut_unchecked,
543    slice_unchecked,
544    sort,
545    sort_by,
546    sort_unstable_by,
547    span_help,
548    span_lint_and_then,
549    span_note,
550    span_suggestion,
551    split,
552    split_at,
553    split_at_checked,
554    split_at_mut,
555    split_at_mut_checked,
556    split_inclusive,
557    split_once,
558    split_terminator,
559    split_whitespace,
560    splitn,
561    splitn_mut,
562    sqrt,
563    starts_with,
564    std_detect,
565    step_by,
566    str_chars,
567    str_ends_with,
568    str_len,
569    str_split_whitespace,
570    str_starts_with,
571    str_trim,
572    str_trim_end,
573    str_trim_start,
574    string_as_mut_str,
575    string_as_str,
576    string_from_utf8,
577    string_insert_str,
578    string_new,
579    string_push_str,
580    strlen,
581    style,
582    subsec_micros,
583    subsec_nanos,
584    sum,
585    symbol,
586    take,
587    take_while,
588    tcx,
589    then,
590    then_some,
591    thread_local_macro,
592    to_ascii_lowercase,
593    to_ascii_uppercase,
594    to_be_bytes,
595    to_digit,
596    to_le_bytes,
597    to_lowercase,
598    to_ne_bytes,
599    to_os_string,
600    to_owned,
601    to_owned_method,
602    to_path_buf,
603    to_string_method,
604    to_uppercase,
605    todo_macro,
606    tokio,
607    trim,
608    trim_end,
609    trim_end_matches,
610    trim_start,
611    trim_start_matches,
612    truncate,
613    try_fold,
614    try_for_each,
615    try_from_fn,
616    unimplemented_macro,
617    unreachable_pub,
618    unsafe_removed_from_name,
619    unused,
620    unused_braces,
621    unused_extern_crates,
622    unused_import_braces,
623    unused_trait_names,
624    unwrap_err,
625    unwrap_err_unchecked,
626    unwrap_or_default,
627    unwrap_or_else,
628    unwrap_unchecked,
629    unzip,
630    utils,
631    vec_as_mut_slice,
632    vec_as_slice,
633    vec_from_elem,
634    vec_is_empty,
635    vec_macro,
636    vec_new,
637    vec_pop,
638    vec_with_capacity,
639    vecdeque_iter,
640    visit_str,
641    visit_string,
642    wake,
643    warnings,
644    wildcard_imports,
645    with_capacity,
646    wrapping_offset,
647    write,
648    write_unaligned,
649    write_volatile,
650    writeln,
651    zip,
652}