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    file_options,
261    filter,
262    filter_map,
263    find,
264    find_map,
265    finish,
266    finish_non_exhaustive,
267    first,
268    flat_map,
269    flatten,
270    floor,
271    floor_char_boundary,
272    fold,
273    for_each,
274    format_args_macro,
275    from_be_bytes,
276    from_bytes_with_nul,
277    from_bytes_with_nul_unchecked,
278    from_days,
279    from_fn,
280    from_hours,
281    from_iter_fn,
282    from_le_bytes,
283    from_micros,
284    from_millis,
285    from_mins,
286    from_nanos,
287    from_nanos_u128,
288    from_ne_bytes,
289    from_ptr,
290    from_raw,
291    from_raw_parts,
292    from_secs,
293    from_secs_f32,
294    from_secs_f64,
295    from_str_method,
296    from_str_radix,
297    from_weeks,
298    fs,
299    fs_create_dir,
300    fuse,
301    futures_util,
302    get,
303    get_mut,
304    get_or_insert,
305    get_or_insert_with,
306    get_unchecked,
307    get_unchecked_mut,
308    has_significant_drop,
309    hashmap_contains_key,
310    hashmap_drain_ty,
311    hashmap_insert,
312    hashmap_iter_mut_ty,
313    hashmap_iter_ty,
314    hashmap_keys_ty,
315    hashmap_values_mut_ty,
316    hashmap_values_ty,
317    hashset_drain_ty,
318    hashset_iter,
319    hashset_iter_ty,
320    help,
321    hidden_glob_reexports,
322    hygiene,
323    i128_legacy_const_max,
324    i128_legacy_const_min,
325    i128_legacy_fn_max_value,
326    i128_legacy_fn_min_value,
327    i128_legacy_mod,
328    i16_legacy_const_max,
329    i16_legacy_const_min,
330    i16_legacy_fn_max_value,
331    i16_legacy_fn_min_value,
332    i16_legacy_mod,
333    i32_legacy_const_max,
334    i32_legacy_const_min,
335    i32_legacy_fn_max_value,
336    i32_legacy_fn_min_value,
337    i32_legacy_mod,
338    i64_legacy_const_max,
339    i64_legacy_const_min,
340    i64_legacy_fn_max_value,
341    i64_legacy_fn_min_value,
342    i64_legacy_mod,
343    i8_legacy_const_max,
344    i8_legacy_const_min,
345    i8_legacy_fn_max_value,
346    i8_legacy_fn_min_value,
347    i8_legacy_mod,
348    ilog,
349    include_bytes_macro,
350    include_str_macro,
351    insert,
352    insert_str,
353    inspect,
354    instant_now,
355    int_roundings,
356    into,
357    into_bytes,
358    into_ok,
359    into_owned,
360    intrinsics_unaligned_volatile_load,
361    intrinsics_unaligned_volatile_store,
362    io,
363    io_error_new,
364    io_errorkind,
365    io_stderr,
366    io_stdout,
367    is_ascii,
368    is_char_boundary,
369    is_diag_item,
370    is_diagnostic_item,
371    is_digit,
372    is_empty,
373    is_err,
374    is_file,
375    is_none,
376    is_none_or,
377    is_ok,
378    is_partitioned,
379    is_some,
380    is_some_and,
381    is_sorted_by_key,
382    isize_legacy_const_max,
383    isize_legacy_const_min,
384    isize_legacy_fn_max_value,
385    isize_legacy_fn_min_value,
386    isize_legacy_mod,
387    isqrt,
388    iter_cloned,
389    iter_copied,
390    iter_filter,
391    iter_repeat,
392    itertools,
393    join,
394    kw,
395    lazy_static,
396    leading_zeros,
397    lint_vec,
398    ln,
399    lock,
400    lock_api,
401    log,
402    log10,
403    log2,
404    macro_concat,
405    macro_use_imports,
406    map_break,
407    map_continue,
408    map_or,
409    map_or_else,
410    map_while,
411    match_indices,
412    matches,
413    matches_macro,
414    max,
415    max_by,
416    max_by_key,
417    max_value,
418    maximum,
419    mem_align_of,
420    mem_replace,
421    mem_size_of,
422    mem_size_of_val,
423    min,
424    min_by,
425    min_by_key,
426    min_value,
427    minimum,
428    mode,
429    module_name_repetitions,
430    msrv,
431    msrvs,
432    mut_ptr,
433    mutex,
434    needless_return,
435    next_back,
436    next_if,
437    next_if_eq,
438    next_multiple_of,
439    next_tuple,
440    nth,
441    ok,
442    ok_or,
443    once_cell,
444    open,
445    open_options_new,
446    option_expect,
447    option_unwrap,
448    or_default,
449    or_else,
450    or_insert,
451    or_insert_with,
452    os_str_to_os_string,
453    os_string_as_os_str,
454    outer_expn,
455    panic_any,
456    parse,
457    partition,
458    path_main_separator,
459    path_to_pathbuf,
460    pathbuf_as_path,
461    paths,
462    peek,
463    peek_mut,
464    peekable,
465    permissions_from_mode,
466    pin_macro,
467    position,
468    pow,
469    powf,
470    powi,
471    print_macro,
472    println_macro,
473    process_abort,
474    process_exit,
475    product,
476    ptr_read_volatile,
477    ptr_slice_from_raw_parts,
478    ptr_slice_from_raw_parts_mut,
479    ptr_without_provenance,
480    ptr_without_provenance_mut,
481    push,
482    push_back,
483    push_front,
484    push_str,
485    range_step,
486    read,
487    read_exact,
488    read_line,
489    read_to_end,
490    read_to_string,
491    read_unaligned,
492    read_volatile,
493    reduce,
494    redundant_imports,
495    redundant_pub_crate,
496    regex,
497    rem_euclid,
498    repeat,
499    replace,
500    replacen,
501    res,
502    reserve,
503    resize,
504    restriction,
505    result_ok_method,
506    rev,
507    rfind,
508    rmatch_indices,
509    rmatches,
510    round,
511    rposition,
512    rsplit,
513    rsplit_once,
514    rsplit_terminator,
515    rsplitn,
516    rsplitn_mut,
517    rustc_errors,
518    rustc_lint,
519    rustc_lint_defs,
520    rustc_middle,
521    rustc_span,
522    rustfmt_skip,
523    rwlock,
524    saturating_abs,
525    saturating_div,
526    saturating_pow,
527    scan,
528    seek,
529    serde,
530    set_len,
531    set_mode,
532    set_readonly,
533    signum,
534    single_component_path_imports,
535    skip,
536    skip_while,
537    slice_from_ref,
538    slice_iter,
539    slice_mut_unchecked,
540    slice_unchecked,
541    sort,
542    sort_by,
543    sort_unstable_by,
544    span_help,
545    span_lint_and_then,
546    span_note,
547    span_suggestion,
548    split,
549    split_at,
550    split_at_checked,
551    split_at_mut,
552    split_at_mut_checked,
553    split_inclusive,
554    split_once,
555    split_terminator,
556    split_whitespace,
557    splitn,
558    splitn_mut,
559    sqrt,
560    starts_with,
561    std_detect,
562    step_by,
563    str_chars,
564    str_ends_with,
565    str_len,
566    str_split_whitespace,
567    str_starts_with,
568    str_trim,
569    str_trim_end,
570    str_trim_start,
571    string_as_mut_str,
572    string_as_str,
573    string_from_utf8,
574    string_insert_str,
575    string_new,
576    string_push_str,
577    strlen,
578    style,
579    subsec_micros,
580    subsec_nanos,
581    sum,
582    symbol,
583    take,
584    take_while,
585    tcx,
586    then,
587    then_some,
588    thread_local_macro,
589    to_ascii_lowercase,
590    to_ascii_uppercase,
591    to_be_bytes,
592    to_digit,
593    to_le_bytes,
594    to_lowercase,
595    to_ne_bytes,
596    to_os_string,
597    to_owned,
598    to_owned_method,
599    to_path_buf,
600    to_string_method,
601    to_uppercase,
602    todo_macro,
603    tokio,
604    trim,
605    trim_end,
606    trim_end_matches,
607    trim_start,
608    trim_start_matches,
609    truncate,
610    try_fold,
611    try_for_each,
612    try_from_fn,
613    unimplemented_macro,
614    unreachable_pub,
615    unsafe_removed_from_name,
616    unused,
617    unused_braces,
618    unused_extern_crates,
619    unused_import_braces,
620    unused_trait_names,
621    unwrap_err,
622    unwrap_err_unchecked,
623    unwrap_or_default,
624    unwrap_or_else,
625    unwrap_unchecked,
626    unzip,
627    utils,
628    vec_as_mut_slice,
629    vec_as_slice,
630    vec_from_elem,
631    vec_is_empty,
632    vec_macro,
633    vec_new,
634    vec_pop,
635    vec_with_capacity,
636    vecdeque_iter,
637    visit_str,
638    visit_string,
639    wake,
640    warnings,
641    wildcard_imports,
642    with_capacity,
643    wrapping_offset,
644    write,
645    write_unaligned,
646    write_volatile,
647    writeln,
648    zip,
649}