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    panic_str,
457    parse,
458    partition,
459    path_main_separator,
460    path_to_pathbuf,
461    pathbuf_as_path,
462    paths,
463    peek,
464    peek_mut,
465    peekable,
466    permissions_from_mode,
467    pin_macro,
468    position,
469    pow,
470    powf,
471    powi,
472    print_macro,
473    println_macro,
474    process_abort,
475    process_exit,
476    product,
477    ptr_read_volatile,
478    ptr_slice_from_raw_parts,
479    ptr_slice_from_raw_parts_mut,
480    ptr_without_provenance,
481    ptr_without_provenance_mut,
482    push,
483    push_back,
484    push_front,
485    push_str,
486    range_step,
487    read,
488    read_exact,
489    read_line,
490    read_to_end,
491    read_to_string,
492    read_unaligned,
493    read_volatile,
494    reduce,
495    redundant_imports,
496    redundant_pub_crate,
497    regex,
498    rem_euclid,
499    repeat,
500    replace,
501    replacen,
502    res,
503    reserve,
504    resize,
505    restriction,
506    result_ok_method,
507    rev,
508    rfind,
509    rmatch_indices,
510    rmatches,
511    round,
512    rposition,
513    rsplit,
514    rsplit_once,
515    rsplit_terminator,
516    rsplitn,
517    rsplitn_mut,
518    rustc_errors,
519    rustc_lint,
520    rustc_lint_defs,
521    rustc_middle,
522    rustc_span,
523    rustfmt_skip,
524    rwlock,
525    saturating_abs,
526    saturating_div,
527    saturating_pow,
528    scan,
529    seek,
530    serde,
531    set_len,
532    set_mode,
533    set_readonly,
534    signum,
535    single_component_path_imports,
536    skip,
537    skip_while,
538    slice_from_ref,
539    slice_into_vec,
540    slice_iter,
541    slice_mut_unchecked,
542    slice_unchecked,
543    sort,
544    sort_by,
545    sort_unstable_by,
546    span_help,
547    span_lint_and_then,
548    span_note,
549    span_suggestion,
550    split,
551    split_at,
552    split_at_checked,
553    split_at_mut,
554    split_at_mut_checked,
555    split_inclusive,
556    split_once,
557    split_terminator,
558    split_whitespace,
559    splitn,
560    splitn_mut,
561    sqrt,
562    starts_with,
563    std_detect,
564    step_by,
565    str_chars,
566    str_ends_with,
567    str_len,
568    str_split_whitespace,
569    str_starts_with,
570    str_trim,
571    str_trim_end,
572    str_trim_start,
573    string_as_mut_str,
574    string_as_str,
575    string_from_utf8,
576    string_insert_str,
577    string_new,
578    string_push_str,
579    strlen,
580    style,
581    subsec_micros,
582    subsec_nanos,
583    sum,
584    symbol,
585    take,
586    take_while,
587    tcx,
588    then,
589    then_some,
590    thread_local_macro,
591    to_ascii_lowercase,
592    to_ascii_uppercase,
593    to_be_bytes,
594    to_digit,
595    to_le_bytes,
596    to_lowercase,
597    to_ne_bytes,
598    to_os_string,
599    to_owned,
600    to_owned_method,
601    to_path_buf,
602    to_string_method,
603    to_uppercase,
604    todo_macro,
605    tokio,
606    trim,
607    trim_end,
608    trim_end_matches,
609    trim_start,
610    trim_start_matches,
611    truncate,
612    try_fold,
613    try_for_each,
614    try_from_fn,
615    unimplemented_macro,
616    unreachable_pub,
617    unsafe_removed_from_name,
618    unused,
619    unused_braces,
620    unused_extern_crates,
621    unused_import_braces,
622    unused_trait_names,
623    unwrap_err,
624    unwrap_err_unchecked,
625    unwrap_or_default,
626    unwrap_or_else,
627    unwrap_unchecked,
628    unzip,
629    utils,
630    vec_as_mut_slice,
631    vec_as_slice,
632    vec_from_elem,
633    vec_is_empty,
634    vec_macro,
635    vec_new,
636    vec_pop,
637    vec_with_capacity,
638    vecdeque_iter,
639    visit_str,
640    visit_string,
641    wake,
642    warnings,
643    wildcard_imports,
644    with_capacity,
645    wrapping_offset,
646    write,
647    write_unaligned,
648    write_volatile,
649    writeln,
650    zip,
651}