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_ne_bytes,
289    from_ptr,
290    from_raw,
291    from_raw_parts,
292    from_secs,
293    from_str_method,
294    from_str_radix,
295    from_weeks,
296    fs,
297    fs_create_dir,
298    fuse,
299    futures_util,
300    get,
301    get_mut,
302    get_or_insert,
303    get_or_insert_with,
304    get_unchecked,
305    get_unchecked_mut,
306    has_significant_drop,
307    hashmap_contains_key,
308    hashmap_drain_ty,
309    hashmap_insert,
310    hashmap_iter_mut_ty,
311    hashmap_iter_ty,
312    hashmap_keys_ty,
313    hashmap_values_mut_ty,
314    hashmap_values_ty,
315    hashset_drain_ty,
316    hashset_iter,
317    hashset_iter_ty,
318    help,
319    hidden_glob_reexports,
320    hygiene,
321    i128_legacy_const_max,
322    i128_legacy_const_min,
323    i128_legacy_fn_max_value,
324    i128_legacy_fn_min_value,
325    i128_legacy_mod,
326    i16_legacy_const_max,
327    i16_legacy_const_min,
328    i16_legacy_fn_max_value,
329    i16_legacy_fn_min_value,
330    i16_legacy_mod,
331    i32_legacy_const_max,
332    i32_legacy_const_min,
333    i32_legacy_fn_max_value,
334    i32_legacy_fn_min_value,
335    i32_legacy_mod,
336    i64_legacy_const_max,
337    i64_legacy_const_min,
338    i64_legacy_fn_max_value,
339    i64_legacy_fn_min_value,
340    i64_legacy_mod,
341    i8_legacy_const_max,
342    i8_legacy_const_min,
343    i8_legacy_fn_max_value,
344    i8_legacy_fn_min_value,
345    i8_legacy_mod,
346    ilog,
347    include_bytes_macro,
348    include_str_macro,
349    insert,
350    insert_str,
351    inspect,
352    instant_now,
353    int_roundings,
354    into,
355    into_bytes,
356    into_ok,
357    into_owned,
358    intrinsics_unaligned_volatile_load,
359    intrinsics_unaligned_volatile_store,
360    io,
361    io_error_new,
362    io_errorkind,
363    io_stderr,
364    io_stdout,
365    is_ascii,
366    is_char_boundary,
367    is_diag_item,
368    is_diagnostic_item,
369    is_digit,
370    is_empty,
371    is_err,
372    is_file,
373    is_none,
374    is_none_or,
375    is_ok,
376    is_partitioned,
377    is_some,
378    is_some_and,
379    is_sorted_by_key,
380    isize_legacy_const_max,
381    isize_legacy_const_min,
382    isize_legacy_fn_max_value,
383    isize_legacy_fn_min_value,
384    isize_legacy_mod,
385    isqrt,
386    iter_cloned,
387    iter_copied,
388    iter_filter,
389    iter_repeat,
390    itertools,
391    join,
392    kw,
393    lazy_static,
394    leading_zeros,
395    lint_vec,
396    ln,
397    lock,
398    lock_api,
399    log,
400    log10,
401    log2,
402    macro_concat,
403    macro_use_imports,
404    map_break,
405    map_continue,
406    map_or,
407    map_or_else,
408    map_while,
409    match_indices,
410    matches,
411    matches_macro,
412    max,
413    max_by,
414    max_by_key,
415    max_value,
416    maximum,
417    mem_align_of,
418    mem_replace,
419    mem_size_of,
420    mem_size_of_val,
421    min,
422    min_by,
423    min_by_key,
424    min_value,
425    minimum,
426    mode,
427    module_name_repetitions,
428    msrv,
429    msrvs,
430    mut_ptr,
431    mutex,
432    needless_return,
433    next_back,
434    next_if,
435    next_if_eq,
436    next_multiple_of,
437    next_tuple,
438    nth,
439    ok,
440    ok_or,
441    once_cell,
442    open,
443    open_options_new,
444    option_expect,
445    option_unwrap,
446    or_default,
447    or_else,
448    or_insert,
449    or_insert_with,
450    os_str_to_os_string,
451    os_string_as_os_str,
452    outer_expn,
453    panic_any,
454    panic_str,
455    parse,
456    partition,
457    path_main_separator,
458    path_to_pathbuf,
459    pathbuf_as_path,
460    paths,
461    peek,
462    peek_mut,
463    peekable,
464    permissions_from_mode,
465    pin_macro,
466    position,
467    pow,
468    powf,
469    powi,
470    print_macro,
471    println_macro,
472    process_abort,
473    process_exit,
474    product,
475    ptr_read_volatile,
476    ptr_slice_from_raw_parts,
477    ptr_slice_from_raw_parts_mut,
478    ptr_without_provenance,
479    ptr_without_provenance_mut,
480    push,
481    push_back,
482    push_front,
483    push_str,
484    range_step,
485    read,
486    read_exact,
487    read_line,
488    read_to_end,
489    read_to_string,
490    read_unaligned,
491    read_volatile,
492    reduce,
493    redundant_imports,
494    redundant_pub_crate,
495    regex,
496    rem_euclid,
497    repeat,
498    replace,
499    replacen,
500    res,
501    reserve,
502    resize,
503    restriction,
504    result_ok_method,
505    rev,
506    rfind,
507    rmatch_indices,
508    rmatches,
509    round,
510    rposition,
511    rsplit,
512    rsplit_once,
513    rsplit_terminator,
514    rsplitn,
515    rsplitn_mut,
516    rustc_errors,
517    rustc_lint,
518    rustc_lint_defs,
519    rustc_middle,
520    rustc_span,
521    rustfmt_skip,
522    rwlock,
523    saturating_abs,
524    saturating_div,
525    saturating_pow,
526    scan,
527    seek,
528    serde,
529    set_len,
530    set_mode,
531    set_readonly,
532    signum,
533    single_component_path_imports,
534    skip,
535    skip_while,
536    slice_from_ref,
537    slice_into_vec,
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}