mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
25171f23ae
Add a lint to detect when the recently added Vec::pop_if, VecDeque::pop_front_if, and VecDeque::pop_back_if are manually implemented. changelog: add [`manual_pop_if`] lint
658 lines
12 KiB
Rust
658 lines
12 KiB
Rust
#![allow(non_upper_case_globals)]
|
|
|
|
use rustc_span::symbol::PREDEFINED_SYMBOLS_COUNT;
|
|
|
|
#[doc(no_inline)]
|
|
pub use rustc_span::sym::*;
|
|
|
|
macro_rules! val {
|
|
($name:ident) => {
|
|
stringify!($name)
|
|
};
|
|
($name:ident $value:literal) => {
|
|
$value
|
|
};
|
|
}
|
|
|
|
macro_rules! generate {
|
|
($($name:ident $(: $value:literal)? ,)*) => {
|
|
/// To be supplied to `rustc_interface::Config`
|
|
pub const EXTRA_SYMBOLS: &[&str] = &[
|
|
$(
|
|
val!($name $($value)?),
|
|
)*
|
|
];
|
|
|
|
$(
|
|
pub const $name: rustc_span::Symbol = rustc_span::Symbol::new(PREDEFINED_SYMBOLS_COUNT + ${index()});
|
|
)*
|
|
};
|
|
}
|
|
|
|
// List of extra symbols to be included in Clippy (for example, as `sym::ambiguous_glob_reexports`).
|
|
// An alternative content can be specified using a colon after the symbol name.
|
|
//
|
|
// `cargo dev fmt` ensures that the content of the `generate!()` macro call stays sorted.
|
|
generate! {
|
|
Any,
|
|
Applicability,
|
|
ArrayIntoIter,
|
|
AsyncReadExt,
|
|
AsyncWriteExt,
|
|
BACKSLASH_SINGLE_QUOTE: r"\'",
|
|
BTreeEntry,
|
|
BTreeSet,
|
|
Binary,
|
|
BinaryHeap,
|
|
CLIPPY_ARGS,
|
|
CLIPPY_CONF_DIR,
|
|
CRLF: "\r\n",
|
|
Cargo_toml: "Cargo.toml",
|
|
Child,
|
|
Command,
|
|
Cow,
|
|
Current,
|
|
DOUBLE_QUOTE: "\"",
|
|
DebugStruct,
|
|
Deserialize,
|
|
DirBuilder,
|
|
DoubleEndedIterator,
|
|
Duration,
|
|
EarlyContext,
|
|
EarlyLintPass,
|
|
Enumerate,
|
|
Error,
|
|
File,
|
|
FileType,
|
|
FsOpenOptions,
|
|
FsPermissions,
|
|
HashMapEntry,
|
|
Instant,
|
|
IntoIter,
|
|
IoBufRead,
|
|
IoLines,
|
|
IoRead,
|
|
IoSeek,
|
|
IoWrite,
|
|
IpAddr,
|
|
Ipv4Addr,
|
|
Ipv6Addr,
|
|
IterEmpty,
|
|
IterOnce,
|
|
IterPeekable,
|
|
Itertools,
|
|
LF: "\n",
|
|
LateContext,
|
|
Lazy,
|
|
LinkedList,
|
|
Lint,
|
|
LowerExp,
|
|
LowerHex,
|
|
MAX,
|
|
MIN,
|
|
MaybeDef,
|
|
MsrvStack,
|
|
Octal,
|
|
OpenOptions,
|
|
OsStr,
|
|
OsString,
|
|
Path,
|
|
PathBuf,
|
|
PathLookup,
|
|
RangeBounds,
|
|
Receiver,
|
|
RefCellRef,
|
|
RefCellRefMut,
|
|
Regex,
|
|
RegexBuilder,
|
|
RegexSet,
|
|
Saturating,
|
|
SeekFrom,
|
|
SliceIter,
|
|
Start,
|
|
Stdin,
|
|
Symbol,
|
|
SyntaxContext,
|
|
TBD,
|
|
ToOwned,
|
|
ToString,
|
|
UpperExp,
|
|
UpperHex,
|
|
V4,
|
|
V6,
|
|
VecDeque,
|
|
Visitor,
|
|
Waker,
|
|
Weak,
|
|
Wrapping,
|
|
abs,
|
|
ambiguous_glob_reexports,
|
|
app,
|
|
append,
|
|
applicability,
|
|
arg,
|
|
as_bytes,
|
|
as_deref,
|
|
as_deref_mut,
|
|
as_mut,
|
|
as_path,
|
|
as_ptr,
|
|
as_str,
|
|
assert_failed,
|
|
author,
|
|
back,
|
|
binaryheap_iter,
|
|
bool_then,
|
|
borrow,
|
|
borrow_mut,
|
|
box_assume_init_into_vec_unsafe,
|
|
btreemap_contains_key,
|
|
btreemap_insert,
|
|
btreeset_iter,
|
|
build_hasher,
|
|
by_ref,
|
|
bytes,
|
|
capacity,
|
|
cargo_clippy: "cargo-clippy",
|
|
cast,
|
|
cast_const,
|
|
cast_mut,
|
|
ceil,
|
|
ceil_char_boundary,
|
|
chain,
|
|
char_is_ascii,
|
|
char_to_digit,
|
|
chars,
|
|
check_attributes,
|
|
checked_abs,
|
|
checked_add,
|
|
checked_isqrt,
|
|
checked_mul,
|
|
checked_pow,
|
|
checked_rem_euclid,
|
|
checked_sub,
|
|
child_id,
|
|
child_kill,
|
|
clamp,
|
|
clippy_utils,
|
|
clone_into,
|
|
cloned,
|
|
cmp_max,
|
|
cmp_min,
|
|
cognitive_complexity,
|
|
collapsible_else_if,
|
|
collapsible_if,
|
|
collect,
|
|
const_ptr,
|
|
contains,
|
|
convert_identity,
|
|
copied,
|
|
copy_from,
|
|
copy_from_nonoverlapping,
|
|
copy_to,
|
|
copy_to_nonoverlapping,
|
|
core_arch,
|
|
core_panic_2021_macro,
|
|
count_ones,
|
|
create,
|
|
create_new,
|
|
cstring_as_c_str,
|
|
cx,
|
|
cycle,
|
|
cyclomatic_complexity,
|
|
dbg_macro,
|
|
de,
|
|
debug_struct,
|
|
deprecated_in_future,
|
|
deref_mut_method,
|
|
diagnostics,
|
|
disallowed_types,
|
|
drain,
|
|
dump,
|
|
duration_constructors,
|
|
ends_with,
|
|
enum_glob_use,
|
|
enumerate,
|
|
enumerate_method,
|
|
eprint_macro,
|
|
eprintln_macro,
|
|
err,
|
|
exp,
|
|
expect_err,
|
|
expn_data,
|
|
exported_private_dependencies,
|
|
extend,
|
|
f128_consts_mod,
|
|
f128_epsilon,
|
|
f16_consts_mod,
|
|
f16_epsilon,
|
|
f32_consts_mod,
|
|
f32_epsilon,
|
|
f32_legacy_const_digits,
|
|
f32_legacy_const_epsilon,
|
|
f32_legacy_const_infinity,
|
|
f32_legacy_const_mantissa_dig,
|
|
f32_legacy_const_max,
|
|
f32_legacy_const_max_10_exp,
|
|
f32_legacy_const_max_exp,
|
|
f32_legacy_const_min,
|
|
f32_legacy_const_min_10_exp,
|
|
f32_legacy_const_min_exp,
|
|
f32_legacy_const_min_positive,
|
|
f32_legacy_const_nan,
|
|
f32_legacy_const_neg_infinity,
|
|
f32_legacy_const_radix,
|
|
f64_consts_mod,
|
|
f64_epsilon,
|
|
f64_legacy_const_digits,
|
|
f64_legacy_const_epsilon,
|
|
f64_legacy_const_infinity,
|
|
f64_legacy_const_mantissa_dig,
|
|
f64_legacy_const_max,
|
|
f64_legacy_const_max_10_exp,
|
|
f64_legacy_const_max_exp,
|
|
f64_legacy_const_min,
|
|
f64_legacy_const_min_10_exp,
|
|
f64_legacy_const_min_exp,
|
|
f64_legacy_const_min_positive,
|
|
f64_legacy_const_nan,
|
|
f64_legacy_const_neg_infinity,
|
|
f64_legacy_const_radix,
|
|
file_options,
|
|
filter,
|
|
filter_map,
|
|
find,
|
|
find_map,
|
|
finish,
|
|
finish_non_exhaustive,
|
|
first,
|
|
flat_map,
|
|
flatten,
|
|
floor,
|
|
floor_char_boundary,
|
|
fold,
|
|
for_each,
|
|
format_args_macro,
|
|
from_be_bytes,
|
|
from_bytes_with_nul,
|
|
from_bytes_with_nul_unchecked,
|
|
from_days,
|
|
from_fn,
|
|
from_hours,
|
|
from_iter_fn,
|
|
from_le_bytes,
|
|
from_micros,
|
|
from_millis,
|
|
from_mins,
|
|
from_nanos,
|
|
from_nanos_u128,
|
|
from_ne_bytes,
|
|
from_ptr,
|
|
from_raw,
|
|
from_raw_parts,
|
|
from_secs,
|
|
from_secs_f32,
|
|
from_secs_f64,
|
|
from_str_method,
|
|
from_str_radix,
|
|
from_weeks,
|
|
front,
|
|
fs,
|
|
fs_create_dir,
|
|
fuse,
|
|
futures_util,
|
|
get,
|
|
get_mut,
|
|
get_or_insert,
|
|
get_or_insert_with,
|
|
get_unchecked,
|
|
get_unchecked_mut,
|
|
has_significant_drop,
|
|
hashmap_contains_key,
|
|
hashmap_drain_ty,
|
|
hashmap_insert,
|
|
hashmap_iter_mut_ty,
|
|
hashmap_iter_ty,
|
|
hashmap_keys_ty,
|
|
hashmap_values_mut_ty,
|
|
hashmap_values_ty,
|
|
hashset_drain_ty,
|
|
hashset_iter,
|
|
hashset_iter_ty,
|
|
help,
|
|
hidden_glob_reexports,
|
|
hygiene,
|
|
i128_legacy_const_max,
|
|
i128_legacy_const_min,
|
|
i128_legacy_fn_max_value,
|
|
i128_legacy_fn_min_value,
|
|
i128_legacy_mod,
|
|
i16_legacy_const_max,
|
|
i16_legacy_const_min,
|
|
i16_legacy_fn_max_value,
|
|
i16_legacy_fn_min_value,
|
|
i16_legacy_mod,
|
|
i32_legacy_const_max,
|
|
i32_legacy_const_min,
|
|
i32_legacy_fn_max_value,
|
|
i32_legacy_fn_min_value,
|
|
i32_legacy_mod,
|
|
i64_legacy_const_max,
|
|
i64_legacy_const_min,
|
|
i64_legacy_fn_max_value,
|
|
i64_legacy_fn_min_value,
|
|
i64_legacy_mod,
|
|
i8_legacy_const_max,
|
|
i8_legacy_const_min,
|
|
i8_legacy_fn_max_value,
|
|
i8_legacy_fn_min_value,
|
|
i8_legacy_mod,
|
|
ilog,
|
|
include_bytes_macro,
|
|
include_str_macro,
|
|
insert,
|
|
insert_str,
|
|
inspect,
|
|
instant_now,
|
|
int_roundings,
|
|
into,
|
|
into_bytes,
|
|
into_ok,
|
|
into_owned,
|
|
intrinsics_unaligned_volatile_load,
|
|
intrinsics_unaligned_volatile_store,
|
|
io,
|
|
io_error_new,
|
|
io_errorkind,
|
|
io_stderr,
|
|
io_stdout,
|
|
is_ascii,
|
|
is_char_boundary,
|
|
is_diag_item,
|
|
is_diagnostic_item,
|
|
is_digit,
|
|
is_empty,
|
|
is_err,
|
|
is_file,
|
|
is_none,
|
|
is_none_or,
|
|
is_ok,
|
|
is_partitioned,
|
|
is_some,
|
|
is_some_and,
|
|
is_sorted_by_key,
|
|
isize_legacy_const_max,
|
|
isize_legacy_const_min,
|
|
isize_legacy_fn_max_value,
|
|
isize_legacy_fn_min_value,
|
|
isize_legacy_mod,
|
|
isqrt,
|
|
iter_cloned,
|
|
iter_copied,
|
|
iter_filter,
|
|
iter_repeat,
|
|
itertools,
|
|
join,
|
|
kw,
|
|
lazy_static,
|
|
leading_zeros,
|
|
lint_vec,
|
|
ln,
|
|
lock,
|
|
lock_api,
|
|
log,
|
|
log10,
|
|
log2,
|
|
macro_concat,
|
|
macro_use_imports,
|
|
map_break,
|
|
map_continue,
|
|
map_or,
|
|
map_or_else,
|
|
map_while,
|
|
match_indices,
|
|
matches,
|
|
matches_macro,
|
|
max,
|
|
max_by,
|
|
max_by_key,
|
|
max_value,
|
|
maximum,
|
|
mem_align_of,
|
|
mem_replace,
|
|
mem_size_of,
|
|
mem_size_of_val,
|
|
min,
|
|
min_by,
|
|
min_by_key,
|
|
min_value,
|
|
minimum,
|
|
mode,
|
|
module_name_repetitions,
|
|
msrv,
|
|
msrvs,
|
|
mut_ptr,
|
|
mutex,
|
|
needless_return,
|
|
next_back,
|
|
next_if,
|
|
next_if_eq,
|
|
next_multiple_of,
|
|
next_tuple,
|
|
nth,
|
|
ok,
|
|
ok_or,
|
|
once_cell,
|
|
open,
|
|
open_options_new,
|
|
option_expect,
|
|
option_unwrap,
|
|
or_default,
|
|
or_else,
|
|
or_insert,
|
|
or_insert_with,
|
|
os_str_to_os_string,
|
|
os_string_as_os_str,
|
|
outer_expn,
|
|
panic_any,
|
|
parse,
|
|
partition,
|
|
path_main_separator,
|
|
path_to_pathbuf,
|
|
pathbuf_as_path,
|
|
paths,
|
|
peek,
|
|
peek_mut,
|
|
peekable,
|
|
permissions_from_mode,
|
|
pin_macro,
|
|
pop,
|
|
pop_back,
|
|
pop_back_if,
|
|
pop_front,
|
|
pop_front_if,
|
|
pop_if,
|
|
position,
|
|
pow,
|
|
powf,
|
|
powi,
|
|
print_macro,
|
|
println_macro,
|
|
process_abort,
|
|
process_exit,
|
|
product,
|
|
ptr_read_volatile,
|
|
ptr_slice_from_raw_parts,
|
|
ptr_slice_from_raw_parts_mut,
|
|
ptr_without_provenance,
|
|
ptr_without_provenance_mut,
|
|
push,
|
|
push_back,
|
|
push_front,
|
|
push_str,
|
|
range_step,
|
|
read,
|
|
read_exact,
|
|
read_line,
|
|
read_to_end,
|
|
read_to_string,
|
|
read_unaligned,
|
|
read_volatile,
|
|
reduce,
|
|
redundant_imports,
|
|
redundant_pub_crate,
|
|
regex,
|
|
rem_euclid,
|
|
repeat,
|
|
replace,
|
|
replacen,
|
|
res,
|
|
reserve,
|
|
resize,
|
|
restriction,
|
|
result_ok_method,
|
|
rev,
|
|
rfind,
|
|
rmatch_indices,
|
|
rmatches,
|
|
round,
|
|
rposition,
|
|
rsplit,
|
|
rsplit_once,
|
|
rsplit_terminator,
|
|
rsplitn,
|
|
rsplitn_mut,
|
|
rustc_errors,
|
|
rustc_lint,
|
|
rustc_lint_defs,
|
|
rustc_middle,
|
|
rustc_span,
|
|
rustfmt_skip,
|
|
rwlock,
|
|
saturating_abs,
|
|
saturating_div,
|
|
saturating_pow,
|
|
scan,
|
|
seek,
|
|
serde,
|
|
set_len,
|
|
set_mode,
|
|
set_readonly,
|
|
signum,
|
|
single_component_path_imports,
|
|
skip,
|
|
skip_while,
|
|
slice_from_ref,
|
|
slice_iter,
|
|
slice_mut_unchecked,
|
|
slice_unchecked,
|
|
sort,
|
|
sort_by,
|
|
sort_unstable_by,
|
|
span_help,
|
|
span_lint_and_then,
|
|
span_note,
|
|
span_suggestion,
|
|
split,
|
|
split_at,
|
|
split_at_checked,
|
|
split_at_mut,
|
|
split_at_mut_checked,
|
|
split_inclusive,
|
|
split_once,
|
|
split_terminator,
|
|
split_whitespace,
|
|
splitn,
|
|
splitn_mut,
|
|
sqrt,
|
|
starts_with,
|
|
std_detect,
|
|
step_by,
|
|
str_chars,
|
|
str_ends_with,
|
|
str_len,
|
|
str_split_whitespace,
|
|
str_starts_with,
|
|
str_trim,
|
|
str_trim_end,
|
|
str_trim_start,
|
|
string_as_mut_str,
|
|
string_as_str,
|
|
string_from_utf8,
|
|
string_insert_str,
|
|
string_new,
|
|
string_push_str,
|
|
strlen,
|
|
style,
|
|
subsec_micros,
|
|
subsec_nanos,
|
|
sum,
|
|
symbol,
|
|
take,
|
|
take_while,
|
|
tcx,
|
|
then,
|
|
then_some,
|
|
thread_local_macro,
|
|
to_ascii_lowercase,
|
|
to_ascii_uppercase,
|
|
to_be_bytes,
|
|
to_digit,
|
|
to_le_bytes,
|
|
to_lowercase,
|
|
to_ne_bytes,
|
|
to_os_string,
|
|
to_owned,
|
|
to_owned_method,
|
|
to_path_buf,
|
|
to_string_method,
|
|
to_uppercase,
|
|
todo_macro,
|
|
tokio,
|
|
trim,
|
|
trim_end,
|
|
trim_end_matches,
|
|
trim_start,
|
|
trim_start_matches,
|
|
truncate,
|
|
try_fold,
|
|
try_for_each,
|
|
try_from_fn,
|
|
unimplemented_macro,
|
|
unreachable_pub,
|
|
unsafe_removed_from_name,
|
|
unused,
|
|
unused_braces,
|
|
unused_extern_crates,
|
|
unused_import_braces,
|
|
unused_trait_names,
|
|
unwrap_err,
|
|
unwrap_err_unchecked,
|
|
unwrap_or_default,
|
|
unwrap_or_else,
|
|
unwrap_unchecked,
|
|
unzip,
|
|
utils,
|
|
vec_as_mut_slice,
|
|
vec_as_slice,
|
|
vec_from_elem,
|
|
vec_is_empty,
|
|
vec_macro,
|
|
vec_new,
|
|
vec_pop,
|
|
vec_with_capacity,
|
|
vecdeque_iter,
|
|
visit_str,
|
|
visit_string,
|
|
wake,
|
|
warnings,
|
|
wildcard_imports,
|
|
with_capacity,
|
|
wrapping_offset,
|
|
write,
|
|
write_unaligned,
|
|
write_volatile,
|
|
writeln,
|
|
zip,
|
|
}
|