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    Applicability,
38    AsyncReadExt,
39    AsyncWriteExt,
40    BACKSLASH_SINGLE_QUOTE: r"\'",
41    Binary,
42    CLIPPY_ARGS,
43    CLIPPY_CONF_DIR,
44    CRLF: "\r\n",
45    Cargo_toml: "Cargo.toml",
46    Current,
47    DOUBLE_QUOTE: "\"",
48    Deserialize,
49    EarlyContext,
50    EarlyLintPass,
51    IntoIter,
52    Itertools,
53    LF: "\n",
54    LateContext,
55    Lazy,
56    Lint,
57    LowerExp,
58    LowerHex,
59    MAX,
60    MIN,
61    MaybeDef,
62    MsrvStack,
63    Octal,
64    OpenOptions,
65    PathLookup,
66    Regex,
67    RegexBuilder,
68    RegexSet,
69    Start,
70    Symbol,
71    SyntaxContext,
72    TBD,
73    UpperExp,
74    UpperHex,
75    V4,
76    V6,
77    Visitor,
78    Weak,
79    abs,
80    ambiguous_glob_reexports,
81    app,
82    append,
83    applicability,
84    arg,
85    as_bytes,
86    as_deref,
87    as_deref_mut,
88    as_mut,
89    as_path,
90    assert_failed,
91    author,
92    borrow,
93    borrow_mut,
94    build_hasher,
95    by_ref,
96    bytes,
97    capacity,
98    cargo_clippy: "cargo-clippy",
99    cast,
100    cast_const,
101    cast_mut,
102    ceil,
103    ceil_char_boundary,
104    chain,
105    chars,
106    check_attributes,
107    checked_abs,
108    checked_add,
109    checked_isqrt,
110    checked_mul,
111    checked_pow,
112    checked_rem_euclid,
113    checked_sub,
114    clamp,
115    clippy_utils,
116    clone_into,
117    cloned,
118    cognitive_complexity,
119    collapsible_else_if,
120    collapsible_if,
121    collect,
122    const_ptr,
123    contains,
124    copied,
125    copy_from,
126    copy_from_nonoverlapping,
127    copy_to,
128    copy_to_nonoverlapping,
129    core_arch,
130    count_ones,
131    create,
132    create_new,
133    cx,
134    cycle,
135    cyclomatic_complexity,
136    de,
137    deprecated_in_future,
138    diagnostics,
139    disallowed_types,
140    drain,
141    dump,
142    duration_constructors,
143    ends_with,
144    enum_glob_use,
145    enumerate,
146    err,
147    exp,
148    expect_err,
149    expn_data,
150    extend,
151    filter,
152    filter_map,
153    find,
154    find_map,
155    finish,
156    finish_non_exhaustive,
157    first,
158    flat_map,
159    flatten,
160    floor,
161    floor_char_boundary,
162    fold,
163    for_each,
164    from_be_bytes,
165    from_bytes_with_nul,
166    from_bytes_with_nul_unchecked,
167    from_days,
168    from_hours,
169    from_le_bytes,
170    from_micros,
171    from_millis,
172    from_mins,
173    from_nanos,
174    from_ne_bytes,
175    from_ptr,
176    from_raw,
177    from_raw_parts,
178    from_secs,
179    from_str_radix,
180    from_weeks,
181    fs,
182    fuse,
183    futures_util,
184    get,
185    get_mut,
186    get_or_insert,
187    get_or_insert_with,
188    get_unchecked,
189    get_unchecked_mut,
190    has_significant_drop,
191    help,
192    hidden_glob_reexports,
193    hygiene,
194    ilog,
195    insert,
196    insert_str,
197    inspect,
198    int_roundings,
199    into,
200    into_bytes,
201    into_ok,
202    into_owned,
203    io,
204    is_ascii,
205    is_char_boundary,
206    is_diag_item,
207    is_diagnostic_item,
208    is_digit,
209    is_empty,
210    is_err,
211    is_file,
212    is_none,
213    is_none_or,
214    is_ok,
215    is_partitioned,
216    is_some,
217    is_some_and,
218    is_sorted_by_key,
219    isqrt,
220    itertools,
221    join,
222    kw,
223    lazy_static,
224    leading_zeros,
225    lint_vec,
226    ln,
227    lock,
228    lock_api,
229    log,
230    log10,
231    log2,
232    macro_use_imports,
233    map_break,
234    map_continue,
235    map_or,
236    map_or_else,
237    map_while,
238    match_indices,
239    matches,
240    max,
241    max_by,
242    max_by_key,
243    max_value,
244    maximum,
245    min,
246    min_by,
247    min_by_key,
248    min_value,
249    minimum,
250    mode,
251    module_name_repetitions,
252    msrv,
253    msrvs,
254    mut_ptr,
255    mutex,
256    needless_return,
257    next_back,
258    next_if,
259    next_if_eq,
260    next_multiple_of,
261    next_tuple,
262    nth,
263    ok,
264    ok_or,
265    once_cell,
266    open,
267    or_default,
268    or_else,
269    or_insert,
270    or_insert_with,
271    outer_expn,
272    panic_str,
273    parse,
274    partition,
275    paths,
276    peek,
277    peek_mut,
278    peekable,
279    pow,
280    powf,
281    powi,
282    product,
283    push,
284    push_back,
285    push_front,
286    push_str,
287    read,
288    read_exact,
289    read_line,
290    read_to_end,
291    read_to_string,
292    read_unaligned,
293    read_volatile,
294    reduce,
295    redundant_imports,
296    redundant_pub_crate,
297    regex,
298    rem_euclid,
299    repeat,
300    replace,
301    replacen,
302    res,
303    reserve,
304    resize,
305    restriction,
306    rev,
307    rfind,
308    rmatch_indices,
309    rmatches,
310    round,
311    rposition,
312    rsplit,
313    rsplit_once,
314    rsplit_terminator,
315    rsplitn,
316    rsplitn_mut,
317    rustc_errors,
318    rustc_lint,
319    rustc_lint_defs,
320    rustc_middle,
321    rustc_span,
322    rustfmt_skip,
323    rwlock,
324    saturating_abs,
325    saturating_pow,
326    scan,
327    seek,
328    serde,
329    set_len,
330    set_mode,
331    set_readonly,
332    signum,
333    single_component_path_imports,
334    skip_while,
335    slice_mut_unchecked,
336    slice_unchecked,
337    sort,
338    sort_by,
339    sort_unstable_by,
340    span_help,
341    span_lint_and_then,
342    span_note,
343    span_suggestion,
344    split,
345    split_at,
346    split_at_checked,
347    split_at_mut,
348    split_at_mut_checked,
349    split_inclusive,
350    split_once,
351    split_terminator,
352    split_whitespace,
353    splitn,
354    splitn_mut,
355    sqrt,
356    starts_with,
357    std_detect,
358    step_by,
359    strlen,
360    style,
361    subsec_micros,
362    subsec_nanos,
363    sum,
364    symbol,
365    take,
366    take_while,
367    tcx,
368    then,
369    then_some,
370    to_ascii_lowercase,
371    to_ascii_uppercase,
372    to_be_bytes,
373    to_digit,
374    to_le_bytes,
375    to_lowercase,
376    to_ne_bytes,
377    to_os_string,
378    to_owned,
379    to_path_buf,
380    to_uppercase,
381    tokio,
382    trim,
383    trim_end,
384    trim_end_matches,
385    trim_start,
386    trim_start_matches,
387    truncate,
388    try_fold,
389    try_for_each,
390    unreachable_pub,
391    unsafe_removed_from_name,
392    unused,
393    unused_braces,
394    unused_extern_crates,
395    unused_import_braces,
396    unused_trait_names,
397    unwrap_err,
398    unwrap_err_unchecked,
399    unwrap_or_default,
400    unwrap_or_else,
401    unwrap_unchecked,
402    unzip,
403    utils,
404    visit_str,
405    visit_string,
406    wake,
407    warnings,
408    wildcard_imports,
409    with_capacity,
410    wrapping_offset,
411    write,
412    write_unaligned,
413    write_volatile,
414    writeln,
415    zip,
416}