Auto merge of #9541 - Alexendoo:declare-proc-macro, r=flip1995
Generate lint categories and explanations with `declare_clippy_lint` This means contributors will no longer have to run `cargo dev update_lints` after changing a lints documentation or its category, which may also mean fewer merge conflicts in general It works by swapping `declare_clippy_lint` out for a `proc_macro` of the same name. The proc macro emits a `LintInfo` alongside the generated `Lint` which are gathered into `declared_lint::LINTS`. The categories/explanations are then read from `declared_lint::LINTS` at runtime The removal of `src/docs` is split into a separate commit to be more easily ignored It is slightly slower though, adding a bit under a second to build time. Less noticeable in full builds or with a slower linker (benchmark uses mold) ```bash hyperfine --warmup 2 \ --parameter-list commit "declare-proc-macro,master" \ --command-name "{commit}" \ --setup "git checkout {commit}" \ --prepare "touch clippy_lints/src/lib.rs" \ "cargo build" ``` ``` Benchmark 1: declare-proc-macro Time (mean ± σ): 10.731 s ± 0.154 s [User: 7.739 s, System: 1.791 s] Range (min … max): 10.598 s … 11.125 s 10 runs Benchmark 2: master Time (mean ± σ): 9.422 s ± 0.094 s [User: 7.183 s, System: 1.732 s] Range (min … max): 9.287 s … 9.624 s 10 runs Summary 'master' ran 1.14 ± 0.02 times faster than 'declare-proc-macro' ``` r? `@flip1995` cc `@llogiq` for `--explain` changelog: none
This commit is contained in:
commit
5b09d4e1f7
|
@ -3,7 +3,7 @@ use aho_corasick::AhoCorasickBuilder;
|
|||
use indoc::writedoc;
|
||||
use itertools::Itertools;
|
||||
use rustc_lexer::{tokenize, unescape, LiteralKind, TokenKind};
|
||||
use std::collections::{BTreeSet, HashMap, HashSet};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::fmt::Write;
|
||||
use std::fs::{self, OpenOptions};
|
||||
|
@ -104,9 +104,9 @@ fn generate_lint_files(
|
|||
);
|
||||
|
||||
process_file(
|
||||
"clippy_lints/src/lib.register_lints.rs",
|
||||
"clippy_lints/src/declared_lints.rs",
|
||||
update_mode,
|
||||
&gen_register_lint_list(internal_lints.iter(), usable_lints.iter()),
|
||||
&gen_declared_lints(internal_lints.iter(), usable_lints.iter()),
|
||||
);
|
||||
process_file(
|
||||
"clippy_lints/src/lib.deprecated.rs",
|
||||
|
@ -114,26 +114,6 @@ fn generate_lint_files(
|
|||
&gen_deprecated(deprecated_lints),
|
||||
);
|
||||
|
||||
let all_group_lints = usable_lints.iter().filter(|l| {
|
||||
matches!(
|
||||
&*l.group,
|
||||
"correctness" | "suspicious" | "style" | "complexity" | "perf"
|
||||
)
|
||||
});
|
||||
let content = gen_lint_group_list("all", all_group_lints);
|
||||
process_file("clippy_lints/src/lib.register_all.rs", update_mode, &content);
|
||||
|
||||
update_docs(update_mode, &usable_lints);
|
||||
|
||||
for (lint_group, lints) in Lint::by_lint_group(usable_lints.into_iter().chain(internal_lints)) {
|
||||
let content = gen_lint_group_list(&lint_group, lints.iter());
|
||||
process_file(
|
||||
format!("clippy_lints/src/lib.register_{lint_group}.rs"),
|
||||
update_mode,
|
||||
&content,
|
||||
);
|
||||
}
|
||||
|
||||
let content = gen_deprecated_lints_test(deprecated_lints);
|
||||
process_file("tests/ui/deprecated.rs", update_mode, &content);
|
||||
|
||||
|
@ -141,62 +121,6 @@ fn generate_lint_files(
|
|||
process_file("tests/ui/rename.rs", update_mode, &content);
|
||||
}
|
||||
|
||||
fn update_docs(update_mode: UpdateMode, usable_lints: &[Lint]) {
|
||||
replace_region_in_file(update_mode, Path::new("src/docs.rs"), "docs! {\n", "\n}\n", |res| {
|
||||
for name in usable_lints.iter().map(|lint| lint.name.clone()).sorted() {
|
||||
writeln!(res, r#" "{name}","#).unwrap();
|
||||
}
|
||||
});
|
||||
|
||||
if update_mode == UpdateMode::Check {
|
||||
let mut extra = BTreeSet::new();
|
||||
let mut lint_names = usable_lints
|
||||
.iter()
|
||||
.map(|lint| lint.name.clone())
|
||||
.collect::<BTreeSet<_>>();
|
||||
for file in std::fs::read_dir("src/docs").unwrap() {
|
||||
let filename = file.unwrap().file_name().into_string().unwrap();
|
||||
if let Some(name) = filename.strip_suffix(".txt") {
|
||||
if !lint_names.remove(name) {
|
||||
extra.insert(name.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let failed = print_lint_names("extra lint docs:", &extra) | print_lint_names("missing lint docs:", &lint_names);
|
||||
|
||||
if failed {
|
||||
exit_with_failure();
|
||||
}
|
||||
} else {
|
||||
if std::fs::remove_dir_all("src/docs").is_err() {
|
||||
eprintln!("could not remove src/docs directory");
|
||||
}
|
||||
if std::fs::create_dir("src/docs").is_err() {
|
||||
eprintln!("could not recreate src/docs directory");
|
||||
}
|
||||
}
|
||||
for lint in usable_lints {
|
||||
process_file(
|
||||
Path::new("src/docs").join(lint.name.clone() + ".txt"),
|
||||
update_mode,
|
||||
&lint.documentation,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn print_lint_names(header: &str, lints: &BTreeSet<String>) -> bool {
|
||||
if lints.is_empty() {
|
||||
return false;
|
||||
}
|
||||
println!("{header}");
|
||||
for lint in lints.iter().sorted() {
|
||||
println!(" {lint}");
|
||||
}
|
||||
println!();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn print_lints() {
|
||||
let (lint_list, _, _) = gather_all();
|
||||
let usable_lints = Lint::usable_lints(&lint_list);
|
||||
|
@ -641,26 +565,17 @@ struct Lint {
|
|||
desc: String,
|
||||
module: String,
|
||||
declaration_range: Range<usize>,
|
||||
documentation: String,
|
||||
}
|
||||
|
||||
impl Lint {
|
||||
#[must_use]
|
||||
fn new(
|
||||
name: &str,
|
||||
group: &str,
|
||||
desc: &str,
|
||||
module: &str,
|
||||
declaration_range: Range<usize>,
|
||||
documentation: String,
|
||||
) -> Self {
|
||||
fn new(name: &str, group: &str, desc: &str, module: &str, declaration_range: Range<usize>) -> Self {
|
||||
Self {
|
||||
name: name.to_lowercase(),
|
||||
group: group.into(),
|
||||
desc: remove_line_splices(desc),
|
||||
module: module.into(),
|
||||
declaration_range,
|
||||
documentation,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -716,25 +631,6 @@ impl RenamedLint {
|
|||
}
|
||||
}
|
||||
|
||||
/// Generates the code for registering a group
|
||||
fn gen_lint_group_list<'a>(group_name: &str, lints: impl Iterator<Item = &'a Lint>) -> String {
|
||||
let mut details: Vec<_> = lints.map(|l| (&l.module, l.name.to_uppercase())).collect();
|
||||
details.sort_unstable();
|
||||
|
||||
let mut output = GENERATED_FILE_COMMENT.to_string();
|
||||
|
||||
let _ = writeln!(
|
||||
output,
|
||||
"store.register_group(true, \"clippy::{group_name}\", Some(\"clippy_{group_name}\"), vec![",
|
||||
);
|
||||
for (module, name) in details {
|
||||
let _ = writeln!(output, " LintId::of({module}::{name}),");
|
||||
}
|
||||
output.push_str("])\n");
|
||||
|
||||
output
|
||||
}
|
||||
|
||||
/// Generates the `register_removed` code
|
||||
#[must_use]
|
||||
fn gen_deprecated(lints: &[DeprecatedLint]) -> String {
|
||||
|
@ -759,7 +655,7 @@ fn gen_deprecated(lints: &[DeprecatedLint]) -> String {
|
|||
|
||||
/// Generates the code for registering lints
|
||||
#[must_use]
|
||||
fn gen_register_lint_list<'a>(
|
||||
fn gen_declared_lints<'a>(
|
||||
internal_lints: impl Iterator<Item = &'a Lint>,
|
||||
usable_lints: impl Iterator<Item = &'a Lint>,
|
||||
) -> String {
|
||||
|
@ -770,15 +666,15 @@ fn gen_register_lint_list<'a>(
|
|||
details.sort_unstable();
|
||||
|
||||
let mut output = GENERATED_FILE_COMMENT.to_string();
|
||||
output.push_str("store.register_lints(&[\n");
|
||||
output.push_str("pub(crate) static LINTS: &[&crate::LintInfo] = &[\n");
|
||||
|
||||
for (is_public, module_name, lint_name) in details {
|
||||
if !is_public {
|
||||
output.push_str(" #[cfg(feature = \"internal\")]\n");
|
||||
}
|
||||
let _ = writeln!(output, " {module_name}::{lint_name},");
|
||||
let _ = writeln!(output, " crate::{module_name}::{lint_name}_INFO,");
|
||||
}
|
||||
output.push_str("])\n");
|
||||
output.push_str("];\n");
|
||||
|
||||
output
|
||||
}
|
||||
|
@ -910,35 +806,26 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
|
|||
}| token_kind == &TokenKind::Ident && *content == "declare_clippy_lint",
|
||||
) {
|
||||
let start = range.start;
|
||||
let mut docs = String::with_capacity(128);
|
||||
let mut iter = iter.by_ref().filter(|t| !matches!(t.token_kind, TokenKind::Whitespace));
|
||||
let mut iter = iter
|
||||
.by_ref()
|
||||
.filter(|t| !matches!(t.token_kind, TokenKind::Whitespace | TokenKind::LineComment { .. }));
|
||||
// matches `!{`
|
||||
match_tokens!(iter, Bang OpenBrace);
|
||||
let mut in_code = false;
|
||||
while let Some(t) = iter.next() {
|
||||
match t.token_kind {
|
||||
TokenKind::LineComment { .. } => {
|
||||
if let Some(line) = t.content.strip_prefix("/// ").or_else(|| t.content.strip_prefix("///")) {
|
||||
if line.starts_with("```") {
|
||||
docs += "```\n";
|
||||
in_code = !in_code;
|
||||
} else if !(in_code && line.starts_with("# ")) {
|
||||
docs += line;
|
||||
docs.push('\n');
|
||||
}
|
||||
}
|
||||
},
|
||||
TokenKind::Pound => {
|
||||
match_tokens!(iter, OpenBracket Ident Colon Colon Ident Eq Literal{..} CloseBracket Ident);
|
||||
break;
|
||||
},
|
||||
TokenKind::Ident => {
|
||||
break;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
match iter.next() {
|
||||
// #[clippy::version = "version"] pub
|
||||
Some(LintDeclSearchResult {
|
||||
token_kind: TokenKind::Pound,
|
||||
..
|
||||
}) => {
|
||||
match_tokens!(iter, OpenBracket Ident Colon Colon Ident Eq Literal{..} CloseBracket Ident);
|
||||
},
|
||||
// pub
|
||||
Some(LintDeclSearchResult {
|
||||
token_kind: TokenKind::Ident,
|
||||
..
|
||||
}) => (),
|
||||
_ => continue,
|
||||
}
|
||||
docs.pop(); // remove final newline
|
||||
|
||||
let (name, group, desc) = match_tokens!(
|
||||
iter,
|
||||
|
@ -956,7 +843,7 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
|
|||
..
|
||||
}) = iter.next()
|
||||
{
|
||||
lints.push(Lint::new(name, group, desc, module, start..range.end, docs));
|
||||
lints.push(Lint::new(name, group, desc, module, start..range.end));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1186,7 +1073,6 @@ mod tests {
|
|||
"\"really long text\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new(
|
||||
"doc_markdown",
|
||||
|
@ -1194,7 +1080,6 @@ mod tests {
|
|||
"\"single line\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
];
|
||||
assert_eq!(expected, result);
|
||||
|
@ -1234,7 +1119,6 @@ mod tests {
|
|||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new(
|
||||
"should_assert_eq2",
|
||||
|
@ -1242,7 +1126,6 @@ mod tests {
|
|||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new(
|
||||
"should_assert_eq2",
|
||||
|
@ -1250,7 +1133,6 @@ mod tests {
|
|||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
];
|
||||
let expected = vec![Lint::new(
|
||||
|
@ -1259,7 +1141,6 @@ mod tests {
|
|||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
)];
|
||||
assert_eq!(expected, Lint::usable_lints(&lints));
|
||||
}
|
||||
|
@ -1267,51 +1148,22 @@ mod tests {
|
|||
#[test]
|
||||
fn test_by_lint_group() {
|
||||
let lints = vec![
|
||||
Lint::new(
|
||||
"should_assert_eq",
|
||||
"group1",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new("should_assert_eq", "group1", "\"abc\"", "module_name", Range::default()),
|
||||
Lint::new(
|
||||
"should_assert_eq2",
|
||||
"group2",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new(
|
||||
"incorrect_match",
|
||||
"group1",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new("incorrect_match", "group1", "\"abc\"", "module_name", Range::default()),
|
||||
];
|
||||
let mut expected: HashMap<String, Vec<Lint>> = HashMap::new();
|
||||
expected.insert(
|
||||
"group1".to_string(),
|
||||
vec![
|
||||
Lint::new(
|
||||
"should_assert_eq",
|
||||
"group1",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new(
|
||||
"incorrect_match",
|
||||
"group1",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new("should_assert_eq", "group1", "\"abc\"", "module_name", Range::default()),
|
||||
Lint::new("incorrect_match", "group1", "\"abc\"", "module_name", Range::default()),
|
||||
],
|
||||
);
|
||||
expected.insert(
|
||||
|
@ -1322,7 +1174,6 @@ mod tests {
|
|||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
)],
|
||||
);
|
||||
assert_eq!(expected, Lint::by_lint_group(lints.into_iter()));
|
||||
|
@ -1357,48 +1208,4 @@ mod tests {
|
|||
|
||||
assert_eq!(expected, gen_deprecated(&lints));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gen_lint_group_list() {
|
||||
let lints = vec![
|
||||
Lint::new(
|
||||
"abc",
|
||||
"group1",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new(
|
||||
"should_assert_eq",
|
||||
"group1",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
Lint::new(
|
||||
"internal",
|
||||
"internal_style",
|
||||
"\"abc\"",
|
||||
"module_name",
|
||||
Range::default(),
|
||||
String::new(),
|
||||
),
|
||||
];
|
||||
let expected = GENERATED_FILE_COMMENT.to_string()
|
||||
+ &[
|
||||
"store.register_group(true, \"clippy::group1\", Some(\"clippy_group1\"), vec![",
|
||||
" LintId::of(module_name::ABC),",
|
||||
" LintId::of(module_name::INTERNAL),",
|
||||
" LintId::of(module_name::SHOULD_ASSERT_EQ),",
|
||||
"])",
|
||||
]
|
||||
.join("\n")
|
||||
+ "\n";
|
||||
|
||||
let result = gen_lint_group_list("group1", lints.iter());
|
||||
|
||||
assert_eq!(expected, result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
cargo_metadata = "0.14"
|
||||
clippy_utils = { path = "../clippy_utils" }
|
||||
declare_clippy_lint = { path = "../declare_clippy_lint" }
|
||||
if_chain = "1.0"
|
||||
itertools = "0.10.1"
|
||||
pulldown-cmark = { version = "0.9", default-features = false }
|
||||
|
|
|
@ -0,0 +1,620 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
pub(crate) static LINTS: &[&crate::LintInfo] = &[
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::clippy_lints_internal::CLIPPY_LINTS_INTERNAL_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::collapsible_calls::COLLAPSIBLE_SPAN_LINT_CALLS_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::compiler_lint_functions::COMPILER_LINT_FUNCTIONS_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::if_chain_style::IF_CHAIN_STYLE_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::interning_defined_symbol::INTERNING_DEFINED_SYMBOL_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::interning_defined_symbol::UNNECESSARY_SYMBOL_STR_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::invalid_paths::INVALID_PATHS_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::lint_without_lint_pass::DEFAULT_DEPRECATION_REASON_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::lint_without_lint_pass::DEFAULT_LINT_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::lint_without_lint_pass::INVALID_CLIPPY_VERSION_ATTRIBUTE_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::lint_without_lint_pass::LINT_WITHOUT_LINT_PASS_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::lint_without_lint_pass::MISSING_CLIPPY_VERSION_ATTRIBUTE_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::msrv_attr_impl::MISSING_MSRV_ATTR_IMPL_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::outer_expn_data_pass::OUTER_EXPN_EXPN_DATA_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::produce_ice::PRODUCE_ICE_INFO,
|
||||
#[cfg(feature = "internal")]
|
||||
crate::utils::internal_lints::unnecessary_def_path::UNNECESSARY_DEF_PATH_INFO,
|
||||
crate::almost_complete_letter_range::ALMOST_COMPLETE_LETTER_RANGE_INFO,
|
||||
crate::approx_const::APPROX_CONSTANT_INFO,
|
||||
crate::as_conversions::AS_CONVERSIONS_INFO,
|
||||
crate::asm_syntax::INLINE_ASM_X86_ATT_SYNTAX_INFO,
|
||||
crate::asm_syntax::INLINE_ASM_X86_INTEL_SYNTAX_INFO,
|
||||
crate::assertions_on_constants::ASSERTIONS_ON_CONSTANTS_INFO,
|
||||
crate::assertions_on_result_states::ASSERTIONS_ON_RESULT_STATES_INFO,
|
||||
crate::async_yields_async::ASYNC_YIELDS_ASYNC_INFO,
|
||||
crate::attrs::ALLOW_ATTRIBUTES_WITHOUT_REASON_INFO,
|
||||
crate::attrs::BLANKET_CLIPPY_RESTRICTION_LINTS_INFO,
|
||||
crate::attrs::DEPRECATED_CFG_ATTR_INFO,
|
||||
crate::attrs::DEPRECATED_SEMVER_INFO,
|
||||
crate::attrs::EMPTY_LINE_AFTER_OUTER_ATTR_INFO,
|
||||
crate::attrs::INLINE_ALWAYS_INFO,
|
||||
crate::attrs::MISMATCHED_TARGET_OS_INFO,
|
||||
crate::attrs::USELESS_ATTRIBUTE_INFO,
|
||||
crate::await_holding_invalid::AWAIT_HOLDING_INVALID_TYPE_INFO,
|
||||
crate::await_holding_invalid::AWAIT_HOLDING_LOCK_INFO,
|
||||
crate::await_holding_invalid::AWAIT_HOLDING_REFCELL_REF_INFO,
|
||||
crate::blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS_INFO,
|
||||
crate::bool_assert_comparison::BOOL_ASSERT_COMPARISON_INFO,
|
||||
crate::bool_to_int_with_if::BOOL_TO_INT_WITH_IF_INFO,
|
||||
crate::booleans::NONMINIMAL_BOOL_INFO,
|
||||
crate::booleans::OVERLY_COMPLEX_BOOL_EXPR_INFO,
|
||||
crate::borrow_deref_ref::BORROW_DEREF_REF_INFO,
|
||||
crate::box_default::BOX_DEFAULT_INFO,
|
||||
crate::cargo::CARGO_COMMON_METADATA_INFO,
|
||||
crate::cargo::MULTIPLE_CRATE_VERSIONS_INFO,
|
||||
crate::cargo::NEGATIVE_FEATURE_NAMES_INFO,
|
||||
crate::cargo::REDUNDANT_FEATURE_NAMES_INFO,
|
||||
crate::cargo::WILDCARD_DEPENDENCIES_INFO,
|
||||
crate::casts::AS_PTR_CAST_MUT_INFO,
|
||||
crate::casts::AS_UNDERSCORE_INFO,
|
||||
crate::casts::BORROW_AS_PTR_INFO,
|
||||
crate::casts::CAST_ABS_TO_UNSIGNED_INFO,
|
||||
crate::casts::CAST_ENUM_CONSTRUCTOR_INFO,
|
||||
crate::casts::CAST_ENUM_TRUNCATION_INFO,
|
||||
crate::casts::CAST_LOSSLESS_INFO,
|
||||
crate::casts::CAST_NAN_TO_INT_INFO,
|
||||
crate::casts::CAST_POSSIBLE_TRUNCATION_INFO,
|
||||
crate::casts::CAST_POSSIBLE_WRAP_INFO,
|
||||
crate::casts::CAST_PRECISION_LOSS_INFO,
|
||||
crate::casts::CAST_PTR_ALIGNMENT_INFO,
|
||||
crate::casts::CAST_REF_TO_MUT_INFO,
|
||||
crate::casts::CAST_SIGN_LOSS_INFO,
|
||||
crate::casts::CAST_SLICE_DIFFERENT_SIZES_INFO,
|
||||
crate::casts::CAST_SLICE_FROM_RAW_PARTS_INFO,
|
||||
crate::casts::CHAR_LIT_AS_U8_INFO,
|
||||
crate::casts::FN_TO_NUMERIC_CAST_INFO,
|
||||
crate::casts::FN_TO_NUMERIC_CAST_ANY_INFO,
|
||||
crate::casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION_INFO,
|
||||
crate::casts::PTR_AS_PTR_INFO,
|
||||
crate::casts::UNNECESSARY_CAST_INFO,
|
||||
crate::checked_conversions::CHECKED_CONVERSIONS_INFO,
|
||||
crate::cognitive_complexity::COGNITIVE_COMPLEXITY_INFO,
|
||||
crate::collapsible_if::COLLAPSIBLE_ELSE_IF_INFO,
|
||||
crate::collapsible_if::COLLAPSIBLE_IF_INFO,
|
||||
crate::comparison_chain::COMPARISON_CHAIN_INFO,
|
||||
crate::copies::BRANCHES_SHARING_CODE_INFO,
|
||||
crate::copies::IFS_SAME_COND_INFO,
|
||||
crate::copies::IF_SAME_THEN_ELSE_INFO,
|
||||
crate::copies::SAME_FUNCTIONS_IN_IF_CONDITION_INFO,
|
||||
crate::copy_iterator::COPY_ITERATOR_INFO,
|
||||
crate::crate_in_macro_def::CRATE_IN_MACRO_DEF_INFO,
|
||||
crate::create_dir::CREATE_DIR_INFO,
|
||||
crate::dbg_macro::DBG_MACRO_INFO,
|
||||
crate::default::DEFAULT_TRAIT_ACCESS_INFO,
|
||||
crate::default::FIELD_REASSIGN_WITH_DEFAULT_INFO,
|
||||
crate::default_instead_of_iter_empty::DEFAULT_INSTEAD_OF_ITER_EMPTY_INFO,
|
||||
crate::default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK_INFO,
|
||||
crate::default_union_representation::DEFAULT_UNION_REPRESENTATION_INFO,
|
||||
crate::dereference::EXPLICIT_AUTO_DEREF_INFO,
|
||||
crate::dereference::EXPLICIT_DEREF_METHODS_INFO,
|
||||
crate::dereference::NEEDLESS_BORROW_INFO,
|
||||
crate::dereference::REF_BINDING_TO_REFERENCE_INFO,
|
||||
crate::derivable_impls::DERIVABLE_IMPLS_INFO,
|
||||
crate::derive::DERIVE_HASH_XOR_EQ_INFO,
|
||||
crate::derive::DERIVE_ORD_XOR_PARTIAL_ORD_INFO,
|
||||
crate::derive::DERIVE_PARTIAL_EQ_WITHOUT_EQ_INFO,
|
||||
crate::derive::EXPL_IMPL_CLONE_ON_COPY_INFO,
|
||||
crate::derive::UNSAFE_DERIVE_DESERIALIZE_INFO,
|
||||
crate::disallowed_macros::DISALLOWED_MACROS_INFO,
|
||||
crate::disallowed_methods::DISALLOWED_METHODS_INFO,
|
||||
crate::disallowed_names::DISALLOWED_NAMES_INFO,
|
||||
crate::disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS_INFO,
|
||||
crate::disallowed_types::DISALLOWED_TYPES_INFO,
|
||||
crate::doc::DOC_LINK_WITH_QUOTES_INFO,
|
||||
crate::doc::DOC_MARKDOWN_INFO,
|
||||
crate::doc::MISSING_ERRORS_DOC_INFO,
|
||||
crate::doc::MISSING_PANICS_DOC_INFO,
|
||||
crate::doc::MISSING_SAFETY_DOC_INFO,
|
||||
crate::doc::NEEDLESS_DOCTEST_MAIN_INFO,
|
||||
crate::double_parens::DOUBLE_PARENS_INFO,
|
||||
crate::drop_forget_ref::DROP_COPY_INFO,
|
||||
crate::drop_forget_ref::DROP_NON_DROP_INFO,
|
||||
crate::drop_forget_ref::DROP_REF_INFO,
|
||||
crate::drop_forget_ref::FORGET_COPY_INFO,
|
||||
crate::drop_forget_ref::FORGET_NON_DROP_INFO,
|
||||
crate::drop_forget_ref::FORGET_REF_INFO,
|
||||
crate::drop_forget_ref::UNDROPPED_MANUALLY_DROPS_INFO,
|
||||
crate::duplicate_mod::DUPLICATE_MOD_INFO,
|
||||
crate::else_if_without_else::ELSE_IF_WITHOUT_ELSE_INFO,
|
||||
crate::empty_drop::EMPTY_DROP_INFO,
|
||||
crate::empty_enum::EMPTY_ENUM_INFO,
|
||||
crate::empty_structs_with_brackets::EMPTY_STRUCTS_WITH_BRACKETS_INFO,
|
||||
crate::entry::MAP_ENTRY_INFO,
|
||||
crate::enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT_INFO,
|
||||
crate::enum_variants::ENUM_VARIANT_NAMES_INFO,
|
||||
crate::enum_variants::MODULE_INCEPTION_INFO,
|
||||
crate::enum_variants::MODULE_NAME_REPETITIONS_INFO,
|
||||
crate::equatable_if_let::EQUATABLE_IF_LET_INFO,
|
||||
crate::escape::BOXED_LOCAL_INFO,
|
||||
crate::eta_reduction::REDUNDANT_CLOSURE_INFO,
|
||||
crate::eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS_INFO,
|
||||
crate::excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS_INFO,
|
||||
crate::excessive_bools::STRUCT_EXCESSIVE_BOOLS_INFO,
|
||||
crate::exhaustive_items::EXHAUSTIVE_ENUMS_INFO,
|
||||
crate::exhaustive_items::EXHAUSTIVE_STRUCTS_INFO,
|
||||
crate::exit::EXIT_INFO,
|
||||
crate::explicit_write::EXPLICIT_WRITE_INFO,
|
||||
crate::fallible_impl_from::FALLIBLE_IMPL_FROM_INFO,
|
||||
crate::float_literal::EXCESSIVE_PRECISION_INFO,
|
||||
crate::float_literal::LOSSY_FLOAT_LITERAL_INFO,
|
||||
crate::floating_point_arithmetic::IMPRECISE_FLOPS_INFO,
|
||||
crate::floating_point_arithmetic::SUBOPTIMAL_FLOPS_INFO,
|
||||
crate::format::USELESS_FORMAT_INFO,
|
||||
crate::format_args::FORMAT_IN_FORMAT_ARGS_INFO,
|
||||
crate::format_args::TO_STRING_IN_FORMAT_ARGS_INFO,
|
||||
crate::format_args::UNINLINED_FORMAT_ARGS_INFO,
|
||||
crate::format_args::UNUSED_FORMAT_SPECS_INFO,
|
||||
crate::format_impl::PRINT_IN_FORMAT_IMPL_INFO,
|
||||
crate::format_impl::RECURSIVE_FORMAT_IMPL_INFO,
|
||||
crate::format_push_string::FORMAT_PUSH_STRING_INFO,
|
||||
crate::formatting::POSSIBLE_MISSING_COMMA_INFO,
|
||||
crate::formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING_INFO,
|
||||
crate::formatting::SUSPICIOUS_ELSE_FORMATTING_INFO,
|
||||
crate::formatting::SUSPICIOUS_UNARY_OP_FORMATTING_INFO,
|
||||
crate::from_over_into::FROM_OVER_INTO_INFO,
|
||||
crate::from_raw_with_void_ptr::FROM_RAW_WITH_VOID_PTR_INFO,
|
||||
crate::from_str_radix_10::FROM_STR_RADIX_10_INFO,
|
||||
crate::functions::DOUBLE_MUST_USE_INFO,
|
||||
crate::functions::MUST_USE_CANDIDATE_INFO,
|
||||
crate::functions::MUST_USE_UNIT_INFO,
|
||||
crate::functions::NOT_UNSAFE_PTR_ARG_DEREF_INFO,
|
||||
crate::functions::RESULT_LARGE_ERR_INFO,
|
||||
crate::functions::RESULT_UNIT_ERR_INFO,
|
||||
crate::functions::TOO_MANY_ARGUMENTS_INFO,
|
||||
crate::functions::TOO_MANY_LINES_INFO,
|
||||
crate::future_not_send::FUTURE_NOT_SEND_INFO,
|
||||
crate::if_let_mutex::IF_LET_MUTEX_INFO,
|
||||
crate::if_not_else::IF_NOT_ELSE_INFO,
|
||||
crate::if_then_some_else_none::IF_THEN_SOME_ELSE_NONE_INFO,
|
||||
crate::implicit_hasher::IMPLICIT_HASHER_INFO,
|
||||
crate::implicit_return::IMPLICIT_RETURN_INFO,
|
||||
crate::implicit_saturating_add::IMPLICIT_SATURATING_ADD_INFO,
|
||||
crate::implicit_saturating_sub::IMPLICIT_SATURATING_SUB_INFO,
|
||||
crate::inconsistent_struct_constructor::INCONSISTENT_STRUCT_CONSTRUCTOR_INFO,
|
||||
crate::index_refutable_slice::INDEX_REFUTABLE_SLICE_INFO,
|
||||
crate::indexing_slicing::INDEXING_SLICING_INFO,
|
||||
crate::indexing_slicing::OUT_OF_BOUNDS_INDEXING_INFO,
|
||||
crate::infinite_iter::INFINITE_ITER_INFO,
|
||||
crate::infinite_iter::MAYBE_INFINITE_ITER_INFO,
|
||||
crate::inherent_impl::MULTIPLE_INHERENT_IMPL_INFO,
|
||||
crate::inherent_to_string::INHERENT_TO_STRING_INFO,
|
||||
crate::inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY_INFO,
|
||||
crate::init_numbered_fields::INIT_NUMBERED_FIELDS_INFO,
|
||||
crate::inline_fn_without_body::INLINE_FN_WITHOUT_BODY_INFO,
|
||||
crate::int_plus_one::INT_PLUS_ONE_INFO,
|
||||
crate::invalid_upcast_comparisons::INVALID_UPCAST_COMPARISONS_INFO,
|
||||
crate::invalid_utf8_in_unchecked::INVALID_UTF8_IN_UNCHECKED_INFO,
|
||||
crate::items_after_statements::ITEMS_AFTER_STATEMENTS_INFO,
|
||||
crate::iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR_INFO,
|
||||
crate::large_const_arrays::LARGE_CONST_ARRAYS_INFO,
|
||||
crate::large_enum_variant::LARGE_ENUM_VARIANT_INFO,
|
||||
crate::large_include_file::LARGE_INCLUDE_FILE_INFO,
|
||||
crate::large_stack_arrays::LARGE_STACK_ARRAYS_INFO,
|
||||
crate::len_zero::COMPARISON_TO_EMPTY_INFO,
|
||||
crate::len_zero::LEN_WITHOUT_IS_EMPTY_INFO,
|
||||
crate::len_zero::LEN_ZERO_INFO,
|
||||
crate::let_if_seq::USELESS_LET_IF_SEQ_INFO,
|
||||
crate::let_underscore::LET_UNDERSCORE_LOCK_INFO,
|
||||
crate::let_underscore::LET_UNDERSCORE_MUST_USE_INFO,
|
||||
crate::lifetimes::EXTRA_UNUSED_LIFETIMES_INFO,
|
||||
crate::lifetimes::NEEDLESS_LIFETIMES_INFO,
|
||||
crate::literal_representation::DECIMAL_LITERAL_REPRESENTATION_INFO,
|
||||
crate::literal_representation::INCONSISTENT_DIGIT_GROUPING_INFO,
|
||||
crate::literal_representation::LARGE_DIGIT_GROUPS_INFO,
|
||||
crate::literal_representation::MISTYPED_LITERAL_SUFFIXES_INFO,
|
||||
crate::literal_representation::UNREADABLE_LITERAL_INFO,
|
||||
crate::literal_representation::UNUSUAL_BYTE_GROUPINGS_INFO,
|
||||
crate::loops::EMPTY_LOOP_INFO,
|
||||
crate::loops::EXPLICIT_COUNTER_LOOP_INFO,
|
||||
crate::loops::EXPLICIT_INTO_ITER_LOOP_INFO,
|
||||
crate::loops::EXPLICIT_ITER_LOOP_INFO,
|
||||
crate::loops::FOR_KV_MAP_INFO,
|
||||
crate::loops::ITER_NEXT_LOOP_INFO,
|
||||
crate::loops::MANUAL_FIND_INFO,
|
||||
crate::loops::MANUAL_FLATTEN_INFO,
|
||||
crate::loops::MANUAL_MEMCPY_INFO,
|
||||
crate::loops::MISSING_SPIN_LOOP_INFO,
|
||||
crate::loops::MUT_RANGE_BOUND_INFO,
|
||||
crate::loops::NEEDLESS_COLLECT_INFO,
|
||||
crate::loops::NEEDLESS_RANGE_LOOP_INFO,
|
||||
crate::loops::NEVER_LOOP_INFO,
|
||||
crate::loops::SAME_ITEM_PUSH_INFO,
|
||||
crate::loops::SINGLE_ELEMENT_LOOP_INFO,
|
||||
crate::loops::WHILE_IMMUTABLE_CONDITION_INFO,
|
||||
crate::loops::WHILE_LET_LOOP_INFO,
|
||||
crate::loops::WHILE_LET_ON_ITERATOR_INFO,
|
||||
crate::macro_use::MACRO_USE_IMPORTS_INFO,
|
||||
crate::main_recursion::MAIN_RECURSION_INFO,
|
||||
crate::manual_assert::MANUAL_ASSERT_INFO,
|
||||
crate::manual_async_fn::MANUAL_ASYNC_FN_INFO,
|
||||
crate::manual_bits::MANUAL_BITS_INFO,
|
||||
crate::manual_clamp::MANUAL_CLAMP_INFO,
|
||||
crate::manual_instant_elapsed::MANUAL_INSTANT_ELAPSED_INFO,
|
||||
crate::manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE_INFO,
|
||||
crate::manual_rem_euclid::MANUAL_REM_EUCLID_INFO,
|
||||
crate::manual_retain::MANUAL_RETAIN_INFO,
|
||||
crate::manual_string_new::MANUAL_STRING_NEW_INFO,
|
||||
crate::manual_strip::MANUAL_STRIP_INFO,
|
||||
crate::map_unit_fn::OPTION_MAP_UNIT_FN_INFO,
|
||||
crate::map_unit_fn::RESULT_MAP_UNIT_FN_INFO,
|
||||
crate::match_result_ok::MATCH_RESULT_OK_INFO,
|
||||
crate::matches::COLLAPSIBLE_MATCH_INFO,
|
||||
crate::matches::INFALLIBLE_DESTRUCTURING_MATCH_INFO,
|
||||
crate::matches::MANUAL_FILTER_INFO,
|
||||
crate::matches::MANUAL_MAP_INFO,
|
||||
crate::matches::MANUAL_UNWRAP_OR_INFO,
|
||||
crate::matches::MATCH_AS_REF_INFO,
|
||||
crate::matches::MATCH_BOOL_INFO,
|
||||
crate::matches::MATCH_LIKE_MATCHES_MACRO_INFO,
|
||||
crate::matches::MATCH_ON_VEC_ITEMS_INFO,
|
||||
crate::matches::MATCH_OVERLAPPING_ARM_INFO,
|
||||
crate::matches::MATCH_REF_PATS_INFO,
|
||||
crate::matches::MATCH_SAME_ARMS_INFO,
|
||||
crate::matches::MATCH_SINGLE_BINDING_INFO,
|
||||
crate::matches::MATCH_STR_CASE_MISMATCH_INFO,
|
||||
crate::matches::MATCH_WILDCARD_FOR_SINGLE_VARIANTS_INFO,
|
||||
crate::matches::MATCH_WILD_ERR_ARM_INFO,
|
||||
crate::matches::NEEDLESS_MATCH_INFO,
|
||||
crate::matches::REDUNDANT_PATTERN_MATCHING_INFO,
|
||||
crate::matches::REST_PAT_IN_FULLY_BOUND_STRUCTS_INFO,
|
||||
crate::matches::SIGNIFICANT_DROP_IN_SCRUTINEE_INFO,
|
||||
crate::matches::SINGLE_MATCH_INFO,
|
||||
crate::matches::SINGLE_MATCH_ELSE_INFO,
|
||||
crate::matches::TRY_ERR_INFO,
|
||||
crate::matches::WILDCARD_ENUM_MATCH_ARM_INFO,
|
||||
crate::matches::WILDCARD_IN_OR_PATTERNS_INFO,
|
||||
crate::mem_forget::MEM_FORGET_INFO,
|
||||
crate::mem_replace::MEM_REPLACE_OPTION_WITH_NONE_INFO,
|
||||
crate::mem_replace::MEM_REPLACE_WITH_DEFAULT_INFO,
|
||||
crate::mem_replace::MEM_REPLACE_WITH_UNINIT_INFO,
|
||||
crate::methods::BIND_INSTEAD_OF_MAP_INFO,
|
||||
crate::methods::BYTES_COUNT_TO_LEN_INFO,
|
||||
crate::methods::BYTES_NTH_INFO,
|
||||
crate::methods::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS_INFO,
|
||||
crate::methods::CHARS_LAST_CMP_INFO,
|
||||
crate::methods::CHARS_NEXT_CMP_INFO,
|
||||
crate::methods::CLONED_INSTEAD_OF_COPIED_INFO,
|
||||
crate::methods::CLONE_DOUBLE_REF_INFO,
|
||||
crate::methods::CLONE_ON_COPY_INFO,
|
||||
crate::methods::CLONE_ON_REF_PTR_INFO,
|
||||
crate::methods::COLLAPSIBLE_STR_REPLACE_INFO,
|
||||
crate::methods::ERR_EXPECT_INFO,
|
||||
crate::methods::EXPECT_FUN_CALL_INFO,
|
||||
crate::methods::EXPECT_USED_INFO,
|
||||
crate::methods::EXTEND_WITH_DRAIN_INFO,
|
||||
crate::methods::FILETYPE_IS_FILE_INFO,
|
||||
crate::methods::FILTER_MAP_IDENTITY_INFO,
|
||||
crate::methods::FILTER_MAP_NEXT_INFO,
|
||||
crate::methods::FILTER_NEXT_INFO,
|
||||
crate::methods::FLAT_MAP_IDENTITY_INFO,
|
||||
crate::methods::FLAT_MAP_OPTION_INFO,
|
||||
crate::methods::FROM_ITER_INSTEAD_OF_COLLECT_INFO,
|
||||
crate::methods::GET_FIRST_INFO,
|
||||
crate::methods::GET_LAST_WITH_LEN_INFO,
|
||||
crate::methods::GET_UNWRAP_INFO,
|
||||
crate::methods::IMPLICIT_CLONE_INFO,
|
||||
crate::methods::INEFFICIENT_TO_STRING_INFO,
|
||||
crate::methods::INSPECT_FOR_EACH_INFO,
|
||||
crate::methods::INTO_ITER_ON_REF_INFO,
|
||||
crate::methods::IS_DIGIT_ASCII_RADIX_INFO,
|
||||
crate::methods::ITERATOR_STEP_BY_ZERO_INFO,
|
||||
crate::methods::ITER_CLONED_COLLECT_INFO,
|
||||
crate::methods::ITER_COUNT_INFO,
|
||||
crate::methods::ITER_KV_MAP_INFO,
|
||||
crate::methods::ITER_NEXT_SLICE_INFO,
|
||||
crate::methods::ITER_NTH_INFO,
|
||||
crate::methods::ITER_NTH_ZERO_INFO,
|
||||
crate::methods::ITER_ON_EMPTY_COLLECTIONS_INFO,
|
||||
crate::methods::ITER_ON_SINGLE_ITEMS_INFO,
|
||||
crate::methods::ITER_OVEREAGER_CLONED_INFO,
|
||||
crate::methods::ITER_SKIP_NEXT_INFO,
|
||||
crate::methods::ITER_WITH_DRAIN_INFO,
|
||||
crate::methods::MANUAL_FILTER_MAP_INFO,
|
||||
crate::methods::MANUAL_FIND_MAP_INFO,
|
||||
crate::methods::MANUAL_OK_OR_INFO,
|
||||
crate::methods::MANUAL_SATURATING_ARITHMETIC_INFO,
|
||||
crate::methods::MANUAL_SPLIT_ONCE_INFO,
|
||||
crate::methods::MANUAL_STR_REPEAT_INFO,
|
||||
crate::methods::MAP_CLONE_INFO,
|
||||
crate::methods::MAP_COLLECT_RESULT_UNIT_INFO,
|
||||
crate::methods::MAP_ERR_IGNORE_INFO,
|
||||
crate::methods::MAP_FLATTEN_INFO,
|
||||
crate::methods::MAP_IDENTITY_INFO,
|
||||
crate::methods::MAP_UNWRAP_OR_INFO,
|
||||
crate::methods::MUT_MUTEX_LOCK_INFO,
|
||||
crate::methods::NAIVE_BYTECOUNT_INFO,
|
||||
crate::methods::NEEDLESS_OPTION_AS_DEREF_INFO,
|
||||
crate::methods::NEEDLESS_OPTION_TAKE_INFO,
|
||||
crate::methods::NEEDLESS_SPLITN_INFO,
|
||||
crate::methods::NEW_RET_NO_SELF_INFO,
|
||||
crate::methods::NONSENSICAL_OPEN_OPTIONS_INFO,
|
||||
crate::methods::NO_EFFECT_REPLACE_INFO,
|
||||
crate::methods::OBFUSCATED_IF_ELSE_INFO,
|
||||
crate::methods::OK_EXPECT_INFO,
|
||||
crate::methods::OPTION_AS_REF_DEREF_INFO,
|
||||
crate::methods::OPTION_FILTER_MAP_INFO,
|
||||
crate::methods::OPTION_MAP_OR_NONE_INFO,
|
||||
crate::methods::OR_FUN_CALL_INFO,
|
||||
crate::methods::OR_THEN_UNWRAP_INFO,
|
||||
crate::methods::PATH_BUF_PUSH_OVERWRITE_INFO,
|
||||
crate::methods::RANGE_ZIP_WITH_LEN_INFO,
|
||||
crate::methods::REPEAT_ONCE_INFO,
|
||||
crate::methods::RESULT_MAP_OR_INTO_OPTION_INFO,
|
||||
crate::methods::SEARCH_IS_SOME_INFO,
|
||||
crate::methods::SHOULD_IMPLEMENT_TRAIT_INFO,
|
||||
crate::methods::SINGLE_CHAR_ADD_STR_INFO,
|
||||
crate::methods::SINGLE_CHAR_PATTERN_INFO,
|
||||
crate::methods::SKIP_WHILE_NEXT_INFO,
|
||||
crate::methods::STABLE_SORT_PRIMITIVE_INFO,
|
||||
crate::methods::STRING_EXTEND_CHARS_INFO,
|
||||
crate::methods::SUSPICIOUS_MAP_INFO,
|
||||
crate::methods::SUSPICIOUS_SPLITN_INFO,
|
||||
crate::methods::SUSPICIOUS_TO_OWNED_INFO,
|
||||
crate::methods::UNINIT_ASSUMED_INIT_INFO,
|
||||
crate::methods::UNIT_HASH_INFO,
|
||||
crate::methods::UNNECESSARY_FILTER_MAP_INFO,
|
||||
crate::methods::UNNECESSARY_FIND_MAP_INFO,
|
||||
crate::methods::UNNECESSARY_FOLD_INFO,
|
||||
crate::methods::UNNECESSARY_JOIN_INFO,
|
||||
crate::methods::UNNECESSARY_LAZY_EVALUATIONS_INFO,
|
||||
crate::methods::UNNECESSARY_SORT_BY_INFO,
|
||||
crate::methods::UNNECESSARY_TO_OWNED_INFO,
|
||||
crate::methods::UNWRAP_OR_ELSE_DEFAULT_INFO,
|
||||
crate::methods::UNWRAP_USED_INFO,
|
||||
crate::methods::USELESS_ASREF_INFO,
|
||||
crate::methods::VEC_RESIZE_TO_ZERO_INFO,
|
||||
crate::methods::VERBOSE_FILE_READS_INFO,
|
||||
crate::methods::WRONG_SELF_CONVENTION_INFO,
|
||||
crate::methods::ZST_OFFSET_INFO,
|
||||
crate::minmax::MIN_MAX_INFO,
|
||||
crate::misc::SHORT_CIRCUIT_STATEMENT_INFO,
|
||||
crate::misc::TOPLEVEL_REF_ARG_INFO,
|
||||
crate::misc::USED_UNDERSCORE_BINDING_INFO,
|
||||
crate::misc::ZERO_PTR_INFO,
|
||||
crate::misc_early::BUILTIN_TYPE_SHADOW_INFO,
|
||||
crate::misc_early::DOUBLE_NEG_INFO,
|
||||
crate::misc_early::DUPLICATE_UNDERSCORE_ARGUMENT_INFO,
|
||||
crate::misc_early::MIXED_CASE_HEX_LITERALS_INFO,
|
||||
crate::misc_early::REDUNDANT_PATTERN_INFO,
|
||||
crate::misc_early::SEPARATED_LITERAL_SUFFIX_INFO,
|
||||
crate::misc_early::UNNEEDED_FIELD_PATTERN_INFO,
|
||||
crate::misc_early::UNNEEDED_WILDCARD_PATTERN_INFO,
|
||||
crate::misc_early::UNSEPARATED_LITERAL_SUFFIX_INFO,
|
||||
crate::misc_early::ZERO_PREFIXED_LITERAL_INFO,
|
||||
crate::mismatching_type_param_order::MISMATCHING_TYPE_PARAM_ORDER_INFO,
|
||||
crate::missing_const_for_fn::MISSING_CONST_FOR_FN_INFO,
|
||||
crate::missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS_INFO,
|
||||
crate::missing_enforced_import_rename::MISSING_ENFORCED_IMPORT_RENAMES_INFO,
|
||||
crate::missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS_INFO,
|
||||
crate::missing_trait_methods::MISSING_TRAIT_METHODS_INFO,
|
||||
crate::mixed_read_write_in_expression::DIVERGING_SUB_EXPRESSION_INFO,
|
||||
crate::mixed_read_write_in_expression::MIXED_READ_WRITE_IN_EXPRESSION_INFO,
|
||||
crate::module_style::MOD_MODULE_FILES_INFO,
|
||||
crate::module_style::SELF_NAMED_MODULE_FILES_INFO,
|
||||
crate::multi_assignments::MULTI_ASSIGNMENTS_INFO,
|
||||
crate::mut_key::MUTABLE_KEY_TYPE_INFO,
|
||||
crate::mut_mut::MUT_MUT_INFO,
|
||||
crate::mut_reference::UNNECESSARY_MUT_PASSED_INFO,
|
||||
crate::mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL_INFO,
|
||||
crate::mutex_atomic::MUTEX_ATOMIC_INFO,
|
||||
crate::mutex_atomic::MUTEX_INTEGER_INFO,
|
||||
crate::needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE_INFO,
|
||||
crate::needless_bool::BOOL_COMPARISON_INFO,
|
||||
crate::needless_bool::NEEDLESS_BOOL_INFO,
|
||||
crate::needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE_INFO,
|
||||
crate::needless_continue::NEEDLESS_CONTINUE_INFO,
|
||||
crate::needless_for_each::NEEDLESS_FOR_EACH_INFO,
|
||||
crate::needless_late_init::NEEDLESS_LATE_INIT_INFO,
|
||||
crate::needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS_INFO,
|
||||
crate::needless_pass_by_value::NEEDLESS_PASS_BY_VALUE_INFO,
|
||||
crate::needless_question_mark::NEEDLESS_QUESTION_MARK_INFO,
|
||||
crate::needless_update::NEEDLESS_UPDATE_INFO,
|
||||
crate::neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD_INFO,
|
||||
crate::neg_multiply::NEG_MULTIPLY_INFO,
|
||||
crate::new_without_default::NEW_WITHOUT_DEFAULT_INFO,
|
||||
crate::no_effect::NO_EFFECT_INFO,
|
||||
crate::no_effect::NO_EFFECT_UNDERSCORE_BINDING_INFO,
|
||||
crate::no_effect::UNNECESSARY_OPERATION_INFO,
|
||||
crate::non_copy_const::BORROW_INTERIOR_MUTABLE_CONST_INFO,
|
||||
crate::non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST_INFO,
|
||||
crate::non_expressive_names::JUST_UNDERSCORES_AND_DIGITS_INFO,
|
||||
crate::non_expressive_names::MANY_SINGLE_CHAR_NAMES_INFO,
|
||||
crate::non_expressive_names::SIMILAR_NAMES_INFO,
|
||||
crate::non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS_INFO,
|
||||
crate::non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY_INFO,
|
||||
crate::nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES_INFO,
|
||||
crate::octal_escapes::OCTAL_ESCAPES_INFO,
|
||||
crate::only_used_in_recursion::ONLY_USED_IN_RECURSION_INFO,
|
||||
crate::operators::ABSURD_EXTREME_COMPARISONS_INFO,
|
||||
crate::operators::ARITHMETIC_SIDE_EFFECTS_INFO,
|
||||
crate::operators::ASSIGN_OP_PATTERN_INFO,
|
||||
crate::operators::BAD_BIT_MASK_INFO,
|
||||
crate::operators::CMP_NAN_INFO,
|
||||
crate::operators::CMP_OWNED_INFO,
|
||||
crate::operators::DOUBLE_COMPARISONS_INFO,
|
||||
crate::operators::DURATION_SUBSEC_INFO,
|
||||
crate::operators::EQ_OP_INFO,
|
||||
crate::operators::ERASING_OP_INFO,
|
||||
crate::operators::FLOAT_ARITHMETIC_INFO,
|
||||
crate::operators::FLOAT_CMP_INFO,
|
||||
crate::operators::FLOAT_CMP_CONST_INFO,
|
||||
crate::operators::FLOAT_EQUALITY_WITHOUT_ABS_INFO,
|
||||
crate::operators::IDENTITY_OP_INFO,
|
||||
crate::operators::INEFFECTIVE_BIT_MASK_INFO,
|
||||
crate::operators::INTEGER_ARITHMETIC_INFO,
|
||||
crate::operators::INTEGER_DIVISION_INFO,
|
||||
crate::operators::MISREFACTORED_ASSIGN_OP_INFO,
|
||||
crate::operators::MODULO_ARITHMETIC_INFO,
|
||||
crate::operators::MODULO_ONE_INFO,
|
||||
crate::operators::NEEDLESS_BITWISE_BOOL_INFO,
|
||||
crate::operators::OP_REF_INFO,
|
||||
crate::operators::PTR_EQ_INFO,
|
||||
crate::operators::SELF_ASSIGNMENT_INFO,
|
||||
crate::operators::VERBOSE_BIT_MASK_INFO,
|
||||
crate::option_env_unwrap::OPTION_ENV_UNWRAP_INFO,
|
||||
crate::option_if_let_else::OPTION_IF_LET_ELSE_INFO,
|
||||
crate::overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL_INFO,
|
||||
crate::panic_in_result_fn::PANIC_IN_RESULT_FN_INFO,
|
||||
crate::panic_unimplemented::PANIC_INFO,
|
||||
crate::panic_unimplemented::TODO_INFO,
|
||||
crate::panic_unimplemented::UNIMPLEMENTED_INFO,
|
||||
crate::panic_unimplemented::UNREACHABLE_INFO,
|
||||
crate::partial_pub_fields::PARTIAL_PUB_FIELDS_INFO,
|
||||
crate::partialeq_ne_impl::PARTIALEQ_NE_IMPL_INFO,
|
||||
crate::partialeq_to_none::PARTIALEQ_TO_NONE_INFO,
|
||||
crate::pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE_INFO,
|
||||
crate::pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF_INFO,
|
||||
crate::pattern_type_mismatch::PATTERN_TYPE_MISMATCH_INFO,
|
||||
crate::precedence::PRECEDENCE_INFO,
|
||||
crate::ptr::CMP_NULL_INFO,
|
||||
crate::ptr::INVALID_NULL_PTR_USAGE_INFO,
|
||||
crate::ptr::MUT_FROM_REF_INFO,
|
||||
crate::ptr::PTR_ARG_INFO,
|
||||
crate::ptr_offset_with_cast::PTR_OFFSET_WITH_CAST_INFO,
|
||||
crate::pub_use::PUB_USE_INFO,
|
||||
crate::question_mark::QUESTION_MARK_INFO,
|
||||
crate::ranges::MANUAL_RANGE_CONTAINS_INFO,
|
||||
crate::ranges::RANGE_MINUS_ONE_INFO,
|
||||
crate::ranges::RANGE_PLUS_ONE_INFO,
|
||||
crate::ranges::REVERSED_EMPTY_RANGES_INFO,
|
||||
crate::rc_clone_in_vec_init::RC_CLONE_IN_VEC_INIT_INFO,
|
||||
crate::read_zero_byte_vec::READ_ZERO_BYTE_VEC_INFO,
|
||||
crate::redundant_clone::REDUNDANT_CLONE_INFO,
|
||||
crate::redundant_closure_call::REDUNDANT_CLOSURE_CALL_INFO,
|
||||
crate::redundant_else::REDUNDANT_ELSE_INFO,
|
||||
crate::redundant_field_names::REDUNDANT_FIELD_NAMES_INFO,
|
||||
crate::redundant_pub_crate::REDUNDANT_PUB_CRATE_INFO,
|
||||
crate::redundant_slicing::DEREF_BY_SLICING_INFO,
|
||||
crate::redundant_slicing::REDUNDANT_SLICING_INFO,
|
||||
crate::redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES_INFO,
|
||||
crate::ref_option_ref::REF_OPTION_REF_INFO,
|
||||
crate::reference::DEREF_ADDROF_INFO,
|
||||
crate::regex::INVALID_REGEX_INFO,
|
||||
crate::regex::TRIVIAL_REGEX_INFO,
|
||||
crate::return_self_not_must_use::RETURN_SELF_NOT_MUST_USE_INFO,
|
||||
crate::returns::LET_AND_RETURN_INFO,
|
||||
crate::returns::NEEDLESS_RETURN_INFO,
|
||||
crate::same_name_method::SAME_NAME_METHOD_INFO,
|
||||
crate::self_named_constructors::SELF_NAMED_CONSTRUCTORS_INFO,
|
||||
crate::semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED_INFO,
|
||||
crate::serde_api::SERDE_API_MISUSE_INFO,
|
||||
crate::shadow::SHADOW_REUSE_INFO,
|
||||
crate::shadow::SHADOW_SAME_INFO,
|
||||
crate::shadow::SHADOW_UNRELATED_INFO,
|
||||
crate::single_char_lifetime_names::SINGLE_CHAR_LIFETIME_NAMES_INFO,
|
||||
crate::single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS_INFO,
|
||||
crate::size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT_INFO,
|
||||
crate::slow_vector_initialization::SLOW_VECTOR_INITIALIZATION_INFO,
|
||||
crate::std_instead_of_core::ALLOC_INSTEAD_OF_CORE_INFO,
|
||||
crate::std_instead_of_core::STD_INSTEAD_OF_ALLOC_INFO,
|
||||
crate::std_instead_of_core::STD_INSTEAD_OF_CORE_INFO,
|
||||
crate::strings::STRING_ADD_INFO,
|
||||
crate::strings::STRING_ADD_ASSIGN_INFO,
|
||||
crate::strings::STRING_FROM_UTF8_AS_BYTES_INFO,
|
||||
crate::strings::STRING_LIT_AS_BYTES_INFO,
|
||||
crate::strings::STRING_SLICE_INFO,
|
||||
crate::strings::STRING_TO_STRING_INFO,
|
||||
crate::strings::STR_TO_STRING_INFO,
|
||||
crate::strings::TRIM_SPLIT_WHITESPACE_INFO,
|
||||
crate::strlen_on_c_strings::STRLEN_ON_C_STRINGS_INFO,
|
||||
crate::suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS_INFO,
|
||||
crate::suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL_INFO,
|
||||
crate::suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL_INFO,
|
||||
crate::swap::ALMOST_SWAPPED_INFO,
|
||||
crate::swap::MANUAL_SWAP_INFO,
|
||||
crate::swap_ptr_to_ref::SWAP_PTR_TO_REF_INFO,
|
||||
crate::tabs_in_doc_comments::TABS_IN_DOC_COMMENTS_INFO,
|
||||
crate::temporary_assignment::TEMPORARY_ASSIGNMENT_INFO,
|
||||
crate::to_digit_is_some::TO_DIGIT_IS_SOME_INFO,
|
||||
crate::trailing_empty_array::TRAILING_EMPTY_ARRAY_INFO,
|
||||
crate::trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS_INFO,
|
||||
crate::trait_bounds::TYPE_REPETITION_IN_BOUNDS_INFO,
|
||||
crate::transmute::CROSSPOINTER_TRANSMUTE_INFO,
|
||||
crate::transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS_INFO,
|
||||
crate::transmute::TRANSMUTE_BYTES_TO_STR_INFO,
|
||||
crate::transmute::TRANSMUTE_FLOAT_TO_INT_INFO,
|
||||
crate::transmute::TRANSMUTE_INT_TO_BOOL_INFO,
|
||||
crate::transmute::TRANSMUTE_INT_TO_CHAR_INFO,
|
||||
crate::transmute::TRANSMUTE_INT_TO_FLOAT_INFO,
|
||||
crate::transmute::TRANSMUTE_NUM_TO_BYTES_INFO,
|
||||
crate::transmute::TRANSMUTE_PTR_TO_PTR_INFO,
|
||||
crate::transmute::TRANSMUTE_PTR_TO_REF_INFO,
|
||||
crate::transmute::TRANSMUTE_UNDEFINED_REPR_INFO,
|
||||
crate::transmute::TRANSMUTING_NULL_INFO,
|
||||
crate::transmute::UNSOUND_COLLECTION_TRANSMUTE_INFO,
|
||||
crate::transmute::USELESS_TRANSMUTE_INFO,
|
||||
crate::transmute::WRONG_TRANSMUTE_INFO,
|
||||
crate::types::BORROWED_BOX_INFO,
|
||||
crate::types::BOX_COLLECTION_INFO,
|
||||
crate::types::LINKEDLIST_INFO,
|
||||
crate::types::OPTION_OPTION_INFO,
|
||||
crate::types::RC_BUFFER_INFO,
|
||||
crate::types::RC_MUTEX_INFO,
|
||||
crate::types::REDUNDANT_ALLOCATION_INFO,
|
||||
crate::types::TYPE_COMPLEXITY_INFO,
|
||||
crate::types::VEC_BOX_INFO,
|
||||
crate::undocumented_unsafe_blocks::UNDOCUMENTED_UNSAFE_BLOCKS_INFO,
|
||||
crate::unicode::INVISIBLE_CHARACTERS_INFO,
|
||||
crate::unicode::NON_ASCII_LITERAL_INFO,
|
||||
crate::unicode::UNICODE_NOT_NFC_INFO,
|
||||
crate::uninit_vec::UNINIT_VEC_INFO,
|
||||
crate::unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD_INFO,
|
||||
crate::unit_types::LET_UNIT_VALUE_INFO,
|
||||
crate::unit_types::UNIT_ARG_INFO,
|
||||
crate::unit_types::UNIT_CMP_INFO,
|
||||
crate::unnamed_address::FN_ADDRESS_COMPARISONS_INFO,
|
||||
crate::unnamed_address::VTABLE_ADDRESS_COMPARISONS_INFO,
|
||||
crate::unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS_INFO,
|
||||
crate::unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS_INFO,
|
||||
crate::unnecessary_wraps::UNNECESSARY_WRAPS_INFO,
|
||||
crate::unnested_or_patterns::UNNESTED_OR_PATTERNS_INFO,
|
||||
crate::unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME_INFO,
|
||||
crate::unused_async::UNUSED_ASYNC_INFO,
|
||||
crate::unused_io_amount::UNUSED_IO_AMOUNT_INFO,
|
||||
crate::unused_peekable::UNUSED_PEEKABLE_INFO,
|
||||
crate::unused_rounding::UNUSED_ROUNDING_INFO,
|
||||
crate::unused_self::UNUSED_SELF_INFO,
|
||||
crate::unused_unit::UNUSED_UNIT_INFO,
|
||||
crate::unwrap::PANICKING_UNWRAP_INFO,
|
||||
crate::unwrap::UNNECESSARY_UNWRAP_INFO,
|
||||
crate::unwrap_in_result::UNWRAP_IN_RESULT_INFO,
|
||||
crate::upper_case_acronyms::UPPER_CASE_ACRONYMS_INFO,
|
||||
crate::use_self::USE_SELF_INFO,
|
||||
crate::useless_conversion::USELESS_CONVERSION_INFO,
|
||||
crate::vec::USELESS_VEC_INFO,
|
||||
crate::vec_init_then_push::VEC_INIT_THEN_PUSH_INFO,
|
||||
crate::wildcard_imports::ENUM_GLOB_USE_INFO,
|
||||
crate::wildcard_imports::WILDCARD_IMPORTS_INFO,
|
||||
crate::write::PRINTLN_EMPTY_STRING_INFO,
|
||||
crate::write::PRINT_LITERAL_INFO,
|
||||
crate::write::PRINT_STDERR_INFO,
|
||||
crate::write::PRINT_STDOUT_INFO,
|
||||
crate::write::PRINT_WITH_NEWLINE_INFO,
|
||||
crate::write::USE_DEBUG_INFO,
|
||||
crate::write::WRITELN_EMPTY_STRING_INFO,
|
||||
crate::write::WRITE_LITERAL_INFO,
|
||||
crate::write::WRITE_WITH_NEWLINE_INFO,
|
||||
crate::zero_div_zero::ZERO_DIVIDED_BY_ZERO_INFO,
|
||||
crate::zero_sized_map_values::ZERO_SIZED_MAP_VALUES_INFO,
|
||||
];
|
|
@ -1,370 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::all", Some("clippy_all"), vec![
|
||||
LintId::of(almost_complete_letter_range::ALMOST_COMPLETE_LETTER_RANGE),
|
||||
LintId::of(approx_const::APPROX_CONSTANT),
|
||||
LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
|
||||
LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC),
|
||||
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
|
||||
LintId::of(attrs::DEPRECATED_CFG_ATTR),
|
||||
LintId::of(attrs::DEPRECATED_SEMVER),
|
||||
LintId::of(attrs::MISMATCHED_TARGET_OS),
|
||||
LintId::of(attrs::USELESS_ATTRIBUTE),
|
||||
LintId::of(await_holding_invalid::AWAIT_HOLDING_INVALID_TYPE),
|
||||
LintId::of(await_holding_invalid::AWAIT_HOLDING_LOCK),
|
||||
LintId::of(await_holding_invalid::AWAIT_HOLDING_REFCELL_REF),
|
||||
LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
|
||||
LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON),
|
||||
LintId::of(bool_to_int_with_if::BOOL_TO_INT_WITH_IF),
|
||||
LintId::of(booleans::NONMINIMAL_BOOL),
|
||||
LintId::of(booleans::OVERLY_COMPLEX_BOOL_EXPR),
|
||||
LintId::of(borrow_deref_ref::BORROW_DEREF_REF),
|
||||
LintId::of(box_default::BOX_DEFAULT),
|
||||
LintId::of(casts::CAST_ABS_TO_UNSIGNED),
|
||||
LintId::of(casts::CAST_ENUM_CONSTRUCTOR),
|
||||
LintId::of(casts::CAST_ENUM_TRUNCATION),
|
||||
LintId::of(casts::CAST_NAN_TO_INT),
|
||||
LintId::of(casts::CAST_REF_TO_MUT),
|
||||
LintId::of(casts::CAST_SLICE_DIFFERENT_SIZES),
|
||||
LintId::of(casts::CAST_SLICE_FROM_RAW_PARTS),
|
||||
LintId::of(casts::CHAR_LIT_AS_U8),
|
||||
LintId::of(casts::FN_TO_NUMERIC_CAST),
|
||||
LintId::of(casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
|
||||
LintId::of(casts::UNNECESSARY_CAST),
|
||||
LintId::of(collapsible_if::COLLAPSIBLE_ELSE_IF),
|
||||
LintId::of(collapsible_if::COLLAPSIBLE_IF),
|
||||
LintId::of(comparison_chain::COMPARISON_CHAIN),
|
||||
LintId::of(copies::IFS_SAME_COND),
|
||||
LintId::of(copies::IF_SAME_THEN_ELSE),
|
||||
LintId::of(crate_in_macro_def::CRATE_IN_MACRO_DEF),
|
||||
LintId::of(default::FIELD_REASSIGN_WITH_DEFAULT),
|
||||
LintId::of(default_instead_of_iter_empty::DEFAULT_INSTEAD_OF_ITER_EMPTY),
|
||||
LintId::of(dereference::EXPLICIT_AUTO_DEREF),
|
||||
LintId::of(dereference::NEEDLESS_BORROW),
|
||||
LintId::of(derivable_impls::DERIVABLE_IMPLS),
|
||||
LintId::of(derive::DERIVE_HASH_XOR_EQ),
|
||||
LintId::of(derive::DERIVE_ORD_XOR_PARTIAL_ORD),
|
||||
LintId::of(disallowed_macros::DISALLOWED_MACROS),
|
||||
LintId::of(disallowed_methods::DISALLOWED_METHODS),
|
||||
LintId::of(disallowed_names::DISALLOWED_NAMES),
|
||||
LintId::of(disallowed_types::DISALLOWED_TYPES),
|
||||
LintId::of(doc::MISSING_SAFETY_DOC),
|
||||
LintId::of(doc::NEEDLESS_DOCTEST_MAIN),
|
||||
LintId::of(double_parens::DOUBLE_PARENS),
|
||||
LintId::of(drop_forget_ref::DROP_COPY),
|
||||
LintId::of(drop_forget_ref::DROP_NON_DROP),
|
||||
LintId::of(drop_forget_ref::DROP_REF),
|
||||
LintId::of(drop_forget_ref::FORGET_COPY),
|
||||
LintId::of(drop_forget_ref::FORGET_NON_DROP),
|
||||
LintId::of(drop_forget_ref::FORGET_REF),
|
||||
LintId::of(drop_forget_ref::UNDROPPED_MANUALLY_DROPS),
|
||||
LintId::of(duplicate_mod::DUPLICATE_MOD),
|
||||
LintId::of(entry::MAP_ENTRY),
|
||||
LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
|
||||
LintId::of(enum_variants::ENUM_VARIANT_NAMES),
|
||||
LintId::of(enum_variants::MODULE_INCEPTION),
|
||||
LintId::of(escape::BOXED_LOCAL),
|
||||
LintId::of(eta_reduction::REDUNDANT_CLOSURE),
|
||||
LintId::of(explicit_write::EXPLICIT_WRITE),
|
||||
LintId::of(float_literal::EXCESSIVE_PRECISION),
|
||||
LintId::of(format::USELESS_FORMAT),
|
||||
LintId::of(format_args::FORMAT_IN_FORMAT_ARGS),
|
||||
LintId::of(format_args::TO_STRING_IN_FORMAT_ARGS),
|
||||
LintId::of(format_args::UNINLINED_FORMAT_ARGS),
|
||||
LintId::of(format_args::UNUSED_FORMAT_SPECS),
|
||||
LintId::of(format_impl::PRINT_IN_FORMAT_IMPL),
|
||||
LintId::of(format_impl::RECURSIVE_FORMAT_IMPL),
|
||||
LintId::of(formatting::POSSIBLE_MISSING_COMMA),
|
||||
LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
|
||||
LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING),
|
||||
LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
|
||||
LintId::of(from_over_into::FROM_OVER_INTO),
|
||||
LintId::of(from_raw_with_void_ptr::FROM_RAW_WITH_VOID_PTR),
|
||||
LintId::of(from_str_radix_10::FROM_STR_RADIX_10),
|
||||
LintId::of(functions::DOUBLE_MUST_USE),
|
||||
LintId::of(functions::MUST_USE_UNIT),
|
||||
LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF),
|
||||
LintId::of(functions::RESULT_LARGE_ERR),
|
||||
LintId::of(functions::RESULT_UNIT_ERR),
|
||||
LintId::of(functions::TOO_MANY_ARGUMENTS),
|
||||
LintId::of(if_let_mutex::IF_LET_MUTEX),
|
||||
LintId::of(implicit_saturating_add::IMPLICIT_SATURATING_ADD),
|
||||
LintId::of(implicit_saturating_sub::IMPLICIT_SATURATING_SUB),
|
||||
LintId::of(indexing_slicing::OUT_OF_BOUNDS_INDEXING),
|
||||
LintId::of(infinite_iter::INFINITE_ITER),
|
||||
LintId::of(inherent_to_string::INHERENT_TO_STRING),
|
||||
LintId::of(inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
|
||||
LintId::of(init_numbered_fields::INIT_NUMBERED_FIELDS),
|
||||
LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
|
||||
LintId::of(int_plus_one::INT_PLUS_ONE),
|
||||
LintId::of(invalid_utf8_in_unchecked::INVALID_UTF8_IN_UNCHECKED),
|
||||
LintId::of(large_const_arrays::LARGE_CONST_ARRAYS),
|
||||
LintId::of(large_enum_variant::LARGE_ENUM_VARIANT),
|
||||
LintId::of(len_zero::COMPARISON_TO_EMPTY),
|
||||
LintId::of(len_zero::LEN_WITHOUT_IS_EMPTY),
|
||||
LintId::of(len_zero::LEN_ZERO),
|
||||
LintId::of(let_underscore::LET_UNDERSCORE_LOCK),
|
||||
LintId::of(lifetimes::EXTRA_UNUSED_LIFETIMES),
|
||||
LintId::of(lifetimes::NEEDLESS_LIFETIMES),
|
||||
LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING),
|
||||
LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES),
|
||||
LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS),
|
||||
LintId::of(loops::EMPTY_LOOP),
|
||||
LintId::of(loops::EXPLICIT_COUNTER_LOOP),
|
||||
LintId::of(loops::FOR_KV_MAP),
|
||||
LintId::of(loops::ITER_NEXT_LOOP),
|
||||
LintId::of(loops::MANUAL_FIND),
|
||||
LintId::of(loops::MANUAL_FLATTEN),
|
||||
LintId::of(loops::MANUAL_MEMCPY),
|
||||
LintId::of(loops::MISSING_SPIN_LOOP),
|
||||
LintId::of(loops::MUT_RANGE_BOUND),
|
||||
LintId::of(loops::NEEDLESS_COLLECT),
|
||||
LintId::of(loops::NEEDLESS_RANGE_LOOP),
|
||||
LintId::of(loops::NEVER_LOOP),
|
||||
LintId::of(loops::SAME_ITEM_PUSH),
|
||||
LintId::of(loops::SINGLE_ELEMENT_LOOP),
|
||||
LintId::of(loops::WHILE_IMMUTABLE_CONDITION),
|
||||
LintId::of(loops::WHILE_LET_LOOP),
|
||||
LintId::of(loops::WHILE_LET_ON_ITERATOR),
|
||||
LintId::of(main_recursion::MAIN_RECURSION),
|
||||
LintId::of(manual_async_fn::MANUAL_ASYNC_FN),
|
||||
LintId::of(manual_bits::MANUAL_BITS),
|
||||
LintId::of(manual_clamp::MANUAL_CLAMP),
|
||||
LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE),
|
||||
LintId::of(manual_rem_euclid::MANUAL_REM_EUCLID),
|
||||
LintId::of(manual_retain::MANUAL_RETAIN),
|
||||
LintId::of(manual_strip::MANUAL_STRIP),
|
||||
LintId::of(map_unit_fn::OPTION_MAP_UNIT_FN),
|
||||
LintId::of(map_unit_fn::RESULT_MAP_UNIT_FN),
|
||||
LintId::of(match_result_ok::MATCH_RESULT_OK),
|
||||
LintId::of(matches::COLLAPSIBLE_MATCH),
|
||||
LintId::of(matches::INFALLIBLE_DESTRUCTURING_MATCH),
|
||||
LintId::of(matches::MANUAL_FILTER),
|
||||
LintId::of(matches::MANUAL_MAP),
|
||||
LintId::of(matches::MANUAL_UNWRAP_OR),
|
||||
LintId::of(matches::MATCH_AS_REF),
|
||||
LintId::of(matches::MATCH_LIKE_MATCHES_MACRO),
|
||||
LintId::of(matches::MATCH_OVERLAPPING_ARM),
|
||||
LintId::of(matches::MATCH_REF_PATS),
|
||||
LintId::of(matches::MATCH_SINGLE_BINDING),
|
||||
LintId::of(matches::MATCH_STR_CASE_MISMATCH),
|
||||
LintId::of(matches::NEEDLESS_MATCH),
|
||||
LintId::of(matches::REDUNDANT_PATTERN_MATCHING),
|
||||
LintId::of(matches::SINGLE_MATCH),
|
||||
LintId::of(matches::WILDCARD_IN_OR_PATTERNS),
|
||||
LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
|
||||
LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT),
|
||||
LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT),
|
||||
LintId::of(methods::BIND_INSTEAD_OF_MAP),
|
||||
LintId::of(methods::BYTES_COUNT_TO_LEN),
|
||||
LintId::of(methods::BYTES_NTH),
|
||||
LintId::of(methods::CHARS_LAST_CMP),
|
||||
LintId::of(methods::CHARS_NEXT_CMP),
|
||||
LintId::of(methods::CLONE_DOUBLE_REF),
|
||||
LintId::of(methods::CLONE_ON_COPY),
|
||||
LintId::of(methods::COLLAPSIBLE_STR_REPLACE),
|
||||
LintId::of(methods::ERR_EXPECT),
|
||||
LintId::of(methods::EXPECT_FUN_CALL),
|
||||
LintId::of(methods::EXTEND_WITH_DRAIN),
|
||||
LintId::of(methods::FILTER_MAP_IDENTITY),
|
||||
LintId::of(methods::FILTER_NEXT),
|
||||
LintId::of(methods::FLAT_MAP_IDENTITY),
|
||||
LintId::of(methods::GET_FIRST),
|
||||
LintId::of(methods::GET_LAST_WITH_LEN),
|
||||
LintId::of(methods::INSPECT_FOR_EACH),
|
||||
LintId::of(methods::INTO_ITER_ON_REF),
|
||||
LintId::of(methods::IS_DIGIT_ASCII_RADIX),
|
||||
LintId::of(methods::ITERATOR_STEP_BY_ZERO),
|
||||
LintId::of(methods::ITER_CLONED_COLLECT),
|
||||
LintId::of(methods::ITER_COUNT),
|
||||
LintId::of(methods::ITER_KV_MAP),
|
||||
LintId::of(methods::ITER_NEXT_SLICE),
|
||||
LintId::of(methods::ITER_NTH),
|
||||
LintId::of(methods::ITER_NTH_ZERO),
|
||||
LintId::of(methods::ITER_OVEREAGER_CLONED),
|
||||
LintId::of(methods::ITER_SKIP_NEXT),
|
||||
LintId::of(methods::MANUAL_FILTER_MAP),
|
||||
LintId::of(methods::MANUAL_FIND_MAP),
|
||||
LintId::of(methods::MANUAL_SATURATING_ARITHMETIC),
|
||||
LintId::of(methods::MANUAL_SPLIT_ONCE),
|
||||
LintId::of(methods::MANUAL_STR_REPEAT),
|
||||
LintId::of(methods::MAP_CLONE),
|
||||
LintId::of(methods::MAP_COLLECT_RESULT_UNIT),
|
||||
LintId::of(methods::MAP_FLATTEN),
|
||||
LintId::of(methods::MAP_IDENTITY),
|
||||
LintId::of(methods::MUT_MUTEX_LOCK),
|
||||
LintId::of(methods::NEEDLESS_OPTION_AS_DEREF),
|
||||
LintId::of(methods::NEEDLESS_OPTION_TAKE),
|
||||
LintId::of(methods::NEEDLESS_SPLITN),
|
||||
LintId::of(methods::NEW_RET_NO_SELF),
|
||||
LintId::of(methods::NONSENSICAL_OPEN_OPTIONS),
|
||||
LintId::of(methods::NO_EFFECT_REPLACE),
|
||||
LintId::of(methods::OBFUSCATED_IF_ELSE),
|
||||
LintId::of(methods::OK_EXPECT),
|
||||
LintId::of(methods::OPTION_AS_REF_DEREF),
|
||||
LintId::of(methods::OPTION_FILTER_MAP),
|
||||
LintId::of(methods::OPTION_MAP_OR_NONE),
|
||||
LintId::of(methods::OR_FUN_CALL),
|
||||
LintId::of(methods::OR_THEN_UNWRAP),
|
||||
LintId::of(methods::RANGE_ZIP_WITH_LEN),
|
||||
LintId::of(methods::REPEAT_ONCE),
|
||||
LintId::of(methods::RESULT_MAP_OR_INTO_OPTION),
|
||||
LintId::of(methods::SEARCH_IS_SOME),
|
||||
LintId::of(methods::SHOULD_IMPLEMENT_TRAIT),
|
||||
LintId::of(methods::SINGLE_CHAR_ADD_STR),
|
||||
LintId::of(methods::SINGLE_CHAR_PATTERN),
|
||||
LintId::of(methods::SKIP_WHILE_NEXT),
|
||||
LintId::of(methods::STRING_EXTEND_CHARS),
|
||||
LintId::of(methods::SUSPICIOUS_MAP),
|
||||
LintId::of(methods::SUSPICIOUS_SPLITN),
|
||||
LintId::of(methods::SUSPICIOUS_TO_OWNED),
|
||||
LintId::of(methods::UNINIT_ASSUMED_INIT),
|
||||
LintId::of(methods::UNIT_HASH),
|
||||
LintId::of(methods::UNNECESSARY_FILTER_MAP),
|
||||
LintId::of(methods::UNNECESSARY_FIND_MAP),
|
||||
LintId::of(methods::UNNECESSARY_FOLD),
|
||||
LintId::of(methods::UNNECESSARY_LAZY_EVALUATIONS),
|
||||
LintId::of(methods::UNNECESSARY_SORT_BY),
|
||||
LintId::of(methods::UNNECESSARY_TO_OWNED),
|
||||
LintId::of(methods::UNWRAP_OR_ELSE_DEFAULT),
|
||||
LintId::of(methods::USELESS_ASREF),
|
||||
LintId::of(methods::VEC_RESIZE_TO_ZERO),
|
||||
LintId::of(methods::WRONG_SELF_CONVENTION),
|
||||
LintId::of(methods::ZST_OFFSET),
|
||||
LintId::of(minmax::MIN_MAX),
|
||||
LintId::of(misc::SHORT_CIRCUIT_STATEMENT),
|
||||
LintId::of(misc::TOPLEVEL_REF_ARG),
|
||||
LintId::of(misc::ZERO_PTR),
|
||||
LintId::of(misc_early::BUILTIN_TYPE_SHADOW),
|
||||
LintId::of(misc_early::DOUBLE_NEG),
|
||||
LintId::of(misc_early::DUPLICATE_UNDERSCORE_ARGUMENT),
|
||||
LintId::of(misc_early::MIXED_CASE_HEX_LITERALS),
|
||||
LintId::of(misc_early::REDUNDANT_PATTERN),
|
||||
LintId::of(misc_early::UNNEEDED_WILDCARD_PATTERN),
|
||||
LintId::of(misc_early::ZERO_PREFIXED_LITERAL),
|
||||
LintId::of(mixed_read_write_in_expression::DIVERGING_SUB_EXPRESSION),
|
||||
LintId::of(multi_assignments::MULTI_ASSIGNMENTS),
|
||||
LintId::of(mut_key::MUTABLE_KEY_TYPE),
|
||||
LintId::of(mut_reference::UNNECESSARY_MUT_PASSED),
|
||||
LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE),
|
||||
LintId::of(needless_bool::BOOL_COMPARISON),
|
||||
LintId::of(needless_bool::NEEDLESS_BOOL),
|
||||
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
|
||||
LintId::of(needless_late_init::NEEDLESS_LATE_INIT),
|
||||
LintId::of(needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS),
|
||||
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
|
||||
LintId::of(needless_update::NEEDLESS_UPDATE),
|
||||
LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
|
||||
LintId::of(neg_multiply::NEG_MULTIPLY),
|
||||
LintId::of(new_without_default::NEW_WITHOUT_DEFAULT),
|
||||
LintId::of(no_effect::NO_EFFECT),
|
||||
LintId::of(no_effect::UNNECESSARY_OPERATION),
|
||||
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
|
||||
LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
|
||||
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
|
||||
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
|
||||
LintId::of(octal_escapes::OCTAL_ESCAPES),
|
||||
LintId::of(only_used_in_recursion::ONLY_USED_IN_RECURSION),
|
||||
LintId::of(operators::ABSURD_EXTREME_COMPARISONS),
|
||||
LintId::of(operators::ASSIGN_OP_PATTERN),
|
||||
LintId::of(operators::BAD_BIT_MASK),
|
||||
LintId::of(operators::CMP_NAN),
|
||||
LintId::of(operators::CMP_OWNED),
|
||||
LintId::of(operators::DOUBLE_COMPARISONS),
|
||||
LintId::of(operators::DURATION_SUBSEC),
|
||||
LintId::of(operators::EQ_OP),
|
||||
LintId::of(operators::ERASING_OP),
|
||||
LintId::of(operators::FLOAT_EQUALITY_WITHOUT_ABS),
|
||||
LintId::of(operators::IDENTITY_OP),
|
||||
LintId::of(operators::INEFFECTIVE_BIT_MASK),
|
||||
LintId::of(operators::MISREFACTORED_ASSIGN_OP),
|
||||
LintId::of(operators::MODULO_ONE),
|
||||
LintId::of(operators::OP_REF),
|
||||
LintId::of(operators::PTR_EQ),
|
||||
LintId::of(operators::SELF_ASSIGNMENT),
|
||||
LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP),
|
||||
LintId::of(overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL),
|
||||
LintId::of(partialeq_ne_impl::PARTIALEQ_NE_IMPL),
|
||||
LintId::of(partialeq_to_none::PARTIALEQ_TO_NONE),
|
||||
LintId::of(precedence::PRECEDENCE),
|
||||
LintId::of(ptr::CMP_NULL),
|
||||
LintId::of(ptr::INVALID_NULL_PTR_USAGE),
|
||||
LintId::of(ptr::MUT_FROM_REF),
|
||||
LintId::of(ptr::PTR_ARG),
|
||||
LintId::of(ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
|
||||
LintId::of(question_mark::QUESTION_MARK),
|
||||
LintId::of(ranges::MANUAL_RANGE_CONTAINS),
|
||||
LintId::of(ranges::REVERSED_EMPTY_RANGES),
|
||||
LintId::of(rc_clone_in_vec_init::RC_CLONE_IN_VEC_INIT),
|
||||
LintId::of(read_zero_byte_vec::READ_ZERO_BYTE_VEC),
|
||||
LintId::of(redundant_clone::REDUNDANT_CLONE),
|
||||
LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL),
|
||||
LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES),
|
||||
LintId::of(redundant_slicing::REDUNDANT_SLICING),
|
||||
LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
|
||||
LintId::of(reference::DEREF_ADDROF),
|
||||
LintId::of(regex::INVALID_REGEX),
|
||||
LintId::of(returns::LET_AND_RETURN),
|
||||
LintId::of(returns::NEEDLESS_RETURN),
|
||||
LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS),
|
||||
LintId::of(serde_api::SERDE_API_MISUSE),
|
||||
LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
|
||||
LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
|
||||
LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
|
||||
LintId::of(strings::STRING_FROM_UTF8_AS_BYTES),
|
||||
LintId::of(strings::TRIM_SPLIT_WHITESPACE),
|
||||
LintId::of(strlen_on_c_strings::STRLEN_ON_C_STRINGS),
|
||||
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
|
||||
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
|
||||
LintId::of(swap::ALMOST_SWAPPED),
|
||||
LintId::of(swap::MANUAL_SWAP),
|
||||
LintId::of(swap_ptr_to_ref::SWAP_PTR_TO_REF),
|
||||
LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
|
||||
LintId::of(temporary_assignment::TEMPORARY_ASSIGNMENT),
|
||||
LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME),
|
||||
LintId::of(transmute::CROSSPOINTER_TRANSMUTE),
|
||||
LintId::of(transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS),
|
||||
LintId::of(transmute::TRANSMUTE_BYTES_TO_STR),
|
||||
LintId::of(transmute::TRANSMUTE_FLOAT_TO_INT),
|
||||
LintId::of(transmute::TRANSMUTE_INT_TO_BOOL),
|
||||
LintId::of(transmute::TRANSMUTE_INT_TO_CHAR),
|
||||
LintId::of(transmute::TRANSMUTE_INT_TO_FLOAT),
|
||||
LintId::of(transmute::TRANSMUTE_NUM_TO_BYTES),
|
||||
LintId::of(transmute::TRANSMUTE_PTR_TO_REF),
|
||||
LintId::of(transmute::TRANSMUTING_NULL),
|
||||
LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE),
|
||||
LintId::of(transmute::USELESS_TRANSMUTE),
|
||||
LintId::of(transmute::WRONG_TRANSMUTE),
|
||||
LintId::of(types::BORROWED_BOX),
|
||||
LintId::of(types::BOX_COLLECTION),
|
||||
LintId::of(types::REDUNDANT_ALLOCATION),
|
||||
LintId::of(types::TYPE_COMPLEXITY),
|
||||
LintId::of(types::VEC_BOX),
|
||||
LintId::of(unicode::INVISIBLE_CHARACTERS),
|
||||
LintId::of(uninit_vec::UNINIT_VEC),
|
||||
LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
|
||||
LintId::of(unit_types::LET_UNIT_VALUE),
|
||||
LintId::of(unit_types::UNIT_ARG),
|
||||
LintId::of(unit_types::UNIT_CMP),
|
||||
LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS),
|
||||
LintId::of(unnamed_address::VTABLE_ADDRESS_COMPARISONS),
|
||||
LintId::of(unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS),
|
||||
LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
|
||||
LintId::of(unused_io_amount::UNUSED_IO_AMOUNT),
|
||||
LintId::of(unused_unit::UNUSED_UNIT),
|
||||
LintId::of(unwrap::PANICKING_UNWRAP),
|
||||
LintId::of(unwrap::UNNECESSARY_UNWRAP),
|
||||
LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS),
|
||||
LintId::of(useless_conversion::USELESS_CONVERSION),
|
||||
LintId::of(vec::USELESS_VEC),
|
||||
LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH),
|
||||
LintId::of(write::PRINTLN_EMPTY_STRING),
|
||||
LintId::of(write::PRINT_LITERAL),
|
||||
LintId::of(write::PRINT_WITH_NEWLINE),
|
||||
LintId::of(write::WRITELN_EMPTY_STRING),
|
||||
LintId::of(write::WRITE_LITERAL),
|
||||
LintId::of(write::WRITE_WITH_NEWLINE),
|
||||
LintId::of(zero_div_zero::ZERO_DIVIDED_BY_ZERO),
|
||||
])
|
|
@ -1,11 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::cargo", Some("clippy_cargo"), vec![
|
||||
LintId::of(cargo::CARGO_COMMON_METADATA),
|
||||
LintId::of(cargo::MULTIPLE_CRATE_VERSIONS),
|
||||
LintId::of(cargo::NEGATIVE_FEATURE_NAMES),
|
||||
LintId::of(cargo::REDUNDANT_FEATURE_NAMES),
|
||||
LintId::of(cargo::WILDCARD_DEPENDENCIES),
|
||||
])
|
|
@ -1,111 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![
|
||||
LintId::of(attrs::DEPRECATED_CFG_ATTR),
|
||||
LintId::of(booleans::NONMINIMAL_BOOL),
|
||||
LintId::of(borrow_deref_ref::BORROW_DEREF_REF),
|
||||
LintId::of(casts::CHAR_LIT_AS_U8),
|
||||
LintId::of(casts::UNNECESSARY_CAST),
|
||||
LintId::of(dereference::EXPLICIT_AUTO_DEREF),
|
||||
LintId::of(derivable_impls::DERIVABLE_IMPLS),
|
||||
LintId::of(double_parens::DOUBLE_PARENS),
|
||||
LintId::of(explicit_write::EXPLICIT_WRITE),
|
||||
LintId::of(format::USELESS_FORMAT),
|
||||
LintId::of(format_args::UNUSED_FORMAT_SPECS),
|
||||
LintId::of(functions::TOO_MANY_ARGUMENTS),
|
||||
LintId::of(int_plus_one::INT_PLUS_ONE),
|
||||
LintId::of(lifetimes::EXTRA_UNUSED_LIFETIMES),
|
||||
LintId::of(lifetimes::NEEDLESS_LIFETIMES),
|
||||
LintId::of(loops::EXPLICIT_COUNTER_LOOP),
|
||||
LintId::of(loops::MANUAL_FIND),
|
||||
LintId::of(loops::MANUAL_FLATTEN),
|
||||
LintId::of(loops::SINGLE_ELEMENT_LOOP),
|
||||
LintId::of(loops::WHILE_LET_LOOP),
|
||||
LintId::of(manual_clamp::MANUAL_CLAMP),
|
||||
LintId::of(manual_rem_euclid::MANUAL_REM_EUCLID),
|
||||
LintId::of(manual_strip::MANUAL_STRIP),
|
||||
LintId::of(map_unit_fn::OPTION_MAP_UNIT_FN),
|
||||
LintId::of(map_unit_fn::RESULT_MAP_UNIT_FN),
|
||||
LintId::of(matches::MANUAL_FILTER),
|
||||
LintId::of(matches::MANUAL_UNWRAP_OR),
|
||||
LintId::of(matches::MATCH_AS_REF),
|
||||
LintId::of(matches::MATCH_SINGLE_BINDING),
|
||||
LintId::of(matches::NEEDLESS_MATCH),
|
||||
LintId::of(matches::WILDCARD_IN_OR_PATTERNS),
|
||||
LintId::of(methods::BIND_INSTEAD_OF_MAP),
|
||||
LintId::of(methods::BYTES_COUNT_TO_LEN),
|
||||
LintId::of(methods::CLONE_ON_COPY),
|
||||
LintId::of(methods::FILTER_MAP_IDENTITY),
|
||||
LintId::of(methods::FILTER_NEXT),
|
||||
LintId::of(methods::FLAT_MAP_IDENTITY),
|
||||
LintId::of(methods::GET_LAST_WITH_LEN),
|
||||
LintId::of(methods::INSPECT_FOR_EACH),
|
||||
LintId::of(methods::ITER_COUNT),
|
||||
LintId::of(methods::ITER_KV_MAP),
|
||||
LintId::of(methods::MANUAL_FILTER_MAP),
|
||||
LintId::of(methods::MANUAL_FIND_MAP),
|
||||
LintId::of(methods::MANUAL_SPLIT_ONCE),
|
||||
LintId::of(methods::MAP_FLATTEN),
|
||||
LintId::of(methods::MAP_IDENTITY),
|
||||
LintId::of(methods::NEEDLESS_OPTION_AS_DEREF),
|
||||
LintId::of(methods::NEEDLESS_OPTION_TAKE),
|
||||
LintId::of(methods::NEEDLESS_SPLITN),
|
||||
LintId::of(methods::OPTION_AS_REF_DEREF),
|
||||
LintId::of(methods::OPTION_FILTER_MAP),
|
||||
LintId::of(methods::OR_THEN_UNWRAP),
|
||||
LintId::of(methods::RANGE_ZIP_WITH_LEN),
|
||||
LintId::of(methods::REPEAT_ONCE),
|
||||
LintId::of(methods::SEARCH_IS_SOME),
|
||||
LintId::of(methods::SKIP_WHILE_NEXT),
|
||||
LintId::of(methods::UNNECESSARY_FILTER_MAP),
|
||||
LintId::of(methods::UNNECESSARY_FIND_MAP),
|
||||
LintId::of(methods::UNNECESSARY_SORT_BY),
|
||||
LintId::of(methods::USELESS_ASREF),
|
||||
LintId::of(misc::SHORT_CIRCUIT_STATEMENT),
|
||||
LintId::of(misc_early::UNNEEDED_WILDCARD_PATTERN),
|
||||
LintId::of(misc_early::ZERO_PREFIXED_LITERAL),
|
||||
LintId::of(mixed_read_write_in_expression::DIVERGING_SUB_EXPRESSION),
|
||||
LintId::of(needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE),
|
||||
LintId::of(needless_bool::BOOL_COMPARISON),
|
||||
LintId::of(needless_bool::NEEDLESS_BOOL),
|
||||
LintId::of(needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE),
|
||||
LintId::of(needless_question_mark::NEEDLESS_QUESTION_MARK),
|
||||
LintId::of(needless_update::NEEDLESS_UPDATE),
|
||||
LintId::of(neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD),
|
||||
LintId::of(no_effect::NO_EFFECT),
|
||||
LintId::of(no_effect::UNNECESSARY_OPERATION),
|
||||
LintId::of(only_used_in_recursion::ONLY_USED_IN_RECURSION),
|
||||
LintId::of(operators::DOUBLE_COMPARISONS),
|
||||
LintId::of(operators::DURATION_SUBSEC),
|
||||
LintId::of(operators::IDENTITY_OP),
|
||||
LintId::of(overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL),
|
||||
LintId::of(partialeq_ne_impl::PARTIALEQ_NE_IMPL),
|
||||
LintId::of(precedence::PRECEDENCE),
|
||||
LintId::of(ptr_offset_with_cast::PTR_OFFSET_WITH_CAST),
|
||||
LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL),
|
||||
LintId::of(redundant_slicing::REDUNDANT_SLICING),
|
||||
LintId::of(reference::DEREF_ADDROF),
|
||||
LintId::of(strings::STRING_FROM_UTF8_AS_BYTES),
|
||||
LintId::of(strlen_on_c_strings::STRLEN_ON_C_STRINGS),
|
||||
LintId::of(swap::MANUAL_SWAP),
|
||||
LintId::of(temporary_assignment::TEMPORARY_ASSIGNMENT),
|
||||
LintId::of(transmute::CROSSPOINTER_TRANSMUTE),
|
||||
LintId::of(transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS),
|
||||
LintId::of(transmute::TRANSMUTE_BYTES_TO_STR),
|
||||
LintId::of(transmute::TRANSMUTE_FLOAT_TO_INT),
|
||||
LintId::of(transmute::TRANSMUTE_INT_TO_BOOL),
|
||||
LintId::of(transmute::TRANSMUTE_INT_TO_CHAR),
|
||||
LintId::of(transmute::TRANSMUTE_INT_TO_FLOAT),
|
||||
LintId::of(transmute::TRANSMUTE_NUM_TO_BYTES),
|
||||
LintId::of(transmute::TRANSMUTE_PTR_TO_REF),
|
||||
LintId::of(transmute::USELESS_TRANSMUTE),
|
||||
LintId::of(types::BORROWED_BOX),
|
||||
LintId::of(types::TYPE_COMPLEXITY),
|
||||
LintId::of(types::VEC_BOX),
|
||||
LintId::of(unit_types::UNIT_ARG),
|
||||
LintId::of(unwrap::UNNECESSARY_UNWRAP),
|
||||
LintId::of(useless_conversion::USELESS_CONVERSION),
|
||||
LintId::of(zero_div_zero::ZERO_DIVIDED_BY_ZERO),
|
||||
])
|
|
@ -1,78 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::correctness", Some("clippy_correctness"), vec![
|
||||
LintId::of(approx_const::APPROX_CONSTANT),
|
||||
LintId::of(async_yields_async::ASYNC_YIELDS_ASYNC),
|
||||
LintId::of(attrs::DEPRECATED_SEMVER),
|
||||
LintId::of(attrs::MISMATCHED_TARGET_OS),
|
||||
LintId::of(attrs::USELESS_ATTRIBUTE),
|
||||
LintId::of(booleans::OVERLY_COMPLEX_BOOL_EXPR),
|
||||
LintId::of(casts::CAST_REF_TO_MUT),
|
||||
LintId::of(casts::CAST_SLICE_DIFFERENT_SIZES),
|
||||
LintId::of(copies::IFS_SAME_COND),
|
||||
LintId::of(copies::IF_SAME_THEN_ELSE),
|
||||
LintId::of(derive::DERIVE_HASH_XOR_EQ),
|
||||
LintId::of(derive::DERIVE_ORD_XOR_PARTIAL_ORD),
|
||||
LintId::of(drop_forget_ref::DROP_COPY),
|
||||
LintId::of(drop_forget_ref::DROP_REF),
|
||||
LintId::of(drop_forget_ref::FORGET_COPY),
|
||||
LintId::of(drop_forget_ref::FORGET_REF),
|
||||
LintId::of(drop_forget_ref::UNDROPPED_MANUALLY_DROPS),
|
||||
LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
|
||||
LintId::of(format_impl::RECURSIVE_FORMAT_IMPL),
|
||||
LintId::of(formatting::POSSIBLE_MISSING_COMMA),
|
||||
LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF),
|
||||
LintId::of(if_let_mutex::IF_LET_MUTEX),
|
||||
LintId::of(indexing_slicing::OUT_OF_BOUNDS_INDEXING),
|
||||
LintId::of(infinite_iter::INFINITE_ITER),
|
||||
LintId::of(inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY),
|
||||
LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
|
||||
LintId::of(invalid_utf8_in_unchecked::INVALID_UTF8_IN_UNCHECKED),
|
||||
LintId::of(let_underscore::LET_UNDERSCORE_LOCK),
|
||||
LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES),
|
||||
LintId::of(loops::ITER_NEXT_LOOP),
|
||||
LintId::of(loops::NEVER_LOOP),
|
||||
LintId::of(loops::WHILE_IMMUTABLE_CONDITION),
|
||||
LintId::of(matches::MATCH_STR_CASE_MISMATCH),
|
||||
LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT),
|
||||
LintId::of(methods::CLONE_DOUBLE_REF),
|
||||
LintId::of(methods::ITERATOR_STEP_BY_ZERO),
|
||||
LintId::of(methods::NONSENSICAL_OPEN_OPTIONS),
|
||||
LintId::of(methods::SUSPICIOUS_SPLITN),
|
||||
LintId::of(methods::UNINIT_ASSUMED_INIT),
|
||||
LintId::of(methods::UNIT_HASH),
|
||||
LintId::of(methods::VEC_RESIZE_TO_ZERO),
|
||||
LintId::of(methods::ZST_OFFSET),
|
||||
LintId::of(minmax::MIN_MAX),
|
||||
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
|
||||
LintId::of(operators::ABSURD_EXTREME_COMPARISONS),
|
||||
LintId::of(operators::BAD_BIT_MASK),
|
||||
LintId::of(operators::CMP_NAN),
|
||||
LintId::of(operators::EQ_OP),
|
||||
LintId::of(operators::ERASING_OP),
|
||||
LintId::of(operators::INEFFECTIVE_BIT_MASK),
|
||||
LintId::of(operators::MODULO_ONE),
|
||||
LintId::of(operators::SELF_ASSIGNMENT),
|
||||
LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP),
|
||||
LintId::of(ptr::INVALID_NULL_PTR_USAGE),
|
||||
LintId::of(ptr::MUT_FROM_REF),
|
||||
LintId::of(ranges::REVERSED_EMPTY_RANGES),
|
||||
LintId::of(read_zero_byte_vec::READ_ZERO_BYTE_VEC),
|
||||
LintId::of(regex::INVALID_REGEX),
|
||||
LintId::of(serde_api::SERDE_API_MISUSE),
|
||||
LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
|
||||
LintId::of(swap::ALMOST_SWAPPED),
|
||||
LintId::of(transmute::TRANSMUTING_NULL),
|
||||
LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE),
|
||||
LintId::of(transmute::WRONG_TRANSMUTE),
|
||||
LintId::of(unicode::INVISIBLE_CHARACTERS),
|
||||
LintId::of(uninit_vec::UNINIT_VEC),
|
||||
LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
|
||||
LintId::of(unit_types::UNIT_CMP),
|
||||
LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS),
|
||||
LintId::of(unnamed_address::VTABLE_ADDRESS_COMPARISONS),
|
||||
LintId::of(unused_io_amount::UNUSED_IO_AMOUNT),
|
||||
LintId::of(unwrap::PANICKING_UNWRAP),
|
||||
])
|
|
@ -1,22 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![
|
||||
LintId::of(utils::internal_lints::clippy_lints_internal::CLIPPY_LINTS_INTERNAL),
|
||||
LintId::of(utils::internal_lints::collapsible_calls::COLLAPSIBLE_SPAN_LINT_CALLS),
|
||||
LintId::of(utils::internal_lints::compiler_lint_functions::COMPILER_LINT_FUNCTIONS),
|
||||
LintId::of(utils::internal_lints::if_chain_style::IF_CHAIN_STYLE),
|
||||
LintId::of(utils::internal_lints::interning_defined_symbol::INTERNING_DEFINED_SYMBOL),
|
||||
LintId::of(utils::internal_lints::interning_defined_symbol::UNNECESSARY_SYMBOL_STR),
|
||||
LintId::of(utils::internal_lints::invalid_paths::INVALID_PATHS),
|
||||
LintId::of(utils::internal_lints::lint_without_lint_pass::DEFAULT_DEPRECATION_REASON),
|
||||
LintId::of(utils::internal_lints::lint_without_lint_pass::DEFAULT_LINT),
|
||||
LintId::of(utils::internal_lints::lint_without_lint_pass::INVALID_CLIPPY_VERSION_ATTRIBUTE),
|
||||
LintId::of(utils::internal_lints::lint_without_lint_pass::LINT_WITHOUT_LINT_PASS),
|
||||
LintId::of(utils::internal_lints::lint_without_lint_pass::MISSING_CLIPPY_VERSION_ATTRIBUTE),
|
||||
LintId::of(utils::internal_lints::msrv_attr_impl::MISSING_MSRV_ATTR_IMPL),
|
||||
LintId::of(utils::internal_lints::outer_expn_data_pass::OUTER_EXPN_EXPN_DATA),
|
||||
LintId::of(utils::internal_lints::produce_ice::PRODUCE_ICE),
|
||||
LintId::of(utils::internal_lints::unnecessary_def_path::UNNECESSARY_DEF_PATH),
|
||||
])
|
|
@ -1,620 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_lints(&[
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::clippy_lints_internal::CLIPPY_LINTS_INTERNAL,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::collapsible_calls::COLLAPSIBLE_SPAN_LINT_CALLS,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::compiler_lint_functions::COMPILER_LINT_FUNCTIONS,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::if_chain_style::IF_CHAIN_STYLE,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::interning_defined_symbol::INTERNING_DEFINED_SYMBOL,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::interning_defined_symbol::UNNECESSARY_SYMBOL_STR,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::invalid_paths::INVALID_PATHS,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::lint_without_lint_pass::DEFAULT_DEPRECATION_REASON,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::lint_without_lint_pass::DEFAULT_LINT,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::lint_without_lint_pass::INVALID_CLIPPY_VERSION_ATTRIBUTE,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::lint_without_lint_pass::LINT_WITHOUT_LINT_PASS,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::lint_without_lint_pass::MISSING_CLIPPY_VERSION_ATTRIBUTE,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::msrv_attr_impl::MISSING_MSRV_ATTR_IMPL,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::outer_expn_data_pass::OUTER_EXPN_EXPN_DATA,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::produce_ice::PRODUCE_ICE,
|
||||
#[cfg(feature = "internal")]
|
||||
utils::internal_lints::unnecessary_def_path::UNNECESSARY_DEF_PATH,
|
||||
almost_complete_letter_range::ALMOST_COMPLETE_LETTER_RANGE,
|
||||
approx_const::APPROX_CONSTANT,
|
||||
as_conversions::AS_CONVERSIONS,
|
||||
asm_syntax::INLINE_ASM_X86_ATT_SYNTAX,
|
||||
asm_syntax::INLINE_ASM_X86_INTEL_SYNTAX,
|
||||
assertions_on_constants::ASSERTIONS_ON_CONSTANTS,
|
||||
assertions_on_result_states::ASSERTIONS_ON_RESULT_STATES,
|
||||
async_yields_async::ASYNC_YIELDS_ASYNC,
|
||||
attrs::ALLOW_ATTRIBUTES_WITHOUT_REASON,
|
||||
attrs::BLANKET_CLIPPY_RESTRICTION_LINTS,
|
||||
attrs::DEPRECATED_CFG_ATTR,
|
||||
attrs::DEPRECATED_SEMVER,
|
||||
attrs::EMPTY_LINE_AFTER_OUTER_ATTR,
|
||||
attrs::INLINE_ALWAYS,
|
||||
attrs::MISMATCHED_TARGET_OS,
|
||||
attrs::USELESS_ATTRIBUTE,
|
||||
await_holding_invalid::AWAIT_HOLDING_INVALID_TYPE,
|
||||
await_holding_invalid::AWAIT_HOLDING_LOCK,
|
||||
await_holding_invalid::AWAIT_HOLDING_REFCELL_REF,
|
||||
blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS,
|
||||
bool_assert_comparison::BOOL_ASSERT_COMPARISON,
|
||||
bool_to_int_with_if::BOOL_TO_INT_WITH_IF,
|
||||
booleans::NONMINIMAL_BOOL,
|
||||
booleans::OVERLY_COMPLEX_BOOL_EXPR,
|
||||
borrow_deref_ref::BORROW_DEREF_REF,
|
||||
box_default::BOX_DEFAULT,
|
||||
cargo::CARGO_COMMON_METADATA,
|
||||
cargo::MULTIPLE_CRATE_VERSIONS,
|
||||
cargo::NEGATIVE_FEATURE_NAMES,
|
||||
cargo::REDUNDANT_FEATURE_NAMES,
|
||||
cargo::WILDCARD_DEPENDENCIES,
|
||||
casts::AS_PTR_CAST_MUT,
|
||||
casts::AS_UNDERSCORE,
|
||||
casts::BORROW_AS_PTR,
|
||||
casts::CAST_ABS_TO_UNSIGNED,
|
||||
casts::CAST_ENUM_CONSTRUCTOR,
|
||||
casts::CAST_ENUM_TRUNCATION,
|
||||
casts::CAST_LOSSLESS,
|
||||
casts::CAST_NAN_TO_INT,
|
||||
casts::CAST_POSSIBLE_TRUNCATION,
|
||||
casts::CAST_POSSIBLE_WRAP,
|
||||
casts::CAST_PRECISION_LOSS,
|
||||
casts::CAST_PTR_ALIGNMENT,
|
||||
casts::CAST_REF_TO_MUT,
|
||||
casts::CAST_SIGN_LOSS,
|
||||
casts::CAST_SLICE_DIFFERENT_SIZES,
|
||||
casts::CAST_SLICE_FROM_RAW_PARTS,
|
||||
casts::CHAR_LIT_AS_U8,
|
||||
casts::FN_TO_NUMERIC_CAST,
|
||||
casts::FN_TO_NUMERIC_CAST_ANY,
|
||||
casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION,
|
||||
casts::PTR_AS_PTR,
|
||||
casts::UNNECESSARY_CAST,
|
||||
checked_conversions::CHECKED_CONVERSIONS,
|
||||
cognitive_complexity::COGNITIVE_COMPLEXITY,
|
||||
collapsible_if::COLLAPSIBLE_ELSE_IF,
|
||||
collapsible_if::COLLAPSIBLE_IF,
|
||||
comparison_chain::COMPARISON_CHAIN,
|
||||
copies::BRANCHES_SHARING_CODE,
|
||||
copies::IFS_SAME_COND,
|
||||
copies::IF_SAME_THEN_ELSE,
|
||||
copies::SAME_FUNCTIONS_IN_IF_CONDITION,
|
||||
copy_iterator::COPY_ITERATOR,
|
||||
crate_in_macro_def::CRATE_IN_MACRO_DEF,
|
||||
create_dir::CREATE_DIR,
|
||||
dbg_macro::DBG_MACRO,
|
||||
default::DEFAULT_TRAIT_ACCESS,
|
||||
default::FIELD_REASSIGN_WITH_DEFAULT,
|
||||
default_instead_of_iter_empty::DEFAULT_INSTEAD_OF_ITER_EMPTY,
|
||||
default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK,
|
||||
default_union_representation::DEFAULT_UNION_REPRESENTATION,
|
||||
dereference::EXPLICIT_AUTO_DEREF,
|
||||
dereference::EXPLICIT_DEREF_METHODS,
|
||||
dereference::NEEDLESS_BORROW,
|
||||
dereference::REF_BINDING_TO_REFERENCE,
|
||||
derivable_impls::DERIVABLE_IMPLS,
|
||||
derive::DERIVE_HASH_XOR_EQ,
|
||||
derive::DERIVE_ORD_XOR_PARTIAL_ORD,
|
||||
derive::DERIVE_PARTIAL_EQ_WITHOUT_EQ,
|
||||
derive::EXPL_IMPL_CLONE_ON_COPY,
|
||||
derive::UNSAFE_DERIVE_DESERIALIZE,
|
||||
disallowed_macros::DISALLOWED_MACROS,
|
||||
disallowed_methods::DISALLOWED_METHODS,
|
||||
disallowed_names::DISALLOWED_NAMES,
|
||||
disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS,
|
||||
disallowed_types::DISALLOWED_TYPES,
|
||||
doc::DOC_LINK_WITH_QUOTES,
|
||||
doc::DOC_MARKDOWN,
|
||||
doc::MISSING_ERRORS_DOC,
|
||||
doc::MISSING_PANICS_DOC,
|
||||
doc::MISSING_SAFETY_DOC,
|
||||
doc::NEEDLESS_DOCTEST_MAIN,
|
||||
double_parens::DOUBLE_PARENS,
|
||||
drop_forget_ref::DROP_COPY,
|
||||
drop_forget_ref::DROP_NON_DROP,
|
||||
drop_forget_ref::DROP_REF,
|
||||
drop_forget_ref::FORGET_COPY,
|
||||
drop_forget_ref::FORGET_NON_DROP,
|
||||
drop_forget_ref::FORGET_REF,
|
||||
drop_forget_ref::UNDROPPED_MANUALLY_DROPS,
|
||||
duplicate_mod::DUPLICATE_MOD,
|
||||
else_if_without_else::ELSE_IF_WITHOUT_ELSE,
|
||||
empty_drop::EMPTY_DROP,
|
||||
empty_enum::EMPTY_ENUM,
|
||||
empty_structs_with_brackets::EMPTY_STRUCTS_WITH_BRACKETS,
|
||||
entry::MAP_ENTRY,
|
||||
enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT,
|
||||
enum_variants::ENUM_VARIANT_NAMES,
|
||||
enum_variants::MODULE_INCEPTION,
|
||||
enum_variants::MODULE_NAME_REPETITIONS,
|
||||
equatable_if_let::EQUATABLE_IF_LET,
|
||||
escape::BOXED_LOCAL,
|
||||
eta_reduction::REDUNDANT_CLOSURE,
|
||||
eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS,
|
||||
excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS,
|
||||
excessive_bools::STRUCT_EXCESSIVE_BOOLS,
|
||||
exhaustive_items::EXHAUSTIVE_ENUMS,
|
||||
exhaustive_items::EXHAUSTIVE_STRUCTS,
|
||||
exit::EXIT,
|
||||
explicit_write::EXPLICIT_WRITE,
|
||||
fallible_impl_from::FALLIBLE_IMPL_FROM,
|
||||
float_literal::EXCESSIVE_PRECISION,
|
||||
float_literal::LOSSY_FLOAT_LITERAL,
|
||||
floating_point_arithmetic::IMPRECISE_FLOPS,
|
||||
floating_point_arithmetic::SUBOPTIMAL_FLOPS,
|
||||
format::USELESS_FORMAT,
|
||||
format_args::FORMAT_IN_FORMAT_ARGS,
|
||||
format_args::TO_STRING_IN_FORMAT_ARGS,
|
||||
format_args::UNINLINED_FORMAT_ARGS,
|
||||
format_args::UNUSED_FORMAT_SPECS,
|
||||
format_impl::PRINT_IN_FORMAT_IMPL,
|
||||
format_impl::RECURSIVE_FORMAT_IMPL,
|
||||
format_push_string::FORMAT_PUSH_STRING,
|
||||
formatting::POSSIBLE_MISSING_COMMA,
|
||||
formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING,
|
||||
formatting::SUSPICIOUS_ELSE_FORMATTING,
|
||||
formatting::SUSPICIOUS_UNARY_OP_FORMATTING,
|
||||
from_over_into::FROM_OVER_INTO,
|
||||
from_raw_with_void_ptr::FROM_RAW_WITH_VOID_PTR,
|
||||
from_str_radix_10::FROM_STR_RADIX_10,
|
||||
functions::DOUBLE_MUST_USE,
|
||||
functions::MUST_USE_CANDIDATE,
|
||||
functions::MUST_USE_UNIT,
|
||||
functions::NOT_UNSAFE_PTR_ARG_DEREF,
|
||||
functions::RESULT_LARGE_ERR,
|
||||
functions::RESULT_UNIT_ERR,
|
||||
functions::TOO_MANY_ARGUMENTS,
|
||||
functions::TOO_MANY_LINES,
|
||||
future_not_send::FUTURE_NOT_SEND,
|
||||
if_let_mutex::IF_LET_MUTEX,
|
||||
if_not_else::IF_NOT_ELSE,
|
||||
if_then_some_else_none::IF_THEN_SOME_ELSE_NONE,
|
||||
implicit_hasher::IMPLICIT_HASHER,
|
||||
implicit_return::IMPLICIT_RETURN,
|
||||
implicit_saturating_add::IMPLICIT_SATURATING_ADD,
|
||||
implicit_saturating_sub::IMPLICIT_SATURATING_SUB,
|
||||
inconsistent_struct_constructor::INCONSISTENT_STRUCT_CONSTRUCTOR,
|
||||
index_refutable_slice::INDEX_REFUTABLE_SLICE,
|
||||
indexing_slicing::INDEXING_SLICING,
|
||||
indexing_slicing::OUT_OF_BOUNDS_INDEXING,
|
||||
infinite_iter::INFINITE_ITER,
|
||||
infinite_iter::MAYBE_INFINITE_ITER,
|
||||
inherent_impl::MULTIPLE_INHERENT_IMPL,
|
||||
inherent_to_string::INHERENT_TO_STRING,
|
||||
inherent_to_string::INHERENT_TO_STRING_SHADOW_DISPLAY,
|
||||
init_numbered_fields::INIT_NUMBERED_FIELDS,
|
||||
inline_fn_without_body::INLINE_FN_WITHOUT_BODY,
|
||||
int_plus_one::INT_PLUS_ONE,
|
||||
invalid_upcast_comparisons::INVALID_UPCAST_COMPARISONS,
|
||||
invalid_utf8_in_unchecked::INVALID_UTF8_IN_UNCHECKED,
|
||||
items_after_statements::ITEMS_AFTER_STATEMENTS,
|
||||
iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR,
|
||||
large_const_arrays::LARGE_CONST_ARRAYS,
|
||||
large_enum_variant::LARGE_ENUM_VARIANT,
|
||||
large_include_file::LARGE_INCLUDE_FILE,
|
||||
large_stack_arrays::LARGE_STACK_ARRAYS,
|
||||
len_zero::COMPARISON_TO_EMPTY,
|
||||
len_zero::LEN_WITHOUT_IS_EMPTY,
|
||||
len_zero::LEN_ZERO,
|
||||
let_if_seq::USELESS_LET_IF_SEQ,
|
||||
let_underscore::LET_UNDERSCORE_LOCK,
|
||||
let_underscore::LET_UNDERSCORE_MUST_USE,
|
||||
lifetimes::EXTRA_UNUSED_LIFETIMES,
|
||||
lifetimes::NEEDLESS_LIFETIMES,
|
||||
literal_representation::DECIMAL_LITERAL_REPRESENTATION,
|
||||
literal_representation::INCONSISTENT_DIGIT_GROUPING,
|
||||
literal_representation::LARGE_DIGIT_GROUPS,
|
||||
literal_representation::MISTYPED_LITERAL_SUFFIXES,
|
||||
literal_representation::UNREADABLE_LITERAL,
|
||||
literal_representation::UNUSUAL_BYTE_GROUPINGS,
|
||||
loops::EMPTY_LOOP,
|
||||
loops::EXPLICIT_COUNTER_LOOP,
|
||||
loops::EXPLICIT_INTO_ITER_LOOP,
|
||||
loops::EXPLICIT_ITER_LOOP,
|
||||
loops::FOR_KV_MAP,
|
||||
loops::ITER_NEXT_LOOP,
|
||||
loops::MANUAL_FIND,
|
||||
loops::MANUAL_FLATTEN,
|
||||
loops::MANUAL_MEMCPY,
|
||||
loops::MISSING_SPIN_LOOP,
|
||||
loops::MUT_RANGE_BOUND,
|
||||
loops::NEEDLESS_COLLECT,
|
||||
loops::NEEDLESS_RANGE_LOOP,
|
||||
loops::NEVER_LOOP,
|
||||
loops::SAME_ITEM_PUSH,
|
||||
loops::SINGLE_ELEMENT_LOOP,
|
||||
loops::WHILE_IMMUTABLE_CONDITION,
|
||||
loops::WHILE_LET_LOOP,
|
||||
loops::WHILE_LET_ON_ITERATOR,
|
||||
macro_use::MACRO_USE_IMPORTS,
|
||||
main_recursion::MAIN_RECURSION,
|
||||
manual_assert::MANUAL_ASSERT,
|
||||
manual_async_fn::MANUAL_ASYNC_FN,
|
||||
manual_bits::MANUAL_BITS,
|
||||
manual_clamp::MANUAL_CLAMP,
|
||||
manual_instant_elapsed::MANUAL_INSTANT_ELAPSED,
|
||||
manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE,
|
||||
manual_rem_euclid::MANUAL_REM_EUCLID,
|
||||
manual_retain::MANUAL_RETAIN,
|
||||
manual_string_new::MANUAL_STRING_NEW,
|
||||
manual_strip::MANUAL_STRIP,
|
||||
map_unit_fn::OPTION_MAP_UNIT_FN,
|
||||
map_unit_fn::RESULT_MAP_UNIT_FN,
|
||||
match_result_ok::MATCH_RESULT_OK,
|
||||
matches::COLLAPSIBLE_MATCH,
|
||||
matches::INFALLIBLE_DESTRUCTURING_MATCH,
|
||||
matches::MANUAL_FILTER,
|
||||
matches::MANUAL_MAP,
|
||||
matches::MANUAL_UNWRAP_OR,
|
||||
matches::MATCH_AS_REF,
|
||||
matches::MATCH_BOOL,
|
||||
matches::MATCH_LIKE_MATCHES_MACRO,
|
||||
matches::MATCH_ON_VEC_ITEMS,
|
||||
matches::MATCH_OVERLAPPING_ARM,
|
||||
matches::MATCH_REF_PATS,
|
||||
matches::MATCH_SAME_ARMS,
|
||||
matches::MATCH_SINGLE_BINDING,
|
||||
matches::MATCH_STR_CASE_MISMATCH,
|
||||
matches::MATCH_WILDCARD_FOR_SINGLE_VARIANTS,
|
||||
matches::MATCH_WILD_ERR_ARM,
|
||||
matches::NEEDLESS_MATCH,
|
||||
matches::REDUNDANT_PATTERN_MATCHING,
|
||||
matches::REST_PAT_IN_FULLY_BOUND_STRUCTS,
|
||||
matches::SIGNIFICANT_DROP_IN_SCRUTINEE,
|
||||
matches::SINGLE_MATCH,
|
||||
matches::SINGLE_MATCH_ELSE,
|
||||
matches::TRY_ERR,
|
||||
matches::WILDCARD_ENUM_MATCH_ARM,
|
||||
matches::WILDCARD_IN_OR_PATTERNS,
|
||||
mem_forget::MEM_FORGET,
|
||||
mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
|
||||
mem_replace::MEM_REPLACE_WITH_DEFAULT,
|
||||
mem_replace::MEM_REPLACE_WITH_UNINIT,
|
||||
methods::BIND_INSTEAD_OF_MAP,
|
||||
methods::BYTES_COUNT_TO_LEN,
|
||||
methods::BYTES_NTH,
|
||||
methods::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
|
||||
methods::CHARS_LAST_CMP,
|
||||
methods::CHARS_NEXT_CMP,
|
||||
methods::CLONED_INSTEAD_OF_COPIED,
|
||||
methods::CLONE_DOUBLE_REF,
|
||||
methods::CLONE_ON_COPY,
|
||||
methods::CLONE_ON_REF_PTR,
|
||||
methods::COLLAPSIBLE_STR_REPLACE,
|
||||
methods::ERR_EXPECT,
|
||||
methods::EXPECT_FUN_CALL,
|
||||
methods::EXPECT_USED,
|
||||
methods::EXTEND_WITH_DRAIN,
|
||||
methods::FILETYPE_IS_FILE,
|
||||
methods::FILTER_MAP_IDENTITY,
|
||||
methods::FILTER_MAP_NEXT,
|
||||
methods::FILTER_NEXT,
|
||||
methods::FLAT_MAP_IDENTITY,
|
||||
methods::FLAT_MAP_OPTION,
|
||||
methods::FROM_ITER_INSTEAD_OF_COLLECT,
|
||||
methods::GET_FIRST,
|
||||
methods::GET_LAST_WITH_LEN,
|
||||
methods::GET_UNWRAP,
|
||||
methods::IMPLICIT_CLONE,
|
||||
methods::INEFFICIENT_TO_STRING,
|
||||
methods::INSPECT_FOR_EACH,
|
||||
methods::INTO_ITER_ON_REF,
|
||||
methods::IS_DIGIT_ASCII_RADIX,
|
||||
methods::ITERATOR_STEP_BY_ZERO,
|
||||
methods::ITER_CLONED_COLLECT,
|
||||
methods::ITER_COUNT,
|
||||
methods::ITER_KV_MAP,
|
||||
methods::ITER_NEXT_SLICE,
|
||||
methods::ITER_NTH,
|
||||
methods::ITER_NTH_ZERO,
|
||||
methods::ITER_ON_EMPTY_COLLECTIONS,
|
||||
methods::ITER_ON_SINGLE_ITEMS,
|
||||
methods::ITER_OVEREAGER_CLONED,
|
||||
methods::ITER_SKIP_NEXT,
|
||||
methods::ITER_WITH_DRAIN,
|
||||
methods::MANUAL_FILTER_MAP,
|
||||
methods::MANUAL_FIND_MAP,
|
||||
methods::MANUAL_OK_OR,
|
||||
methods::MANUAL_SATURATING_ARITHMETIC,
|
||||
methods::MANUAL_SPLIT_ONCE,
|
||||
methods::MANUAL_STR_REPEAT,
|
||||
methods::MAP_CLONE,
|
||||
methods::MAP_COLLECT_RESULT_UNIT,
|
||||
methods::MAP_ERR_IGNORE,
|
||||
methods::MAP_FLATTEN,
|
||||
methods::MAP_IDENTITY,
|
||||
methods::MAP_UNWRAP_OR,
|
||||
methods::MUT_MUTEX_LOCK,
|
||||
methods::NAIVE_BYTECOUNT,
|
||||
methods::NEEDLESS_OPTION_AS_DEREF,
|
||||
methods::NEEDLESS_OPTION_TAKE,
|
||||
methods::NEEDLESS_SPLITN,
|
||||
methods::NEW_RET_NO_SELF,
|
||||
methods::NONSENSICAL_OPEN_OPTIONS,
|
||||
methods::NO_EFFECT_REPLACE,
|
||||
methods::OBFUSCATED_IF_ELSE,
|
||||
methods::OK_EXPECT,
|
||||
methods::OPTION_AS_REF_DEREF,
|
||||
methods::OPTION_FILTER_MAP,
|
||||
methods::OPTION_MAP_OR_NONE,
|
||||
methods::OR_FUN_CALL,
|
||||
methods::OR_THEN_UNWRAP,
|
||||
methods::PATH_BUF_PUSH_OVERWRITE,
|
||||
methods::RANGE_ZIP_WITH_LEN,
|
||||
methods::REPEAT_ONCE,
|
||||
methods::RESULT_MAP_OR_INTO_OPTION,
|
||||
methods::SEARCH_IS_SOME,
|
||||
methods::SHOULD_IMPLEMENT_TRAIT,
|
||||
methods::SINGLE_CHAR_ADD_STR,
|
||||
methods::SINGLE_CHAR_PATTERN,
|
||||
methods::SKIP_WHILE_NEXT,
|
||||
methods::STABLE_SORT_PRIMITIVE,
|
||||
methods::STRING_EXTEND_CHARS,
|
||||
methods::SUSPICIOUS_MAP,
|
||||
methods::SUSPICIOUS_SPLITN,
|
||||
methods::SUSPICIOUS_TO_OWNED,
|
||||
methods::UNINIT_ASSUMED_INIT,
|
||||
methods::UNIT_HASH,
|
||||
methods::UNNECESSARY_FILTER_MAP,
|
||||
methods::UNNECESSARY_FIND_MAP,
|
||||
methods::UNNECESSARY_FOLD,
|
||||
methods::UNNECESSARY_JOIN,
|
||||
methods::UNNECESSARY_LAZY_EVALUATIONS,
|
||||
methods::UNNECESSARY_SORT_BY,
|
||||
methods::UNNECESSARY_TO_OWNED,
|
||||
methods::UNWRAP_OR_ELSE_DEFAULT,
|
||||
methods::UNWRAP_USED,
|
||||
methods::USELESS_ASREF,
|
||||
methods::VEC_RESIZE_TO_ZERO,
|
||||
methods::VERBOSE_FILE_READS,
|
||||
methods::WRONG_SELF_CONVENTION,
|
||||
methods::ZST_OFFSET,
|
||||
minmax::MIN_MAX,
|
||||
misc::SHORT_CIRCUIT_STATEMENT,
|
||||
misc::TOPLEVEL_REF_ARG,
|
||||
misc::USED_UNDERSCORE_BINDING,
|
||||
misc::ZERO_PTR,
|
||||
misc_early::BUILTIN_TYPE_SHADOW,
|
||||
misc_early::DOUBLE_NEG,
|
||||
misc_early::DUPLICATE_UNDERSCORE_ARGUMENT,
|
||||
misc_early::MIXED_CASE_HEX_LITERALS,
|
||||
misc_early::REDUNDANT_PATTERN,
|
||||
misc_early::SEPARATED_LITERAL_SUFFIX,
|
||||
misc_early::UNNEEDED_FIELD_PATTERN,
|
||||
misc_early::UNNEEDED_WILDCARD_PATTERN,
|
||||
misc_early::UNSEPARATED_LITERAL_SUFFIX,
|
||||
misc_early::ZERO_PREFIXED_LITERAL,
|
||||
mismatching_type_param_order::MISMATCHING_TYPE_PARAM_ORDER,
|
||||
missing_const_for_fn::MISSING_CONST_FOR_FN,
|
||||
missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
|
||||
missing_enforced_import_rename::MISSING_ENFORCED_IMPORT_RENAMES,
|
||||
missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
|
||||
missing_trait_methods::MISSING_TRAIT_METHODS,
|
||||
mixed_read_write_in_expression::DIVERGING_SUB_EXPRESSION,
|
||||
mixed_read_write_in_expression::MIXED_READ_WRITE_IN_EXPRESSION,
|
||||
module_style::MOD_MODULE_FILES,
|
||||
module_style::SELF_NAMED_MODULE_FILES,
|
||||
multi_assignments::MULTI_ASSIGNMENTS,
|
||||
mut_key::MUTABLE_KEY_TYPE,
|
||||
mut_mut::MUT_MUT,
|
||||
mut_reference::UNNECESSARY_MUT_PASSED,
|
||||
mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL,
|
||||
mutex_atomic::MUTEX_ATOMIC,
|
||||
mutex_atomic::MUTEX_INTEGER,
|
||||
needless_arbitrary_self_type::NEEDLESS_ARBITRARY_SELF_TYPE,
|
||||
needless_bool::BOOL_COMPARISON,
|
||||
needless_bool::NEEDLESS_BOOL,
|
||||
needless_borrowed_ref::NEEDLESS_BORROWED_REFERENCE,
|
||||
needless_continue::NEEDLESS_CONTINUE,
|
||||
needless_for_each::NEEDLESS_FOR_EACH,
|
||||
needless_late_init::NEEDLESS_LATE_INIT,
|
||||
needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS,
|
||||
needless_pass_by_value::NEEDLESS_PASS_BY_VALUE,
|
||||
needless_question_mark::NEEDLESS_QUESTION_MARK,
|
||||
needless_update::NEEDLESS_UPDATE,
|
||||
neg_cmp_op_on_partial_ord::NEG_CMP_OP_ON_PARTIAL_ORD,
|
||||
neg_multiply::NEG_MULTIPLY,
|
||||
new_without_default::NEW_WITHOUT_DEFAULT,
|
||||
no_effect::NO_EFFECT,
|
||||
no_effect::NO_EFFECT_UNDERSCORE_BINDING,
|
||||
no_effect::UNNECESSARY_OPERATION,
|
||||
non_copy_const::BORROW_INTERIOR_MUTABLE_CONST,
|
||||
non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST,
|
||||
non_expressive_names::JUST_UNDERSCORES_AND_DIGITS,
|
||||
non_expressive_names::MANY_SINGLE_CHAR_NAMES,
|
||||
non_expressive_names::SIMILAR_NAMES,
|
||||
non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS,
|
||||
non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY,
|
||||
nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES,
|
||||
octal_escapes::OCTAL_ESCAPES,
|
||||
only_used_in_recursion::ONLY_USED_IN_RECURSION,
|
||||
operators::ABSURD_EXTREME_COMPARISONS,
|
||||
operators::ARITHMETIC_SIDE_EFFECTS,
|
||||
operators::ASSIGN_OP_PATTERN,
|
||||
operators::BAD_BIT_MASK,
|
||||
operators::CMP_NAN,
|
||||
operators::CMP_OWNED,
|
||||
operators::DOUBLE_COMPARISONS,
|
||||
operators::DURATION_SUBSEC,
|
||||
operators::EQ_OP,
|
||||
operators::ERASING_OP,
|
||||
operators::FLOAT_ARITHMETIC,
|
||||
operators::FLOAT_CMP,
|
||||
operators::FLOAT_CMP_CONST,
|
||||
operators::FLOAT_EQUALITY_WITHOUT_ABS,
|
||||
operators::IDENTITY_OP,
|
||||
operators::INEFFECTIVE_BIT_MASK,
|
||||
operators::INTEGER_ARITHMETIC,
|
||||
operators::INTEGER_DIVISION,
|
||||
operators::MISREFACTORED_ASSIGN_OP,
|
||||
operators::MODULO_ARITHMETIC,
|
||||
operators::MODULO_ONE,
|
||||
operators::NEEDLESS_BITWISE_BOOL,
|
||||
operators::OP_REF,
|
||||
operators::PTR_EQ,
|
||||
operators::SELF_ASSIGNMENT,
|
||||
operators::VERBOSE_BIT_MASK,
|
||||
option_env_unwrap::OPTION_ENV_UNWRAP,
|
||||
option_if_let_else::OPTION_IF_LET_ELSE,
|
||||
overflow_check_conditional::OVERFLOW_CHECK_CONDITIONAL,
|
||||
panic_in_result_fn::PANIC_IN_RESULT_FN,
|
||||
panic_unimplemented::PANIC,
|
||||
panic_unimplemented::TODO,
|
||||
panic_unimplemented::UNIMPLEMENTED,
|
||||
panic_unimplemented::UNREACHABLE,
|
||||
partial_pub_fields::PARTIAL_PUB_FIELDS,
|
||||
partialeq_ne_impl::PARTIALEQ_NE_IMPL,
|
||||
partialeq_to_none::PARTIALEQ_TO_NONE,
|
||||
pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE,
|
||||
pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF,
|
||||
pattern_type_mismatch::PATTERN_TYPE_MISMATCH,
|
||||
precedence::PRECEDENCE,
|
||||
ptr::CMP_NULL,
|
||||
ptr::INVALID_NULL_PTR_USAGE,
|
||||
ptr::MUT_FROM_REF,
|
||||
ptr::PTR_ARG,
|
||||
ptr_offset_with_cast::PTR_OFFSET_WITH_CAST,
|
||||
pub_use::PUB_USE,
|
||||
question_mark::QUESTION_MARK,
|
||||
ranges::MANUAL_RANGE_CONTAINS,
|
||||
ranges::RANGE_MINUS_ONE,
|
||||
ranges::RANGE_PLUS_ONE,
|
||||
ranges::REVERSED_EMPTY_RANGES,
|
||||
rc_clone_in_vec_init::RC_CLONE_IN_VEC_INIT,
|
||||
read_zero_byte_vec::READ_ZERO_BYTE_VEC,
|
||||
redundant_clone::REDUNDANT_CLONE,
|
||||
redundant_closure_call::REDUNDANT_CLOSURE_CALL,
|
||||
redundant_else::REDUNDANT_ELSE,
|
||||
redundant_field_names::REDUNDANT_FIELD_NAMES,
|
||||
redundant_pub_crate::REDUNDANT_PUB_CRATE,
|
||||
redundant_slicing::DEREF_BY_SLICING,
|
||||
redundant_slicing::REDUNDANT_SLICING,
|
||||
redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
|
||||
ref_option_ref::REF_OPTION_REF,
|
||||
reference::DEREF_ADDROF,
|
||||
regex::INVALID_REGEX,
|
||||
regex::TRIVIAL_REGEX,
|
||||
return_self_not_must_use::RETURN_SELF_NOT_MUST_USE,
|
||||
returns::LET_AND_RETURN,
|
||||
returns::NEEDLESS_RETURN,
|
||||
same_name_method::SAME_NAME_METHOD,
|
||||
self_named_constructors::SELF_NAMED_CONSTRUCTORS,
|
||||
semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED,
|
||||
serde_api::SERDE_API_MISUSE,
|
||||
shadow::SHADOW_REUSE,
|
||||
shadow::SHADOW_SAME,
|
||||
shadow::SHADOW_UNRELATED,
|
||||
single_char_lifetime_names::SINGLE_CHAR_LIFETIME_NAMES,
|
||||
single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS,
|
||||
size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT,
|
||||
slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
|
||||
std_instead_of_core::ALLOC_INSTEAD_OF_CORE,
|
||||
std_instead_of_core::STD_INSTEAD_OF_ALLOC,
|
||||
std_instead_of_core::STD_INSTEAD_OF_CORE,
|
||||
strings::STRING_ADD,
|
||||
strings::STRING_ADD_ASSIGN,
|
||||
strings::STRING_FROM_UTF8_AS_BYTES,
|
||||
strings::STRING_LIT_AS_BYTES,
|
||||
strings::STRING_SLICE,
|
||||
strings::STRING_TO_STRING,
|
||||
strings::STR_TO_STRING,
|
||||
strings::TRIM_SPLIT_WHITESPACE,
|
||||
strlen_on_c_strings::STRLEN_ON_C_STRINGS,
|
||||
suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS,
|
||||
suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL,
|
||||
suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL,
|
||||
swap::ALMOST_SWAPPED,
|
||||
swap::MANUAL_SWAP,
|
||||
swap_ptr_to_ref::SWAP_PTR_TO_REF,
|
||||
tabs_in_doc_comments::TABS_IN_DOC_COMMENTS,
|
||||
temporary_assignment::TEMPORARY_ASSIGNMENT,
|
||||
to_digit_is_some::TO_DIGIT_IS_SOME,
|
||||
trailing_empty_array::TRAILING_EMPTY_ARRAY,
|
||||
trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS,
|
||||
trait_bounds::TYPE_REPETITION_IN_BOUNDS,
|
||||
transmute::CROSSPOINTER_TRANSMUTE,
|
||||
transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS,
|
||||
transmute::TRANSMUTE_BYTES_TO_STR,
|
||||
transmute::TRANSMUTE_FLOAT_TO_INT,
|
||||
transmute::TRANSMUTE_INT_TO_BOOL,
|
||||
transmute::TRANSMUTE_INT_TO_CHAR,
|
||||
transmute::TRANSMUTE_INT_TO_FLOAT,
|
||||
transmute::TRANSMUTE_NUM_TO_BYTES,
|
||||
transmute::TRANSMUTE_PTR_TO_PTR,
|
||||
transmute::TRANSMUTE_PTR_TO_REF,
|
||||
transmute::TRANSMUTE_UNDEFINED_REPR,
|
||||
transmute::TRANSMUTING_NULL,
|
||||
transmute::UNSOUND_COLLECTION_TRANSMUTE,
|
||||
transmute::USELESS_TRANSMUTE,
|
||||
transmute::WRONG_TRANSMUTE,
|
||||
types::BORROWED_BOX,
|
||||
types::BOX_COLLECTION,
|
||||
types::LINKEDLIST,
|
||||
types::OPTION_OPTION,
|
||||
types::RC_BUFFER,
|
||||
types::RC_MUTEX,
|
||||
types::REDUNDANT_ALLOCATION,
|
||||
types::TYPE_COMPLEXITY,
|
||||
types::VEC_BOX,
|
||||
undocumented_unsafe_blocks::UNDOCUMENTED_UNSAFE_BLOCKS,
|
||||
unicode::INVISIBLE_CHARACTERS,
|
||||
unicode::NON_ASCII_LITERAL,
|
||||
unicode::UNICODE_NOT_NFC,
|
||||
uninit_vec::UNINIT_VEC,
|
||||
unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD,
|
||||
unit_types::LET_UNIT_VALUE,
|
||||
unit_types::UNIT_ARG,
|
||||
unit_types::UNIT_CMP,
|
||||
unnamed_address::FN_ADDRESS_COMPARISONS,
|
||||
unnamed_address::VTABLE_ADDRESS_COMPARISONS,
|
||||
unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS,
|
||||
unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS,
|
||||
unnecessary_wraps::UNNECESSARY_WRAPS,
|
||||
unnested_or_patterns::UNNESTED_OR_PATTERNS,
|
||||
unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
|
||||
unused_async::UNUSED_ASYNC,
|
||||
unused_io_amount::UNUSED_IO_AMOUNT,
|
||||
unused_peekable::UNUSED_PEEKABLE,
|
||||
unused_rounding::UNUSED_ROUNDING,
|
||||
unused_self::UNUSED_SELF,
|
||||
unused_unit::UNUSED_UNIT,
|
||||
unwrap::PANICKING_UNWRAP,
|
||||
unwrap::UNNECESSARY_UNWRAP,
|
||||
unwrap_in_result::UNWRAP_IN_RESULT,
|
||||
upper_case_acronyms::UPPER_CASE_ACRONYMS,
|
||||
use_self::USE_SELF,
|
||||
useless_conversion::USELESS_CONVERSION,
|
||||
vec::USELESS_VEC,
|
||||
vec_init_then_push::VEC_INIT_THEN_PUSH,
|
||||
wildcard_imports::ENUM_GLOB_USE,
|
||||
wildcard_imports::WILDCARD_IMPORTS,
|
||||
write::PRINTLN_EMPTY_STRING,
|
||||
write::PRINT_LITERAL,
|
||||
write::PRINT_STDERR,
|
||||
write::PRINT_STDOUT,
|
||||
write::PRINT_WITH_NEWLINE,
|
||||
write::USE_DEBUG,
|
||||
write::WRITELN_EMPTY_STRING,
|
||||
write::WRITE_LITERAL,
|
||||
write::WRITE_WITH_NEWLINE,
|
||||
zero_div_zero::ZERO_DIVIDED_BY_ZERO,
|
||||
zero_sized_map_values::ZERO_SIZED_MAP_VALUES,
|
||||
])
|
|
@ -1,41 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
|
||||
LintId::of(attrs::EMPTY_LINE_AFTER_OUTER_ATTR),
|
||||
LintId::of(casts::AS_PTR_CAST_MUT),
|
||||
LintId::of(cognitive_complexity::COGNITIVE_COMPLEXITY),
|
||||
LintId::of(copies::BRANCHES_SHARING_CODE),
|
||||
LintId::of(derive::DERIVE_PARTIAL_EQ_WITHOUT_EQ),
|
||||
LintId::of(equatable_if_let::EQUATABLE_IF_LET),
|
||||
LintId::of(fallible_impl_from::FALLIBLE_IMPL_FROM),
|
||||
LintId::of(floating_point_arithmetic::IMPRECISE_FLOPS),
|
||||
LintId::of(floating_point_arithmetic::SUBOPTIMAL_FLOPS),
|
||||
LintId::of(future_not_send::FUTURE_NOT_SEND),
|
||||
LintId::of(index_refutable_slice::INDEX_REFUTABLE_SLICE),
|
||||
LintId::of(let_if_seq::USELESS_LET_IF_SEQ),
|
||||
LintId::of(matches::SIGNIFICANT_DROP_IN_SCRUTINEE),
|
||||
LintId::of(methods::ITER_ON_EMPTY_COLLECTIONS),
|
||||
LintId::of(methods::ITER_ON_SINGLE_ITEMS),
|
||||
LintId::of(methods::ITER_WITH_DRAIN),
|
||||
LintId::of(methods::PATH_BUF_PUSH_OVERWRITE),
|
||||
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
|
||||
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),
|
||||
LintId::of(mutex_atomic::MUTEX_ATOMIC),
|
||||
LintId::of(mutex_atomic::MUTEX_INTEGER),
|
||||
LintId::of(non_send_fields_in_send_ty::NON_SEND_FIELDS_IN_SEND_TY),
|
||||
LintId::of(nonstandard_macro_braces::NONSTANDARD_MACRO_BRACES),
|
||||
LintId::of(option_if_let_else::OPTION_IF_LET_ELSE),
|
||||
LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE),
|
||||
LintId::of(regex::TRIVIAL_REGEX),
|
||||
LintId::of(strings::STRING_LIT_AS_BYTES),
|
||||
LintId::of(suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS),
|
||||
LintId::of(trailing_empty_array::TRAILING_EMPTY_ARRAY),
|
||||
LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),
|
||||
LintId::of(trait_bounds::TYPE_REPETITION_IN_BOUNDS),
|
||||
LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR),
|
||||
LintId::of(unused_peekable::UNUSED_PEEKABLE),
|
||||
LintId::of(unused_rounding::UNUSED_ROUNDING),
|
||||
LintId::of(use_self::USE_SELF),
|
||||
])
|
|
@ -1,100 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
|
||||
LintId::of(attrs::INLINE_ALWAYS),
|
||||
LintId::of(casts::BORROW_AS_PTR),
|
||||
LintId::of(casts::CAST_LOSSLESS),
|
||||
LintId::of(casts::CAST_POSSIBLE_TRUNCATION),
|
||||
LintId::of(casts::CAST_POSSIBLE_WRAP),
|
||||
LintId::of(casts::CAST_PRECISION_LOSS),
|
||||
LintId::of(casts::CAST_PTR_ALIGNMENT),
|
||||
LintId::of(casts::CAST_SIGN_LOSS),
|
||||
LintId::of(casts::PTR_AS_PTR),
|
||||
LintId::of(checked_conversions::CHECKED_CONVERSIONS),
|
||||
LintId::of(copies::SAME_FUNCTIONS_IN_IF_CONDITION),
|
||||
LintId::of(copy_iterator::COPY_ITERATOR),
|
||||
LintId::of(default::DEFAULT_TRAIT_ACCESS),
|
||||
LintId::of(dereference::EXPLICIT_DEREF_METHODS),
|
||||
LintId::of(dereference::REF_BINDING_TO_REFERENCE),
|
||||
LintId::of(derive::EXPL_IMPL_CLONE_ON_COPY),
|
||||
LintId::of(derive::UNSAFE_DERIVE_DESERIALIZE),
|
||||
LintId::of(doc::DOC_LINK_WITH_QUOTES),
|
||||
LintId::of(doc::DOC_MARKDOWN),
|
||||
LintId::of(doc::MISSING_ERRORS_DOC),
|
||||
LintId::of(doc::MISSING_PANICS_DOC),
|
||||
LintId::of(empty_enum::EMPTY_ENUM),
|
||||
LintId::of(enum_variants::MODULE_NAME_REPETITIONS),
|
||||
LintId::of(eta_reduction::REDUNDANT_CLOSURE_FOR_METHOD_CALLS),
|
||||
LintId::of(excessive_bools::FN_PARAMS_EXCESSIVE_BOOLS),
|
||||
LintId::of(excessive_bools::STRUCT_EXCESSIVE_BOOLS),
|
||||
LintId::of(functions::MUST_USE_CANDIDATE),
|
||||
LintId::of(functions::TOO_MANY_LINES),
|
||||
LintId::of(if_not_else::IF_NOT_ELSE),
|
||||
LintId::of(implicit_hasher::IMPLICIT_HASHER),
|
||||
LintId::of(inconsistent_struct_constructor::INCONSISTENT_STRUCT_CONSTRUCTOR),
|
||||
LintId::of(infinite_iter::MAYBE_INFINITE_ITER),
|
||||
LintId::of(invalid_upcast_comparisons::INVALID_UPCAST_COMPARISONS),
|
||||
LintId::of(items_after_statements::ITEMS_AFTER_STATEMENTS),
|
||||
LintId::of(iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR),
|
||||
LintId::of(large_stack_arrays::LARGE_STACK_ARRAYS),
|
||||
LintId::of(literal_representation::LARGE_DIGIT_GROUPS),
|
||||
LintId::of(literal_representation::UNREADABLE_LITERAL),
|
||||
LintId::of(loops::EXPLICIT_INTO_ITER_LOOP),
|
||||
LintId::of(loops::EXPLICIT_ITER_LOOP),
|
||||
LintId::of(macro_use::MACRO_USE_IMPORTS),
|
||||
LintId::of(manual_assert::MANUAL_ASSERT),
|
||||
LintId::of(manual_instant_elapsed::MANUAL_INSTANT_ELAPSED),
|
||||
LintId::of(manual_string_new::MANUAL_STRING_NEW),
|
||||
LintId::of(matches::MATCH_BOOL),
|
||||
LintId::of(matches::MATCH_ON_VEC_ITEMS),
|
||||
LintId::of(matches::MATCH_SAME_ARMS),
|
||||
LintId::of(matches::MATCH_WILDCARD_FOR_SINGLE_VARIANTS),
|
||||
LintId::of(matches::MATCH_WILD_ERR_ARM),
|
||||
LintId::of(matches::SINGLE_MATCH_ELSE),
|
||||
LintId::of(methods::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS),
|
||||
LintId::of(methods::CLONED_INSTEAD_OF_COPIED),
|
||||
LintId::of(methods::FILTER_MAP_NEXT),
|
||||
LintId::of(methods::FLAT_MAP_OPTION),
|
||||
LintId::of(methods::FROM_ITER_INSTEAD_OF_COLLECT),
|
||||
LintId::of(methods::IMPLICIT_CLONE),
|
||||
LintId::of(methods::INEFFICIENT_TO_STRING),
|
||||
LintId::of(methods::MANUAL_OK_OR),
|
||||
LintId::of(methods::MAP_UNWRAP_OR),
|
||||
LintId::of(methods::NAIVE_BYTECOUNT),
|
||||
LintId::of(methods::STABLE_SORT_PRIMITIVE),
|
||||
LintId::of(methods::UNNECESSARY_JOIN),
|
||||
LintId::of(misc::USED_UNDERSCORE_BINDING),
|
||||
LintId::of(mismatching_type_param_order::MISMATCHING_TYPE_PARAM_ORDER),
|
||||
LintId::of(mut_mut::MUT_MUT),
|
||||
LintId::of(needless_continue::NEEDLESS_CONTINUE),
|
||||
LintId::of(needless_for_each::NEEDLESS_FOR_EACH),
|
||||
LintId::of(needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
|
||||
LintId::of(no_effect::NO_EFFECT_UNDERSCORE_BINDING),
|
||||
LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES),
|
||||
LintId::of(non_expressive_names::SIMILAR_NAMES),
|
||||
LintId::of(operators::FLOAT_CMP),
|
||||
LintId::of(operators::NEEDLESS_BITWISE_BOOL),
|
||||
LintId::of(operators::VERBOSE_BIT_MASK),
|
||||
LintId::of(pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE),
|
||||
LintId::of(pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF),
|
||||
LintId::of(ranges::RANGE_MINUS_ONE),
|
||||
LintId::of(ranges::RANGE_PLUS_ONE),
|
||||
LintId::of(redundant_else::REDUNDANT_ELSE),
|
||||
LintId::of(ref_option_ref::REF_OPTION_REF),
|
||||
LintId::of(return_self_not_must_use::RETURN_SELF_NOT_MUST_USE),
|
||||
LintId::of(semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED),
|
||||
LintId::of(strings::STRING_ADD_ASSIGN),
|
||||
LintId::of(transmute::TRANSMUTE_PTR_TO_PTR),
|
||||
LintId::of(types::LINKEDLIST),
|
||||
LintId::of(types::OPTION_OPTION),
|
||||
LintId::of(unicode::UNICODE_NOT_NFC),
|
||||
LintId::of(unnecessary_wraps::UNNECESSARY_WRAPS),
|
||||
LintId::of(unnested_or_patterns::UNNESTED_OR_PATTERNS),
|
||||
LintId::of(unused_async::UNUSED_ASYNC),
|
||||
LintId::of(unused_self::UNUSED_SELF),
|
||||
LintId::of(wildcard_imports::ENUM_GLOB_USE),
|
||||
LintId::of(wildcard_imports::WILDCARD_IMPORTS),
|
||||
LintId::of(zero_sized_map_values::ZERO_SIZED_MAP_VALUES),
|
||||
])
|
|
@ -1,34 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
|
||||
LintId::of(box_default::BOX_DEFAULT),
|
||||
LintId::of(entry::MAP_ENTRY),
|
||||
LintId::of(escape::BOXED_LOCAL),
|
||||
LintId::of(format_args::FORMAT_IN_FORMAT_ARGS),
|
||||
LintId::of(format_args::TO_STRING_IN_FORMAT_ARGS),
|
||||
LintId::of(functions::RESULT_LARGE_ERR),
|
||||
LintId::of(large_const_arrays::LARGE_CONST_ARRAYS),
|
||||
LintId::of(large_enum_variant::LARGE_ENUM_VARIANT),
|
||||
LintId::of(loops::MANUAL_MEMCPY),
|
||||
LintId::of(loops::MISSING_SPIN_LOOP),
|
||||
LintId::of(loops::NEEDLESS_COLLECT),
|
||||
LintId::of(manual_retain::MANUAL_RETAIN),
|
||||
LintId::of(methods::COLLAPSIBLE_STR_REPLACE),
|
||||
LintId::of(methods::EXPECT_FUN_CALL),
|
||||
LintId::of(methods::EXTEND_WITH_DRAIN),
|
||||
LintId::of(methods::ITER_NTH),
|
||||
LintId::of(methods::ITER_OVEREAGER_CLONED),
|
||||
LintId::of(methods::MANUAL_STR_REPEAT),
|
||||
LintId::of(methods::OR_FUN_CALL),
|
||||
LintId::of(methods::SINGLE_CHAR_PATTERN),
|
||||
LintId::of(methods::UNNECESSARY_TO_OWNED),
|
||||
LintId::of(operators::CMP_OWNED),
|
||||
LintId::of(redundant_clone::REDUNDANT_CLONE),
|
||||
LintId::of(slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
|
||||
LintId::of(types::BOX_COLLECTION),
|
||||
LintId::of(types::REDUNDANT_ALLOCATION),
|
||||
LintId::of(vec::USELESS_VEC),
|
||||
LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH),
|
||||
])
|
|
@ -1,90 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
|
||||
LintId::of(as_conversions::AS_CONVERSIONS),
|
||||
LintId::of(asm_syntax::INLINE_ASM_X86_ATT_SYNTAX),
|
||||
LintId::of(asm_syntax::INLINE_ASM_X86_INTEL_SYNTAX),
|
||||
LintId::of(assertions_on_result_states::ASSERTIONS_ON_RESULT_STATES),
|
||||
LintId::of(attrs::ALLOW_ATTRIBUTES_WITHOUT_REASON),
|
||||
LintId::of(casts::AS_UNDERSCORE),
|
||||
LintId::of(casts::FN_TO_NUMERIC_CAST_ANY),
|
||||
LintId::of(create_dir::CREATE_DIR),
|
||||
LintId::of(dbg_macro::DBG_MACRO),
|
||||
LintId::of(default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK),
|
||||
LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION),
|
||||
LintId::of(disallowed_script_idents::DISALLOWED_SCRIPT_IDENTS),
|
||||
LintId::of(else_if_without_else::ELSE_IF_WITHOUT_ELSE),
|
||||
LintId::of(empty_drop::EMPTY_DROP),
|
||||
LintId::of(empty_structs_with_brackets::EMPTY_STRUCTS_WITH_BRACKETS),
|
||||
LintId::of(exhaustive_items::EXHAUSTIVE_ENUMS),
|
||||
LintId::of(exhaustive_items::EXHAUSTIVE_STRUCTS),
|
||||
LintId::of(exit::EXIT),
|
||||
LintId::of(float_literal::LOSSY_FLOAT_LITERAL),
|
||||
LintId::of(format_push_string::FORMAT_PUSH_STRING),
|
||||
LintId::of(if_then_some_else_none::IF_THEN_SOME_ELSE_NONE),
|
||||
LintId::of(implicit_return::IMPLICIT_RETURN),
|
||||
LintId::of(indexing_slicing::INDEXING_SLICING),
|
||||
LintId::of(inherent_impl::MULTIPLE_INHERENT_IMPL),
|
||||
LintId::of(large_include_file::LARGE_INCLUDE_FILE),
|
||||
LintId::of(let_underscore::LET_UNDERSCORE_MUST_USE),
|
||||
LintId::of(literal_representation::DECIMAL_LITERAL_REPRESENTATION),
|
||||
LintId::of(matches::REST_PAT_IN_FULLY_BOUND_STRUCTS),
|
||||
LintId::of(matches::TRY_ERR),
|
||||
LintId::of(matches::WILDCARD_ENUM_MATCH_ARM),
|
||||
LintId::of(mem_forget::MEM_FORGET),
|
||||
LintId::of(methods::CLONE_ON_REF_PTR),
|
||||
LintId::of(methods::EXPECT_USED),
|
||||
LintId::of(methods::FILETYPE_IS_FILE),
|
||||
LintId::of(methods::GET_UNWRAP),
|
||||
LintId::of(methods::MAP_ERR_IGNORE),
|
||||
LintId::of(methods::UNWRAP_USED),
|
||||
LintId::of(methods::VERBOSE_FILE_READS),
|
||||
LintId::of(misc_early::SEPARATED_LITERAL_SUFFIX),
|
||||
LintId::of(misc_early::UNNEEDED_FIELD_PATTERN),
|
||||
LintId::of(misc_early::UNSEPARATED_LITERAL_SUFFIX),
|
||||
LintId::of(missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS),
|
||||
LintId::of(missing_enforced_import_rename::MISSING_ENFORCED_IMPORT_RENAMES),
|
||||
LintId::of(missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS),
|
||||
LintId::of(missing_trait_methods::MISSING_TRAIT_METHODS),
|
||||
LintId::of(mixed_read_write_in_expression::MIXED_READ_WRITE_IN_EXPRESSION),
|
||||
LintId::of(module_style::MOD_MODULE_FILES),
|
||||
LintId::of(module_style::SELF_NAMED_MODULE_FILES),
|
||||
LintId::of(operators::ARITHMETIC_SIDE_EFFECTS),
|
||||
LintId::of(operators::FLOAT_ARITHMETIC),
|
||||
LintId::of(operators::FLOAT_CMP_CONST),
|
||||
LintId::of(operators::INTEGER_ARITHMETIC),
|
||||
LintId::of(operators::INTEGER_DIVISION),
|
||||
LintId::of(operators::MODULO_ARITHMETIC),
|
||||
LintId::of(panic_in_result_fn::PANIC_IN_RESULT_FN),
|
||||
LintId::of(panic_unimplemented::PANIC),
|
||||
LintId::of(panic_unimplemented::TODO),
|
||||
LintId::of(panic_unimplemented::UNIMPLEMENTED),
|
||||
LintId::of(panic_unimplemented::UNREACHABLE),
|
||||
LintId::of(partial_pub_fields::PARTIAL_PUB_FIELDS),
|
||||
LintId::of(pattern_type_mismatch::PATTERN_TYPE_MISMATCH),
|
||||
LintId::of(pub_use::PUB_USE),
|
||||
LintId::of(redundant_slicing::DEREF_BY_SLICING),
|
||||
LintId::of(same_name_method::SAME_NAME_METHOD),
|
||||
LintId::of(shadow::SHADOW_REUSE),
|
||||
LintId::of(shadow::SHADOW_SAME),
|
||||
LintId::of(shadow::SHADOW_UNRELATED),
|
||||
LintId::of(single_char_lifetime_names::SINGLE_CHAR_LIFETIME_NAMES),
|
||||
LintId::of(std_instead_of_core::ALLOC_INSTEAD_OF_CORE),
|
||||
LintId::of(std_instead_of_core::STD_INSTEAD_OF_ALLOC),
|
||||
LintId::of(std_instead_of_core::STD_INSTEAD_OF_CORE),
|
||||
LintId::of(strings::STRING_ADD),
|
||||
LintId::of(strings::STRING_SLICE),
|
||||
LintId::of(strings::STRING_TO_STRING),
|
||||
LintId::of(strings::STR_TO_STRING),
|
||||
LintId::of(types::RC_BUFFER),
|
||||
LintId::of(types::RC_MUTEX),
|
||||
LintId::of(undocumented_unsafe_blocks::UNDOCUMENTED_UNSAFE_BLOCKS),
|
||||
LintId::of(unicode::NON_ASCII_LITERAL),
|
||||
LintId::of(unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS),
|
||||
LintId::of(unwrap_in_result::UNWRAP_IN_RESULT),
|
||||
LintId::of(write::PRINT_STDERR),
|
||||
LintId::of(write::PRINT_STDOUT),
|
||||
LintId::of(write::USE_DEBUG),
|
||||
])
|
|
@ -1,132 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::style", Some("clippy_style"), vec![
|
||||
LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
|
||||
LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
|
||||
LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON),
|
||||
LintId::of(bool_to_int_with_if::BOOL_TO_INT_WITH_IF),
|
||||
LintId::of(casts::FN_TO_NUMERIC_CAST),
|
||||
LintId::of(casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
|
||||
LintId::of(collapsible_if::COLLAPSIBLE_ELSE_IF),
|
||||
LintId::of(collapsible_if::COLLAPSIBLE_IF),
|
||||
LintId::of(comparison_chain::COMPARISON_CHAIN),
|
||||
LintId::of(default::FIELD_REASSIGN_WITH_DEFAULT),
|
||||
LintId::of(default_instead_of_iter_empty::DEFAULT_INSTEAD_OF_ITER_EMPTY),
|
||||
LintId::of(dereference::NEEDLESS_BORROW),
|
||||
LintId::of(disallowed_macros::DISALLOWED_MACROS),
|
||||
LintId::of(disallowed_methods::DISALLOWED_METHODS),
|
||||
LintId::of(disallowed_names::DISALLOWED_NAMES),
|
||||
LintId::of(disallowed_types::DISALLOWED_TYPES),
|
||||
LintId::of(doc::MISSING_SAFETY_DOC),
|
||||
LintId::of(doc::NEEDLESS_DOCTEST_MAIN),
|
||||
LintId::of(enum_variants::ENUM_VARIANT_NAMES),
|
||||
LintId::of(enum_variants::MODULE_INCEPTION),
|
||||
LintId::of(eta_reduction::REDUNDANT_CLOSURE),
|
||||
LintId::of(float_literal::EXCESSIVE_PRECISION),
|
||||
LintId::of(format_args::UNINLINED_FORMAT_ARGS),
|
||||
LintId::of(from_over_into::FROM_OVER_INTO),
|
||||
LintId::of(from_str_radix_10::FROM_STR_RADIX_10),
|
||||
LintId::of(functions::DOUBLE_MUST_USE),
|
||||
LintId::of(functions::MUST_USE_UNIT),
|
||||
LintId::of(functions::RESULT_UNIT_ERR),
|
||||
LintId::of(implicit_saturating_add::IMPLICIT_SATURATING_ADD),
|
||||
LintId::of(implicit_saturating_sub::IMPLICIT_SATURATING_SUB),
|
||||
LintId::of(inherent_to_string::INHERENT_TO_STRING),
|
||||
LintId::of(init_numbered_fields::INIT_NUMBERED_FIELDS),
|
||||
LintId::of(len_zero::COMPARISON_TO_EMPTY),
|
||||
LintId::of(len_zero::LEN_WITHOUT_IS_EMPTY),
|
||||
LintId::of(len_zero::LEN_ZERO),
|
||||
LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING),
|
||||
LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS),
|
||||
LintId::of(loops::FOR_KV_MAP),
|
||||
LintId::of(loops::NEEDLESS_RANGE_LOOP),
|
||||
LintId::of(loops::SAME_ITEM_PUSH),
|
||||
LintId::of(loops::WHILE_LET_ON_ITERATOR),
|
||||
LintId::of(main_recursion::MAIN_RECURSION),
|
||||
LintId::of(manual_async_fn::MANUAL_ASYNC_FN),
|
||||
LintId::of(manual_bits::MANUAL_BITS),
|
||||
LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE),
|
||||
LintId::of(match_result_ok::MATCH_RESULT_OK),
|
||||
LintId::of(matches::COLLAPSIBLE_MATCH),
|
||||
LintId::of(matches::INFALLIBLE_DESTRUCTURING_MATCH),
|
||||
LintId::of(matches::MANUAL_MAP),
|
||||
LintId::of(matches::MATCH_LIKE_MATCHES_MACRO),
|
||||
LintId::of(matches::MATCH_OVERLAPPING_ARM),
|
||||
LintId::of(matches::MATCH_REF_PATS),
|
||||
LintId::of(matches::REDUNDANT_PATTERN_MATCHING),
|
||||
LintId::of(matches::SINGLE_MATCH),
|
||||
LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
|
||||
LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT),
|
||||
LintId::of(methods::BYTES_NTH),
|
||||
LintId::of(methods::CHARS_LAST_CMP),
|
||||
LintId::of(methods::CHARS_NEXT_CMP),
|
||||
LintId::of(methods::ERR_EXPECT),
|
||||
LintId::of(methods::GET_FIRST),
|
||||
LintId::of(methods::INTO_ITER_ON_REF),
|
||||
LintId::of(methods::IS_DIGIT_ASCII_RADIX),
|
||||
LintId::of(methods::ITER_CLONED_COLLECT),
|
||||
LintId::of(methods::ITER_NEXT_SLICE),
|
||||
LintId::of(methods::ITER_NTH_ZERO),
|
||||
LintId::of(methods::ITER_SKIP_NEXT),
|
||||
LintId::of(methods::MANUAL_SATURATING_ARITHMETIC),
|
||||
LintId::of(methods::MAP_CLONE),
|
||||
LintId::of(methods::MAP_COLLECT_RESULT_UNIT),
|
||||
LintId::of(methods::MUT_MUTEX_LOCK),
|
||||
LintId::of(methods::NEW_RET_NO_SELF),
|
||||
LintId::of(methods::OBFUSCATED_IF_ELSE),
|
||||
LintId::of(methods::OK_EXPECT),
|
||||
LintId::of(methods::OPTION_MAP_OR_NONE),
|
||||
LintId::of(methods::RESULT_MAP_OR_INTO_OPTION),
|
||||
LintId::of(methods::SHOULD_IMPLEMENT_TRAIT),
|
||||
LintId::of(methods::SINGLE_CHAR_ADD_STR),
|
||||
LintId::of(methods::STRING_EXTEND_CHARS),
|
||||
LintId::of(methods::UNNECESSARY_FOLD),
|
||||
LintId::of(methods::UNNECESSARY_LAZY_EVALUATIONS),
|
||||
LintId::of(methods::UNWRAP_OR_ELSE_DEFAULT),
|
||||
LintId::of(methods::WRONG_SELF_CONVENTION),
|
||||
LintId::of(misc::TOPLEVEL_REF_ARG),
|
||||
LintId::of(misc::ZERO_PTR),
|
||||
LintId::of(misc_early::BUILTIN_TYPE_SHADOW),
|
||||
LintId::of(misc_early::DOUBLE_NEG),
|
||||
LintId::of(misc_early::DUPLICATE_UNDERSCORE_ARGUMENT),
|
||||
LintId::of(misc_early::MIXED_CASE_HEX_LITERALS),
|
||||
LintId::of(misc_early::REDUNDANT_PATTERN),
|
||||
LintId::of(mut_reference::UNNECESSARY_MUT_PASSED),
|
||||
LintId::of(needless_late_init::NEEDLESS_LATE_INIT),
|
||||
LintId::of(needless_parens_on_range_literals::NEEDLESS_PARENS_ON_RANGE_LITERALS),
|
||||
LintId::of(neg_multiply::NEG_MULTIPLY),
|
||||
LintId::of(new_without_default::NEW_WITHOUT_DEFAULT),
|
||||
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
|
||||
LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
|
||||
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
|
||||
LintId::of(operators::ASSIGN_OP_PATTERN),
|
||||
LintId::of(operators::OP_REF),
|
||||
LintId::of(operators::PTR_EQ),
|
||||
LintId::of(partialeq_to_none::PARTIALEQ_TO_NONE),
|
||||
LintId::of(ptr::CMP_NULL),
|
||||
LintId::of(ptr::PTR_ARG),
|
||||
LintId::of(question_mark::QUESTION_MARK),
|
||||
LintId::of(ranges::MANUAL_RANGE_CONTAINS),
|
||||
LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES),
|
||||
LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
|
||||
LintId::of(returns::LET_AND_RETURN),
|
||||
LintId::of(returns::NEEDLESS_RETURN),
|
||||
LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS),
|
||||
LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
|
||||
LintId::of(strings::TRIM_SPLIT_WHITESPACE),
|
||||
LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
|
||||
LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME),
|
||||
LintId::of(unit_types::LET_UNIT_VALUE),
|
||||
LintId::of(unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS),
|
||||
LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
|
||||
LintId::of(unused_unit::UNUSED_UNIT),
|
||||
LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS),
|
||||
LintId::of(write::PRINTLN_EMPTY_STRING),
|
||||
LintId::of(write::PRINT_LITERAL),
|
||||
LintId::of(write::PRINT_WITH_NEWLINE),
|
||||
LintId::of(write::WRITELN_EMPTY_STRING),
|
||||
LintId::of(write::WRITE_LITERAL),
|
||||
LintId::of(write::WRITE_WITH_NEWLINE),
|
||||
])
|
|
@ -1,39 +0,0 @@
|
|||
// This file was generated by `cargo dev update_lints`.
|
||||
// Use that command to update this file and do not edit by hand.
|
||||
// Manual edits will be overwritten.
|
||||
|
||||
store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), vec![
|
||||
LintId::of(almost_complete_letter_range::ALMOST_COMPLETE_LETTER_RANGE),
|
||||
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
|
||||
LintId::of(await_holding_invalid::AWAIT_HOLDING_INVALID_TYPE),
|
||||
LintId::of(await_holding_invalid::AWAIT_HOLDING_LOCK),
|
||||
LintId::of(await_holding_invalid::AWAIT_HOLDING_REFCELL_REF),
|
||||
LintId::of(casts::CAST_ABS_TO_UNSIGNED),
|
||||
LintId::of(casts::CAST_ENUM_CONSTRUCTOR),
|
||||
LintId::of(casts::CAST_ENUM_TRUNCATION),
|
||||
LintId::of(casts::CAST_NAN_TO_INT),
|
||||
LintId::of(casts::CAST_SLICE_FROM_RAW_PARTS),
|
||||
LintId::of(crate_in_macro_def::CRATE_IN_MACRO_DEF),
|
||||
LintId::of(drop_forget_ref::DROP_NON_DROP),
|
||||
LintId::of(drop_forget_ref::FORGET_NON_DROP),
|
||||
LintId::of(duplicate_mod::DUPLICATE_MOD),
|
||||
LintId::of(format_impl::PRINT_IN_FORMAT_IMPL),
|
||||
LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
|
||||
LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING),
|
||||
LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
|
||||
LintId::of(from_raw_with_void_ptr::FROM_RAW_WITH_VOID_PTR),
|
||||
LintId::of(loops::EMPTY_LOOP),
|
||||
LintId::of(loops::MUT_RANGE_BOUND),
|
||||
LintId::of(methods::NO_EFFECT_REPLACE),
|
||||
LintId::of(methods::SUSPICIOUS_MAP),
|
||||
LintId::of(methods::SUSPICIOUS_TO_OWNED),
|
||||
LintId::of(multi_assignments::MULTI_ASSIGNMENTS),
|
||||
LintId::of(mut_key::MUTABLE_KEY_TYPE),
|
||||
LintId::of(octal_escapes::OCTAL_ESCAPES),
|
||||
LintId::of(operators::FLOAT_EQUALITY_WITHOUT_ABS),
|
||||
LintId::of(operators::MISREFACTORED_ASSIGN_OP),
|
||||
LintId::of(rc_clone_in_vec_init::RC_CLONE_IN_VEC_INIT),
|
||||
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
|
||||
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
|
||||
LintId::of(swap_ptr_to_ref::SWAP_PTR_TO_REF),
|
||||
])
|
|
@ -46,122 +46,21 @@ extern crate rustc_trait_selection;
|
|||
|
||||
#[macro_use]
|
||||
extern crate clippy_utils;
|
||||
#[macro_use]
|
||||
extern crate declare_clippy_lint;
|
||||
|
||||
use clippy_utils::parse_msrv;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_lint::LintId;
|
||||
use rustc_lint::{Lint, LintId};
|
||||
use rustc_semver::RustcVersion;
|
||||
use rustc_session::Session;
|
||||
|
||||
/// Macro used to declare a Clippy lint.
|
||||
///
|
||||
/// Every lint declaration consists of 4 parts:
|
||||
///
|
||||
/// 1. The documentation, which is used for the website
|
||||
/// 2. The `LINT_NAME`. See [lint naming][lint_naming] on lint naming conventions.
|
||||
/// 3. The `lint_level`, which is a mapping from *one* of our lint groups to `Allow`, `Warn` or
|
||||
/// `Deny`. The lint level here has nothing to do with what lint groups the lint is a part of.
|
||||
/// 4. The `description` that contains a short explanation on what's wrong with code where the
|
||||
/// lint is triggered.
|
||||
///
|
||||
/// Currently the categories `style`, `correctness`, `suspicious`, `complexity` and `perf` are
|
||||
/// enabled by default. As said in the README.md of this repository, if the lint level mapping
|
||||
/// changes, please update README.md.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(rustc_private)]
|
||||
/// extern crate rustc_session;
|
||||
/// use rustc_session::declare_tool_lint;
|
||||
/// use clippy_lints::declare_clippy_lint;
|
||||
///
|
||||
/// declare_clippy_lint! {
|
||||
/// /// ### What it does
|
||||
/// /// Checks for ... (describe what the lint matches).
|
||||
/// ///
|
||||
/// /// ### Why is this bad?
|
||||
/// /// Supply the reason for linting the code.
|
||||
/// ///
|
||||
/// /// ### Example
|
||||
/// /// ```rust
|
||||
/// /// Insert a short example of code that triggers the lint
|
||||
/// /// ```
|
||||
/// ///
|
||||
/// /// Use instead:
|
||||
/// /// ```rust
|
||||
/// /// Insert a short example of improved code that doesn't trigger the lint
|
||||
/// /// ```
|
||||
/// pub LINT_NAME,
|
||||
/// pedantic,
|
||||
/// "description"
|
||||
/// }
|
||||
/// ```
|
||||
/// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
|
||||
#[macro_export]
|
||||
macro_rules! declare_clippy_lint {
|
||||
{ $(#[$attr:meta])* pub $name:tt, style, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, correctness, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Deny, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, suspicious, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, complexity, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, perf, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, restriction, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, cargo, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, nursery, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, internal, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
{ $(#[$attr:meta])* pub $name:tt, internal_warn, $description:tt } => {
|
||||
declare_tool_lint! {
|
||||
$(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "internal")]
|
||||
pub mod deprecated_lints;
|
||||
#[cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
|
||||
mod utils;
|
||||
|
||||
mod declared_lints;
|
||||
mod renamed_lints;
|
||||
|
||||
// begin lints modules, do not remove this comment, it’s used in `update_lints`
|
||||
|
@ -495,31 +394,121 @@ pub fn read_conf(sess: &Session) -> Conf {
|
|||
conf
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct RegistrationGroups {
|
||||
all: Vec<LintId>,
|
||||
cargo: Vec<LintId>,
|
||||
complexity: Vec<LintId>,
|
||||
correctness: Vec<LintId>,
|
||||
nursery: Vec<LintId>,
|
||||
pedantic: Vec<LintId>,
|
||||
perf: Vec<LintId>,
|
||||
restriction: Vec<LintId>,
|
||||
style: Vec<LintId>,
|
||||
suspicious: Vec<LintId>,
|
||||
#[cfg(feature = "internal")]
|
||||
internal: Vec<LintId>,
|
||||
}
|
||||
|
||||
impl RegistrationGroups {
|
||||
#[rustfmt::skip]
|
||||
fn register(self, store: &mut rustc_lint::LintStore) {
|
||||
store.register_group(true, "clippy::all", Some("clippy_all"), self.all);
|
||||
store.register_group(true, "clippy::cargo", Some("clippy_cargo"), self.cargo);
|
||||
store.register_group(true, "clippy::complexity", Some("clippy_complexity"), self.complexity);
|
||||
store.register_group(true, "clippy::correctness", Some("clippy_correctness"), self.correctness);
|
||||
store.register_group(true, "clippy::nursery", Some("clippy_nursery"), self.nursery);
|
||||
store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), self.pedantic);
|
||||
store.register_group(true, "clippy::perf", Some("clippy_perf"), self.perf);
|
||||
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), self.restriction);
|
||||
store.register_group(true, "clippy::style", Some("clippy_style"), self.style);
|
||||
store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), self.suspicious);
|
||||
#[cfg(feature = "internal")]
|
||||
store.register_group(true, "clippy::internal", Some("clippy_internal"), self.internal);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub(crate) enum LintCategory {
|
||||
Cargo,
|
||||
Complexity,
|
||||
Correctness,
|
||||
Nursery,
|
||||
Pedantic,
|
||||
Perf,
|
||||
Restriction,
|
||||
Style,
|
||||
Suspicious,
|
||||
#[cfg(feature = "internal")]
|
||||
Internal,
|
||||
}
|
||||
#[allow(clippy::enum_glob_use)]
|
||||
use LintCategory::*;
|
||||
|
||||
impl LintCategory {
|
||||
fn is_all(self) -> bool {
|
||||
matches!(self, Correctness | Suspicious | Style | Complexity | Perf)
|
||||
}
|
||||
|
||||
fn group(self, groups: &mut RegistrationGroups) -> &mut Vec<LintId> {
|
||||
match self {
|
||||
Cargo => &mut groups.cargo,
|
||||
Complexity => &mut groups.complexity,
|
||||
Correctness => &mut groups.correctness,
|
||||
Nursery => &mut groups.nursery,
|
||||
Pedantic => &mut groups.pedantic,
|
||||
Perf => &mut groups.perf,
|
||||
Restriction => &mut groups.restriction,
|
||||
Style => &mut groups.style,
|
||||
Suspicious => &mut groups.suspicious,
|
||||
#[cfg(feature = "internal")]
|
||||
Internal => &mut groups.internal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct LintInfo {
|
||||
/// Double reference to maintain pointer equality
|
||||
lint: &'static &'static Lint,
|
||||
category: LintCategory,
|
||||
explanation: &'static str,
|
||||
}
|
||||
|
||||
pub fn explain(name: &str) {
|
||||
let target = format!("clippy::{}", name.to_ascii_uppercase());
|
||||
match declared_lints::LINTS.iter().find(|info| info.lint.name == target) {
|
||||
Some(info) => print!("{}", info.explanation),
|
||||
None => println!("unknown lint: {name}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn register_categories(store: &mut rustc_lint::LintStore) {
|
||||
let mut groups = RegistrationGroups::default();
|
||||
|
||||
for LintInfo { lint, category, .. } in declared_lints::LINTS {
|
||||
if category.is_all() {
|
||||
groups.all.push(LintId::of(lint));
|
||||
}
|
||||
|
||||
category.group(&mut groups).push(LintId::of(lint));
|
||||
}
|
||||
|
||||
let lints: Vec<&'static Lint> = declared_lints::LINTS.iter().map(|info| *info.lint).collect();
|
||||
|
||||
store.register_lints(&lints);
|
||||
groups.register(store);
|
||||
}
|
||||
|
||||
/// Register all lints and lint groups with the rustc plugin registry
|
||||
///
|
||||
/// Used in `./src/driver.rs`.
|
||||
#[expect(clippy::too_many_lines)]
|
||||
pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: &Conf) {
|
||||
register_removed_non_tool_lints(store);
|
||||
register_categories(store);
|
||||
|
||||
include!("lib.deprecated.rs");
|
||||
|
||||
include!("lib.register_lints.rs");
|
||||
include!("lib.register_restriction.rs");
|
||||
include!("lib.register_pedantic.rs");
|
||||
|
||||
#[cfg(feature = "internal")]
|
||||
include!("lib.register_internal.rs");
|
||||
|
||||
include!("lib.register_all.rs");
|
||||
include!("lib.register_style.rs");
|
||||
include!("lib.register_complexity.rs");
|
||||
include!("lib.register_correctness.rs");
|
||||
include!("lib.register_suspicious.rs");
|
||||
include!("lib.register_perf.rs");
|
||||
include!("lib.register_cargo.rs");
|
||||
include!("lib.register_nursery.rs");
|
||||
|
||||
#[cfg(feature = "internal")]
|
||||
{
|
||||
if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "declare_clippy_lint"
|
||||
version = "0.1.66"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.10.1"
|
||||
quote = "1.0.21"
|
||||
syn = "1.0.100"
|
|
@ -0,0 +1,173 @@
|
|||
#![feature(let_chains)]
|
||||
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::{format_ident, quote};
|
||||
use syn::parse::{Parse, ParseStream};
|
||||
use syn::{parse_macro_input, Attribute, Error, Ident, Lit, LitStr, Meta, Result, Token};
|
||||
|
||||
fn parse_attr<const LEN: usize>(path: [&'static str; LEN], attr: &Attribute) -> Option<LitStr> {
|
||||
if let Meta::NameValue(name_value) = attr.parse_meta().ok()? {
|
||||
let path_idents = name_value.path.segments.iter().map(|segment| &segment.ident);
|
||||
|
||||
if itertools::equal(path_idents, path)
|
||||
&& let Lit::Str(lit) = name_value.lit
|
||||
{
|
||||
return Some(lit);
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
struct ClippyLint {
|
||||
attrs: Vec<Attribute>,
|
||||
explanation: String,
|
||||
name: Ident,
|
||||
category: Ident,
|
||||
description: LitStr,
|
||||
}
|
||||
|
||||
impl Parse for ClippyLint {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let attrs = input.call(Attribute::parse_outer)?;
|
||||
|
||||
let mut in_code = false;
|
||||
let mut explanation = String::new();
|
||||
let mut version = None;
|
||||
for attr in &attrs {
|
||||
if let Some(lit) = parse_attr(["doc"], attr) {
|
||||
let value = lit.value();
|
||||
let line = value.strip_prefix(' ').unwrap_or(&value);
|
||||
|
||||
if line.starts_with("```") {
|
||||
explanation += "```\n";
|
||||
in_code = !in_code;
|
||||
} else if !(in_code && line.starts_with("# ")) {
|
||||
explanation += line;
|
||||
explanation.push('\n');
|
||||
}
|
||||
} else if let Some(lit) = parse_attr(["clippy", "version"], attr) {
|
||||
if let Some(duplicate) = version.replace(lit) {
|
||||
return Err(Error::new_spanned(duplicate, "duplicate clippy::version"));
|
||||
}
|
||||
} else {
|
||||
return Err(Error::new_spanned(attr, "unexpected attribute"));
|
||||
}
|
||||
}
|
||||
|
||||
input.parse::<Token![pub]>()?;
|
||||
let name = input.parse()?;
|
||||
input.parse::<Token![,]>()?;
|
||||
|
||||
let category = input.parse()?;
|
||||
input.parse::<Token![,]>()?;
|
||||
|
||||
let description = input.parse()?;
|
||||
|
||||
Ok(Self {
|
||||
attrs,
|
||||
explanation,
|
||||
name,
|
||||
category,
|
||||
description,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Macro used to declare a Clippy lint.
|
||||
///
|
||||
/// Every lint declaration consists of 4 parts:
|
||||
///
|
||||
/// 1. The documentation, which is used for the website and `cargo clippy --explain`
|
||||
/// 2. The `LINT_NAME`. See [lint naming][lint_naming] on lint naming conventions.
|
||||
/// 3. The `lint_level`, which is a mapping from *one* of our lint groups to `Allow`, `Warn` or
|
||||
/// `Deny`. The lint level here has nothing to do with what lint groups the lint is a part of.
|
||||
/// 4. The `description` that contains a short explanation on what's wrong with code where the
|
||||
/// lint is triggered.
|
||||
///
|
||||
/// Currently the categories `style`, `correctness`, `suspicious`, `complexity` and `perf` are
|
||||
/// enabled by default. As said in the README.md of this repository, if the lint level mapping
|
||||
/// changes, please update README.md.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// use rustc_session::declare_tool_lint;
|
||||
///
|
||||
/// declare_clippy_lint! {
|
||||
/// /// ### What it does
|
||||
/// /// Checks for ... (describe what the lint matches).
|
||||
/// ///
|
||||
/// /// ### Why is this bad?
|
||||
/// /// Supply the reason for linting the code.
|
||||
/// ///
|
||||
/// /// ### Example
|
||||
/// /// ```rust
|
||||
/// /// Insert a short example of code that triggers the lint
|
||||
/// /// ```
|
||||
/// ///
|
||||
/// /// Use instead:
|
||||
/// /// ```rust
|
||||
/// /// Insert a short example of improved code that doesn't trigger the lint
|
||||
/// /// ```
|
||||
/// #[clippy::version = "1.65.0"]
|
||||
/// pub LINT_NAME,
|
||||
/// pedantic,
|
||||
/// "description"
|
||||
/// }
|
||||
/// ```
|
||||
/// [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
|
||||
#[proc_macro]
|
||||
pub fn declare_clippy_lint(input: TokenStream) -> TokenStream {
|
||||
let ClippyLint {
|
||||
attrs,
|
||||
explanation,
|
||||
name,
|
||||
category,
|
||||
description,
|
||||
} = parse_macro_input!(input as ClippyLint);
|
||||
|
||||
let mut category = category.to_string();
|
||||
|
||||
let level = format_ident!(
|
||||
"{}",
|
||||
match category.as_str() {
|
||||
"correctness" => "Deny",
|
||||
"style" | "suspicious" | "complexity" | "perf" | "internal_warn" => "Warn",
|
||||
"pedantic" | "restriction" | "cargo" | "nursery" | "internal" => "Allow",
|
||||
_ => panic!("unknown category {category}"),
|
||||
},
|
||||
);
|
||||
|
||||
let info = if category == "internal_warn" {
|
||||
None
|
||||
} else {
|
||||
let info_name = format_ident!("{name}_INFO");
|
||||
|
||||
(&mut category[0..1]).make_ascii_uppercase();
|
||||
let category_variant = format_ident!("{category}");
|
||||
|
||||
Some(quote! {
|
||||
pub(crate) static #info_name: &'static crate::LintInfo = &crate::LintInfo {
|
||||
lint: &#name,
|
||||
category: crate::LintCategory::#category_variant,
|
||||
explanation: #explanation,
|
||||
};
|
||||
})
|
||||
};
|
||||
|
||||
let output = quote! {
|
||||
declare_tool_lint! {
|
||||
#(#attrs)*
|
||||
pub clippy::#name,
|
||||
#level,
|
||||
#description,
|
||||
report_in_external_macro: true
|
||||
}
|
||||
|
||||
#info
|
||||
};
|
||||
|
||||
TokenStream::from(output)
|
||||
}
|
606
src/docs.rs
606
src/docs.rs
|
@ -1,606 +0,0 @@
|
|||
// autogenerated. Please look at /clippy_dev/src/update_lints.rs
|
||||
|
||||
macro_rules! include_lint {
|
||||
($file_name: expr) => {
|
||||
include_str!($file_name)
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! docs {
|
||||
($($lint_name: expr,)*) => {
|
||||
pub fn explain(lint: &str) {
|
||||
println!("{}", match lint {
|
||||
$(
|
||||
$lint_name => include_lint!(concat!("docs/", concat!($lint_name, ".txt"))),
|
||||
)*
|
||||
_ => "unknown lint",
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
docs! {
|
||||
"absurd_extreme_comparisons",
|
||||
"alloc_instead_of_core",
|
||||
"allow_attributes_without_reason",
|
||||
"almost_complete_letter_range",
|
||||
"almost_swapped",
|
||||
"approx_constant",
|
||||
"arithmetic_side_effects",
|
||||
"as_conversions",
|
||||
"as_ptr_cast_mut",
|
||||
"as_underscore",
|
||||
"assertions_on_constants",
|
||||
"assertions_on_result_states",
|
||||
"assign_op_pattern",
|
||||
"async_yields_async",
|
||||
"await_holding_invalid_type",
|
||||
"await_holding_lock",
|
||||
"await_holding_refcell_ref",
|
||||
"bad_bit_mask",
|
||||
"bind_instead_of_map",
|
||||
"blanket_clippy_restriction_lints",
|
||||
"blocks_in_if_conditions",
|
||||
"bool_assert_comparison",
|
||||
"bool_comparison",
|
||||
"bool_to_int_with_if",
|
||||
"borrow_as_ptr",
|
||||
"borrow_deref_ref",
|
||||
"borrow_interior_mutable_const",
|
||||
"borrowed_box",
|
||||
"box_collection",
|
||||
"box_default",
|
||||
"boxed_local",
|
||||
"branches_sharing_code",
|
||||
"builtin_type_shadow",
|
||||
"bytes_count_to_len",
|
||||
"bytes_nth",
|
||||
"cargo_common_metadata",
|
||||
"case_sensitive_file_extension_comparisons",
|
||||
"cast_abs_to_unsigned",
|
||||
"cast_enum_constructor",
|
||||
"cast_enum_truncation",
|
||||
"cast_lossless",
|
||||
"cast_nan_to_int",
|
||||
"cast_possible_truncation",
|
||||
"cast_possible_wrap",
|
||||
"cast_precision_loss",
|
||||
"cast_ptr_alignment",
|
||||
"cast_ref_to_mut",
|
||||
"cast_sign_loss",
|
||||
"cast_slice_different_sizes",
|
||||
"cast_slice_from_raw_parts",
|
||||
"char_lit_as_u8",
|
||||
"chars_last_cmp",
|
||||
"chars_next_cmp",
|
||||
"checked_conversions",
|
||||
"clone_double_ref",
|
||||
"clone_on_copy",
|
||||
"clone_on_ref_ptr",
|
||||
"cloned_instead_of_copied",
|
||||
"cmp_nan",
|
||||
"cmp_null",
|
||||
"cmp_owned",
|
||||
"cognitive_complexity",
|
||||
"collapsible_else_if",
|
||||
"collapsible_if",
|
||||
"collapsible_match",
|
||||
"collapsible_str_replace",
|
||||
"comparison_chain",
|
||||
"comparison_to_empty",
|
||||
"copy_iterator",
|
||||
"crate_in_macro_def",
|
||||
"create_dir",
|
||||
"crosspointer_transmute",
|
||||
"dbg_macro",
|
||||
"debug_assert_with_mut_call",
|
||||
"decimal_literal_representation",
|
||||
"declare_interior_mutable_const",
|
||||
"default_instead_of_iter_empty",
|
||||
"default_numeric_fallback",
|
||||
"default_trait_access",
|
||||
"default_union_representation",
|
||||
"deprecated_cfg_attr",
|
||||
"deprecated_semver",
|
||||
"deref_addrof",
|
||||
"deref_by_slicing",
|
||||
"derivable_impls",
|
||||
"derive_hash_xor_eq",
|
||||
"derive_ord_xor_partial_ord",
|
||||
"derive_partial_eq_without_eq",
|
||||
"disallowed_macros",
|
||||
"disallowed_methods",
|
||||
"disallowed_names",
|
||||
"disallowed_script_idents",
|
||||
"disallowed_types",
|
||||
"diverging_sub_expression",
|
||||
"doc_link_with_quotes",
|
||||
"doc_markdown",
|
||||
"double_comparisons",
|
||||
"double_must_use",
|
||||
"double_neg",
|
||||
"double_parens",
|
||||
"drop_copy",
|
||||
"drop_non_drop",
|
||||
"drop_ref",
|
||||
"duplicate_mod",
|
||||
"duplicate_underscore_argument",
|
||||
"duration_subsec",
|
||||
"else_if_without_else",
|
||||
"empty_drop",
|
||||
"empty_enum",
|
||||
"empty_line_after_outer_attr",
|
||||
"empty_loop",
|
||||
"empty_structs_with_brackets",
|
||||
"enum_clike_unportable_variant",
|
||||
"enum_glob_use",
|
||||
"enum_variant_names",
|
||||
"eq_op",
|
||||
"equatable_if_let",
|
||||
"erasing_op",
|
||||
"err_expect",
|
||||
"excessive_precision",
|
||||
"exhaustive_enums",
|
||||
"exhaustive_structs",
|
||||
"exit",
|
||||
"expect_fun_call",
|
||||
"expect_used",
|
||||
"expl_impl_clone_on_copy",
|
||||
"explicit_auto_deref",
|
||||
"explicit_counter_loop",
|
||||
"explicit_deref_methods",
|
||||
"explicit_into_iter_loop",
|
||||
"explicit_iter_loop",
|
||||
"explicit_write",
|
||||
"extend_with_drain",
|
||||
"extra_unused_lifetimes",
|
||||
"fallible_impl_from",
|
||||
"field_reassign_with_default",
|
||||
"filetype_is_file",
|
||||
"filter_map_identity",
|
||||
"filter_map_next",
|
||||
"filter_next",
|
||||
"flat_map_identity",
|
||||
"flat_map_option",
|
||||
"float_arithmetic",
|
||||
"float_cmp",
|
||||
"float_cmp_const",
|
||||
"float_equality_without_abs",
|
||||
"fn_address_comparisons",
|
||||
"fn_params_excessive_bools",
|
||||
"fn_to_numeric_cast",
|
||||
"fn_to_numeric_cast_any",
|
||||
"fn_to_numeric_cast_with_truncation",
|
||||
"for_kv_map",
|
||||
"forget_copy",
|
||||
"forget_non_drop",
|
||||
"forget_ref",
|
||||
"format_in_format_args",
|
||||
"format_push_string",
|
||||
"from_iter_instead_of_collect",
|
||||
"from_over_into",
|
||||
"from_raw_with_void_ptr",
|
||||
"from_str_radix_10",
|
||||
"future_not_send",
|
||||
"get_first",
|
||||
"get_last_with_len",
|
||||
"get_unwrap",
|
||||
"identity_op",
|
||||
"if_let_mutex",
|
||||
"if_not_else",
|
||||
"if_same_then_else",
|
||||
"if_then_some_else_none",
|
||||
"ifs_same_cond",
|
||||
"implicit_clone",
|
||||
"implicit_hasher",
|
||||
"implicit_return",
|
||||
"implicit_saturating_add",
|
||||
"implicit_saturating_sub",
|
||||
"imprecise_flops",
|
||||
"inconsistent_digit_grouping",
|
||||
"inconsistent_struct_constructor",
|
||||
"index_refutable_slice",
|
||||
"indexing_slicing",
|
||||
"ineffective_bit_mask",
|
||||
"inefficient_to_string",
|
||||
"infallible_destructuring_match",
|
||||
"infinite_iter",
|
||||
"inherent_to_string",
|
||||
"inherent_to_string_shadow_display",
|
||||
"init_numbered_fields",
|
||||
"inline_always",
|
||||
"inline_asm_x86_att_syntax",
|
||||
"inline_asm_x86_intel_syntax",
|
||||
"inline_fn_without_body",
|
||||
"inspect_for_each",
|
||||
"int_plus_one",
|
||||
"integer_arithmetic",
|
||||
"integer_division",
|
||||
"into_iter_on_ref",
|
||||
"invalid_null_ptr_usage",
|
||||
"invalid_regex",
|
||||
"invalid_upcast_comparisons",
|
||||
"invalid_utf8_in_unchecked",
|
||||
"invisible_characters",
|
||||
"is_digit_ascii_radix",
|
||||
"items_after_statements",
|
||||
"iter_cloned_collect",
|
||||
"iter_count",
|
||||
"iter_kv_map",
|
||||
"iter_next_loop",
|
||||
"iter_next_slice",
|
||||
"iter_not_returning_iterator",
|
||||
"iter_nth",
|
||||
"iter_nth_zero",
|
||||
"iter_on_empty_collections",
|
||||
"iter_on_single_items",
|
||||
"iter_overeager_cloned",
|
||||
"iter_skip_next",
|
||||
"iter_with_drain",
|
||||
"iterator_step_by_zero",
|
||||
"just_underscores_and_digits",
|
||||
"large_const_arrays",
|
||||
"large_digit_groups",
|
||||
"large_enum_variant",
|
||||
"large_include_file",
|
||||
"large_stack_arrays",
|
||||
"large_types_passed_by_value",
|
||||
"len_without_is_empty",
|
||||
"len_zero",
|
||||
"let_and_return",
|
||||
"let_underscore_lock",
|
||||
"let_underscore_must_use",
|
||||
"let_unit_value",
|
||||
"linkedlist",
|
||||
"lossy_float_literal",
|
||||
"macro_use_imports",
|
||||
"main_recursion",
|
||||
"manual_assert",
|
||||
"manual_async_fn",
|
||||
"manual_bits",
|
||||
"manual_clamp",
|
||||
"manual_filter",
|
||||
"manual_filter_map",
|
||||
"manual_find",
|
||||
"manual_find_map",
|
||||
"manual_flatten",
|
||||
"manual_instant_elapsed",
|
||||
"manual_map",
|
||||
"manual_memcpy",
|
||||
"manual_non_exhaustive",
|
||||
"manual_ok_or",
|
||||
"manual_range_contains",
|
||||
"manual_rem_euclid",
|
||||
"manual_retain",
|
||||
"manual_saturating_arithmetic",
|
||||
"manual_split_once",
|
||||
"manual_str_repeat",
|
||||
"manual_string_new",
|
||||
"manual_strip",
|
||||
"manual_swap",
|
||||
"manual_unwrap_or",
|
||||
"many_single_char_names",
|
||||
"map_clone",
|
||||
"map_collect_result_unit",
|
||||
"map_entry",
|
||||
"map_err_ignore",
|
||||
"map_flatten",
|
||||
"map_identity",
|
||||
"map_unwrap_or",
|
||||
"match_as_ref",
|
||||
"match_bool",
|
||||
"match_like_matches_macro",
|
||||
"match_on_vec_items",
|
||||
"match_overlapping_arm",
|
||||
"match_ref_pats",
|
||||
"match_result_ok",
|
||||
"match_same_arms",
|
||||
"match_single_binding",
|
||||
"match_str_case_mismatch",
|
||||
"match_wild_err_arm",
|
||||
"match_wildcard_for_single_variants",
|
||||
"maybe_infinite_iter",
|
||||
"mem_forget",
|
||||
"mem_replace_option_with_none",
|
||||
"mem_replace_with_default",
|
||||
"mem_replace_with_uninit",
|
||||
"min_max",
|
||||
"mismatched_target_os",
|
||||
"mismatching_type_param_order",
|
||||
"misrefactored_assign_op",
|
||||
"missing_const_for_fn",
|
||||
"missing_docs_in_private_items",
|
||||
"missing_enforced_import_renames",
|
||||
"missing_errors_doc",
|
||||
"missing_inline_in_public_items",
|
||||
"missing_panics_doc",
|
||||
"missing_safety_doc",
|
||||
"missing_spin_loop",
|
||||
"missing_trait_methods",
|
||||
"mistyped_literal_suffixes",
|
||||
"mixed_case_hex_literals",
|
||||
"mixed_read_write_in_expression",
|
||||
"mod_module_files",
|
||||
"module_inception",
|
||||
"module_name_repetitions",
|
||||
"modulo_arithmetic",
|
||||
"modulo_one",
|
||||
"multi_assignments",
|
||||
"multiple_crate_versions",
|
||||
"multiple_inherent_impl",
|
||||
"must_use_candidate",
|
||||
"must_use_unit",
|
||||
"mut_from_ref",
|
||||
"mut_mut",
|
||||
"mut_mutex_lock",
|
||||
"mut_range_bound",
|
||||
"mutable_key_type",
|
||||
"mutex_atomic",
|
||||
"mutex_integer",
|
||||
"naive_bytecount",
|
||||
"needless_arbitrary_self_type",
|
||||
"needless_bitwise_bool",
|
||||
"needless_bool",
|
||||
"needless_borrow",
|
||||
"needless_borrowed_reference",
|
||||
"needless_collect",
|
||||
"needless_continue",
|
||||
"needless_doctest_main",
|
||||
"needless_for_each",
|
||||
"needless_late_init",
|
||||
"needless_lifetimes",
|
||||
"needless_match",
|
||||
"needless_option_as_deref",
|
||||
"needless_option_take",
|
||||
"needless_parens_on_range_literals",
|
||||
"needless_pass_by_value",
|
||||
"needless_question_mark",
|
||||
"needless_range_loop",
|
||||
"needless_return",
|
||||
"needless_splitn",
|
||||
"needless_update",
|
||||
"neg_cmp_op_on_partial_ord",
|
||||
"neg_multiply",
|
||||
"negative_feature_names",
|
||||
"never_loop",
|
||||
"new_ret_no_self",
|
||||
"new_without_default",
|
||||
"no_effect",
|
||||
"no_effect_replace",
|
||||
"no_effect_underscore_binding",
|
||||
"non_ascii_literal",
|
||||
"non_octal_unix_permissions",
|
||||
"non_send_fields_in_send_ty",
|
||||
"nonminimal_bool",
|
||||
"nonsensical_open_options",
|
||||
"nonstandard_macro_braces",
|
||||
"not_unsafe_ptr_arg_deref",
|
||||
"obfuscated_if_else",
|
||||
"octal_escapes",
|
||||
"ok_expect",
|
||||
"only_used_in_recursion",
|
||||
"op_ref",
|
||||
"option_as_ref_deref",
|
||||
"option_env_unwrap",
|
||||
"option_filter_map",
|
||||
"option_if_let_else",
|
||||
"option_map_or_none",
|
||||
"option_map_unit_fn",
|
||||
"option_option",
|
||||
"or_fun_call",
|
||||
"or_then_unwrap",
|
||||
"out_of_bounds_indexing",
|
||||
"overflow_check_conditional",
|
||||
"overly_complex_bool_expr",
|
||||
"panic",
|
||||
"panic_in_result_fn",
|
||||
"panicking_unwrap",
|
||||
"partial_pub_fields",
|
||||
"partialeq_ne_impl",
|
||||
"partialeq_to_none",
|
||||
"path_buf_push_overwrite",
|
||||
"pattern_type_mismatch",
|
||||
"possible_missing_comma",
|
||||
"precedence",
|
||||
"print_in_format_impl",
|
||||
"print_literal",
|
||||
"print_stderr",
|
||||
"print_stdout",
|
||||
"print_with_newline",
|
||||
"println_empty_string",
|
||||
"ptr_arg",
|
||||
"ptr_as_ptr",
|
||||
"ptr_eq",
|
||||
"ptr_offset_with_cast",
|
||||
"pub_use",
|
||||
"question_mark",
|
||||
"range_minus_one",
|
||||
"range_plus_one",
|
||||
"range_zip_with_len",
|
||||
"rc_buffer",
|
||||
"rc_clone_in_vec_init",
|
||||
"rc_mutex",
|
||||
"read_zero_byte_vec",
|
||||
"recursive_format_impl",
|
||||
"redundant_allocation",
|
||||
"redundant_clone",
|
||||
"redundant_closure",
|
||||
"redundant_closure_call",
|
||||
"redundant_closure_for_method_calls",
|
||||
"redundant_else",
|
||||
"redundant_feature_names",
|
||||
"redundant_field_names",
|
||||
"redundant_pattern",
|
||||
"redundant_pattern_matching",
|
||||
"redundant_pub_crate",
|
||||
"redundant_slicing",
|
||||
"redundant_static_lifetimes",
|
||||
"ref_binding_to_reference",
|
||||
"ref_option_ref",
|
||||
"repeat_once",
|
||||
"rest_pat_in_fully_bound_structs",
|
||||
"result_large_err",
|
||||
"result_map_or_into_option",
|
||||
"result_map_unit_fn",
|
||||
"result_unit_err",
|
||||
"return_self_not_must_use",
|
||||
"reversed_empty_ranges",
|
||||
"same_functions_in_if_condition",
|
||||
"same_item_push",
|
||||
"same_name_method",
|
||||
"search_is_some",
|
||||
"self_assignment",
|
||||
"self_named_constructors",
|
||||
"self_named_module_files",
|
||||
"semicolon_if_nothing_returned",
|
||||
"separated_literal_suffix",
|
||||
"serde_api_misuse",
|
||||
"shadow_reuse",
|
||||
"shadow_same",
|
||||
"shadow_unrelated",
|
||||
"short_circuit_statement",
|
||||
"should_implement_trait",
|
||||
"significant_drop_in_scrutinee",
|
||||
"similar_names",
|
||||
"single_char_add_str",
|
||||
"single_char_lifetime_names",
|
||||
"single_char_pattern",
|
||||
"single_component_path_imports",
|
||||
"single_element_loop",
|
||||
"single_match",
|
||||
"single_match_else",
|
||||
"size_of_in_element_count",
|
||||
"skip_while_next",
|
||||
"slow_vector_initialization",
|
||||
"stable_sort_primitive",
|
||||
"std_instead_of_alloc",
|
||||
"std_instead_of_core",
|
||||
"str_to_string",
|
||||
"string_add",
|
||||
"string_add_assign",
|
||||
"string_extend_chars",
|
||||
"string_from_utf8_as_bytes",
|
||||
"string_lit_as_bytes",
|
||||
"string_slice",
|
||||
"string_to_string",
|
||||
"strlen_on_c_strings",
|
||||
"struct_excessive_bools",
|
||||
"suboptimal_flops",
|
||||
"suspicious_arithmetic_impl",
|
||||
"suspicious_assignment_formatting",
|
||||
"suspicious_else_formatting",
|
||||
"suspicious_map",
|
||||
"suspicious_op_assign_impl",
|
||||
"suspicious_operation_groupings",
|
||||
"suspicious_splitn",
|
||||
"suspicious_to_owned",
|
||||
"suspicious_unary_op_formatting",
|
||||
"swap_ptr_to_ref",
|
||||
"tabs_in_doc_comments",
|
||||
"temporary_assignment",
|
||||
"to_digit_is_some",
|
||||
"to_string_in_format_args",
|
||||
"todo",
|
||||
"too_many_arguments",
|
||||
"too_many_lines",
|
||||
"toplevel_ref_arg",
|
||||
"trailing_empty_array",
|
||||
"trait_duplication_in_bounds",
|
||||
"transmute_bytes_to_str",
|
||||
"transmute_float_to_int",
|
||||
"transmute_int_to_bool",
|
||||
"transmute_int_to_char",
|
||||
"transmute_int_to_float",
|
||||
"transmute_num_to_bytes",
|
||||
"transmute_ptr_to_ptr",
|
||||
"transmute_ptr_to_ref",
|
||||
"transmute_undefined_repr",
|
||||
"transmutes_expressible_as_ptr_casts",
|
||||
"transmuting_null",
|
||||
"trim_split_whitespace",
|
||||
"trivial_regex",
|
||||
"trivially_copy_pass_by_ref",
|
||||
"try_err",
|
||||
"type_complexity",
|
||||
"type_repetition_in_bounds",
|
||||
"undocumented_unsafe_blocks",
|
||||
"undropped_manually_drops",
|
||||
"unicode_not_nfc",
|
||||
"unimplemented",
|
||||
"uninit_assumed_init",
|
||||
"uninit_vec",
|
||||
"uninlined_format_args",
|
||||
"unit_arg",
|
||||
"unit_cmp",
|
||||
"unit_hash",
|
||||
"unit_return_expecting_ord",
|
||||
"unnecessary_cast",
|
||||
"unnecessary_filter_map",
|
||||
"unnecessary_find_map",
|
||||
"unnecessary_fold",
|
||||
"unnecessary_join",
|
||||
"unnecessary_lazy_evaluations",
|
||||
"unnecessary_mut_passed",
|
||||
"unnecessary_operation",
|
||||
"unnecessary_owned_empty_strings",
|
||||
"unnecessary_self_imports",
|
||||
"unnecessary_sort_by",
|
||||
"unnecessary_to_owned",
|
||||
"unnecessary_unwrap",
|
||||
"unnecessary_wraps",
|
||||
"unneeded_field_pattern",
|
||||
"unneeded_wildcard_pattern",
|
||||
"unnested_or_patterns",
|
||||
"unreachable",
|
||||
"unreadable_literal",
|
||||
"unsafe_derive_deserialize",
|
||||
"unsafe_removed_from_name",
|
||||
"unseparated_literal_suffix",
|
||||
"unsound_collection_transmute",
|
||||
"unused_async",
|
||||
"unused_format_specs",
|
||||
"unused_io_amount",
|
||||
"unused_peekable",
|
||||
"unused_rounding",
|
||||
"unused_self",
|
||||
"unused_unit",
|
||||
"unusual_byte_groupings",
|
||||
"unwrap_in_result",
|
||||
"unwrap_or_else_default",
|
||||
"unwrap_used",
|
||||
"upper_case_acronyms",
|
||||
"use_debug",
|
||||
"use_self",
|
||||
"used_underscore_binding",
|
||||
"useless_asref",
|
||||
"useless_attribute",
|
||||
"useless_conversion",
|
||||
"useless_format",
|
||||
"useless_let_if_seq",
|
||||
"useless_transmute",
|
||||
"useless_vec",
|
||||
"vec_box",
|
||||
"vec_init_then_push",
|
||||
"vec_resize_to_zero",
|
||||
"verbose_bit_mask",
|
||||
"verbose_file_reads",
|
||||
"vtable_address_comparisons",
|
||||
"while_immutable_condition",
|
||||
"while_let_loop",
|
||||
"while_let_on_iterator",
|
||||
"wildcard_dependencies",
|
||||
"wildcard_enum_match_arm",
|
||||
"wildcard_imports",
|
||||
"wildcard_in_or_patterns",
|
||||
"write_literal",
|
||||
"write_with_newline",
|
||||
"writeln_empty_string",
|
||||
"wrong_self_convention",
|
||||
"wrong_transmute",
|
||||
"zero_divided_by_zero",
|
||||
"zero_prefixed_literal",
|
||||
"zero_ptr",
|
||||
"zero_sized_map_values",
|
||||
"zst_offset",
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
### What it does
|
||||
Checks for comparisons where one side of the relation is
|
||||
either the minimum or maximum value for its type and warns if it involves a
|
||||
case that is always true or always false. Only integer and boolean types are
|
||||
checked.
|
||||
|
||||
### Why is this bad?
|
||||
An expression like `min <= x` may misleadingly imply
|
||||
that it is possible for `x` to be less than the minimum. Expressions like
|
||||
`max < x` are probably mistakes.
|
||||
|
||||
### Known problems
|
||||
For `usize` the size of the current compile target will
|
||||
be assumed (e.g., 64 bits on 64 bit systems). This means code that uses such
|
||||
a comparison to detect target pointer width will trigger this lint. One can
|
||||
use `mem::sizeof` and compare its value or conditional compilation
|
||||
attributes
|
||||
like `#[cfg(target_pointer_width = "64")] ..` instead.
|
||||
|
||||
### Example
|
||||
```
|
||||
let vec: Vec<isize> = Vec::new();
|
||||
if vec.len() <= 0 {}
|
||||
if 100 > i32::MAX {}
|
||||
```
|
|
@ -1,18 +0,0 @@
|
|||
### What it does
|
||||
|
||||
Finds items imported through `alloc` when available through `core`.
|
||||
|
||||
### Why is this bad?
|
||||
|
||||
Crates which have `no_std` compatibility and may optionally require alloc may wish to ensure types are
|
||||
imported from core to ensure disabling `alloc` does not cause the crate to fail to compile. This lint
|
||||
is also useful for crates migrating to become `no_std` compatible.
|
||||
|
||||
### Example
|
||||
```
|
||||
use alloc::slice::from_ref;
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
use core::slice::from_ref;
|
||||
```
|
|
@ -1,22 +0,0 @@
|
|||
### What it does
|
||||
Checks for attributes that allow lints without a reason.
|
||||
|
||||
(This requires the `lint_reasons` feature)
|
||||
|
||||
### Why is this bad?
|
||||
Allowing a lint should always have a reason. This reason should be documented to
|
||||
ensure that others understand the reasoning
|
||||
|
||||
### Example
|
||||
```
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
#![allow(clippy::some_lint)]
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
#![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")]
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
Checks for ranges which almost include the entire range of letters from 'a' to 'z', but
|
||||
don't because they're a half open range.
|
||||
|
||||
### Why is this bad?
|
||||
This (`'a'..'z'`) is almost certainly a typo meant to include all letters.
|
||||
|
||||
### Example
|
||||
```
|
||||
let _ = 'a'..'z';
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let _ = 'a'..='z';
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
Checks for `foo = bar; bar = foo` sequences.
|
||||
|
||||
### Why is this bad?
|
||||
This looks like a failed attempt to swap.
|
||||
|
||||
### Example
|
||||
```
|
||||
a = b;
|
||||
b = a;
|
||||
```
|
||||
If swapping is intended, use `swap()` instead:
|
||||
```
|
||||
std::mem::swap(&mut a, &mut b);
|
||||
```
|
|
@ -1,24 +0,0 @@
|
|||
### What it does
|
||||
Checks for floating point literals that approximate
|
||||
constants which are defined in
|
||||
[`std::f32::consts`](https://doc.rust-lang.org/stable/std/f32/consts/#constants)
|
||||
or
|
||||
[`std::f64::consts`](https://doc.rust-lang.org/stable/std/f64/consts/#constants),
|
||||
respectively, suggesting to use the predefined constant.
|
||||
|
||||
### Why is this bad?
|
||||
Usually, the definition in the standard library is more
|
||||
precise than what people come up with. If you find that your definition is
|
||||
actually more precise, please [file a Rust
|
||||
issue](https://github.com/rust-lang/rust/issues).
|
||||
|
||||
### Example
|
||||
```
|
||||
let x = 3.14;
|
||||
let y = 1_f64 / x;
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let x = std::f32::consts::PI;
|
||||
let y = std::f64::consts::FRAC_1_PI;
|
||||
```
|
|
@ -1,33 +0,0 @@
|
|||
### What it does
|
||||
Checks any kind of arithmetic operation of any type.
|
||||
|
||||
Operators like `+`, `-`, `*` or `<<` are usually capable of overflowing according to the [Rust
|
||||
Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow),
|
||||
or can panic (`/`, `%`).
|
||||
|
||||
Known safe built-in types like `Wrapping` or `Saturating`, floats, operations in constant
|
||||
environments, allowed types and non-constant operations that won't overflow are ignored.
|
||||
|
||||
### Why is this bad?
|
||||
For integers, overflow will trigger a panic in debug builds or wrap the result in
|
||||
release mode; division by zero will cause a panic in either mode. As a result, it is
|
||||
desirable to explicitly call checked, wrapping or saturating arithmetic methods.
|
||||
|
||||
#### Example
|
||||
```
|
||||
// `n` can be any number, including `i32::MAX`.
|
||||
fn foo(n: i32) -> i32 {
|
||||
n + 1
|
||||
}
|
||||
```
|
||||
|
||||
Third-party types can also overflow or present unwanted side-effects.
|
||||
|
||||
#### Example
|
||||
```
|
||||
use rust_decimal::Decimal;
|
||||
let _n = Decimal::MAX + Decimal::MAX;
|
||||
```
|
||||
|
||||
### Allowed types
|
||||
Custom allowed types can be specified through the "arithmetic-side-effects-allowed" filter.
|
|
@ -1,32 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `as` conversions.
|
||||
|
||||
Note that this lint is specialized in linting *every single* use of `as`
|
||||
regardless of whether good alternatives exist or not.
|
||||
If you want more precise lints for `as`, please consider using these separate lints:
|
||||
`unnecessary_cast`, `cast_lossless/cast_possible_truncation/cast_possible_wrap/cast_precision_loss/cast_sign_loss`,
|
||||
`fn_to_numeric_cast(_with_truncation)`, `char_lit_as_u8`, `ref_to_mut` and `ptr_as_ptr`.
|
||||
There is a good explanation the reason why this lint should work in this way and how it is useful
|
||||
[in this issue](https://github.com/rust-lang/rust-clippy/issues/5122).
|
||||
|
||||
### Why is this bad?
|
||||
`as` conversions will perform many kinds of
|
||||
conversions, including silently lossy conversions and dangerous coercions.
|
||||
There are cases when it makes sense to use `as`, so the lint is
|
||||
Allow by default.
|
||||
|
||||
### Example
|
||||
```
|
||||
let a: u32;
|
||||
...
|
||||
f(a as u16);
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
f(a.try_into()?);
|
||||
|
||||
// or
|
||||
|
||||
f(a.try_into().expect("Unexpected u16 overflow in f"));
|
||||
```
|
|
@ -1,19 +0,0 @@
|
|||
### What it does
|
||||
Checks for the result of a `&self`-taking `as_ptr` being cast to a mutable pointer
|
||||
|
||||
### Why is this bad?
|
||||
Since `as_ptr` takes a `&self`, the pointer won't have write permissions unless interior
|
||||
mutability is used, making it unlikely that having it as a mutable pointer is correct.
|
||||
|
||||
### Example
|
||||
```
|
||||
let string = String::with_capacity(1);
|
||||
let ptr = string.as_ptr() as *mut u8;
|
||||
unsafe { ptr.write(4) }; // UNDEFINED BEHAVIOUR
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let mut string = String::with_capacity(1);
|
||||
let ptr = string.as_mut_ptr();
|
||||
unsafe { ptr.write(4) };
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
### What it does
|
||||
Check for the usage of `as _` conversion using inferred type.
|
||||
|
||||
### Why is this bad?
|
||||
The conversion might include lossy conversion and dangerous cast that might go
|
||||
undetected due to the type being inferred.
|
||||
|
||||
The lint is allowed by default as using `_` is less wordy than always specifying the type.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn foo(n: usize) {}
|
||||
let n: u16 = 256;
|
||||
foo(n as _);
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
fn foo(n: usize) {}
|
||||
let n: u16 = 256;
|
||||
foo(n as usize);
|
||||
```
|
|
@ -1,14 +0,0 @@
|
|||
### What it does
|
||||
Checks for `assert!(true)` and `assert!(false)` calls.
|
||||
|
||||
### Why is this bad?
|
||||
Will be optimized out by the compiler or should probably be replaced by a
|
||||
`panic!()` or `unreachable!()`
|
||||
|
||||
### Example
|
||||
```
|
||||
assert!(false)
|
||||
assert!(true)
|
||||
const B: bool = false;
|
||||
assert!(B)
|
||||
```
|
|
@ -1,14 +0,0 @@
|
|||
### What it does
|
||||
Checks for `assert!(r.is_ok())` or `assert!(r.is_err())` calls.
|
||||
|
||||
### Why is this bad?
|
||||
An assertion failure cannot output an useful message of the error.
|
||||
|
||||
### Known problems
|
||||
The suggested replacement decreases the readability of code and log output.
|
||||
|
||||
### Example
|
||||
```
|
||||
assert!(r.is_ok());
|
||||
assert!(r.is_err());
|
||||
```
|
|
@ -1,28 +0,0 @@
|
|||
### What it does
|
||||
Checks for `a = a op b` or `a = b commutative_op a`
|
||||
patterns.
|
||||
|
||||
### Why is this bad?
|
||||
These can be written as the shorter `a op= b`.
|
||||
|
||||
### Known problems
|
||||
While forbidden by the spec, `OpAssign` traits may have
|
||||
implementations that differ from the regular `Op` impl.
|
||||
|
||||
### Example
|
||||
```
|
||||
let mut a = 5;
|
||||
let b = 0;
|
||||
// ...
|
||||
|
||||
a = a + b;
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
let mut a = 5;
|
||||
let b = 0;
|
||||
// ...
|
||||
|
||||
a += b;
|
||||
```
|
|
@ -1,28 +0,0 @@
|
|||
### What it does
|
||||
Checks for async blocks that yield values of types
|
||||
that can themselves be awaited.
|
||||
|
||||
### Why is this bad?
|
||||
An await is likely missing.
|
||||
|
||||
### Example
|
||||
```
|
||||
async fn foo() {}
|
||||
|
||||
fn bar() {
|
||||
let x = async {
|
||||
foo()
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
async fn foo() {}
|
||||
|
||||
fn bar() {
|
||||
let x = async {
|
||||
foo().await
|
||||
};
|
||||
}
|
||||
```
|
|
@ -1,29 +0,0 @@
|
|||
### What it does
|
||||
Allows users to configure types which should not be held across `await`
|
||||
suspension points.
|
||||
|
||||
### Why is this bad?
|
||||
There are some types which are perfectly "safe" to be used concurrently
|
||||
from a memory access perspective but will cause bugs at runtime if they
|
||||
are held in such a way.
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
await-holding-invalid-types = [
|
||||
# You can specify a type name
|
||||
"CustomLockType",
|
||||
# You can (optionally) specify a reason
|
||||
{ path = "OtherCustomLockType", reason = "Relies on a thread local" }
|
||||
]
|
||||
```
|
||||
|
||||
```
|
||||
struct CustomLockType;
|
||||
struct OtherCustomLockType;
|
||||
async fn foo() {
|
||||
let _x = CustomLockType;
|
||||
let _y = OtherCustomLockType;
|
||||
baz().await; // Lint violation
|
||||
}
|
||||
```
|
|
@ -1,51 +0,0 @@
|
|||
### What it does
|
||||
Checks for calls to await while holding a non-async-aware MutexGuard.
|
||||
|
||||
### Why is this bad?
|
||||
The Mutex types found in std::sync and parking_lot
|
||||
are not designed to operate in an async context across await points.
|
||||
|
||||
There are two potential solutions. One is to use an async-aware Mutex
|
||||
type. Many asynchronous foundation crates provide such a Mutex type. The
|
||||
other solution is to ensure the mutex is unlocked before calling await,
|
||||
either by introducing a scope or an explicit call to Drop::drop.
|
||||
|
||||
### Known problems
|
||||
Will report false positive for explicitly dropped guards
|
||||
([#6446](https://github.com/rust-lang/rust-clippy/issues/6446)). A workaround for this is
|
||||
to wrap the `.lock()` call in a block instead of explicitly dropping the guard.
|
||||
|
||||
### Example
|
||||
```
|
||||
async fn foo(x: &Mutex<u32>) {
|
||||
let mut guard = x.lock().unwrap();
|
||||
*guard += 1;
|
||||
baz().await;
|
||||
}
|
||||
|
||||
async fn bar(x: &Mutex<u32>) {
|
||||
let mut guard = x.lock().unwrap();
|
||||
*guard += 1;
|
||||
drop(guard); // explicit drop
|
||||
baz().await;
|
||||
}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
async fn foo(x: &Mutex<u32>) {
|
||||
{
|
||||
let mut guard = x.lock().unwrap();
|
||||
*guard += 1;
|
||||
}
|
||||
baz().await;
|
||||
}
|
||||
|
||||
async fn bar(x: &Mutex<u32>) {
|
||||
{
|
||||
let mut guard = x.lock().unwrap();
|
||||
*guard += 1;
|
||||
} // guard dropped here at end of scope
|
||||
baz().await;
|
||||
}
|
||||
```
|
|
@ -1,47 +0,0 @@
|
|||
### What it does
|
||||
Checks for calls to await while holding a `RefCell` `Ref` or `RefMut`.
|
||||
|
||||
### Why is this bad?
|
||||
`RefCell` refs only check for exclusive mutable access
|
||||
at runtime. Holding onto a `RefCell` ref across an `await` suspension point
|
||||
risks panics from a mutable ref shared while other refs are outstanding.
|
||||
|
||||
### Known problems
|
||||
Will report false positive for explicitly dropped refs
|
||||
([#6353](https://github.com/rust-lang/rust-clippy/issues/6353)). A workaround for this is
|
||||
to wrap the `.borrow[_mut]()` call in a block instead of explicitly dropping the ref.
|
||||
|
||||
### Example
|
||||
```
|
||||
async fn foo(x: &RefCell<u32>) {
|
||||
let mut y = x.borrow_mut();
|
||||
*y += 1;
|
||||
baz().await;
|
||||
}
|
||||
|
||||
async fn bar(x: &RefCell<u32>) {
|
||||
let mut y = x.borrow_mut();
|
||||
*y += 1;
|
||||
drop(y); // explicit drop
|
||||
baz().await;
|
||||
}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
async fn foo(x: &RefCell<u32>) {
|
||||
{
|
||||
let mut y = x.borrow_mut();
|
||||
*y += 1;
|
||||
}
|
||||
baz().await;
|
||||
}
|
||||
|
||||
async fn bar(x: &RefCell<u32>) {
|
||||
{
|
||||
let mut y = x.borrow_mut();
|
||||
*y += 1;
|
||||
} // y dropped here at end of scope
|
||||
baz().await;
|
||||
}
|
||||
```
|
|
@ -1,30 +0,0 @@
|
|||
### What it does
|
||||
Checks for incompatible bit masks in comparisons.
|
||||
|
||||
The formula for detecting if an expression of the type `_ <bit_op> m
|
||||
<cmp_op> c` (where `<bit_op>` is one of {`&`, `|`} and `<cmp_op>` is one of
|
||||
{`!=`, `>=`, `>`, `!=`, `>=`, `>`}) can be determined from the following
|
||||
table:
|
||||
|
||||
|Comparison |Bit Op|Example |is always|Formula |
|
||||
|------------|------|-------------|---------|----------------------|
|
||||
|`==` or `!=`| `&` |`x & 2 == 3` |`false` |`c & m != c` |
|
||||
|`<` or `>=`| `&` |`x & 2 < 3` |`true` |`m < c` |
|
||||
|`>` or `<=`| `&` |`x & 1 > 1` |`false` |`m <= c` |
|
||||
|`==` or `!=`| `\|` |`x \| 1 == 0`|`false` |`c \| m != c` |
|
||||
|`<` or `>=`| `\|` |`x \| 1 < 1` |`false` |`m >= c` |
|
||||
|`<=` or `>` | `\|` |`x \| 1 > 0` |`true` |`m > c` |
|
||||
|
||||
### Why is this bad?
|
||||
If the bits that the comparison cares about are always
|
||||
set to zero or one by the bit mask, the comparison is constant `true` or
|
||||
`false` (depending on mask, compared value, and operators).
|
||||
|
||||
So the code is actively misleading, and the only reason someone would write
|
||||
this intentionally is to win an underhanded Rust contest or create a
|
||||
test-case for this lint.
|
||||
|
||||
### Example
|
||||
```
|
||||
if (x & 1 == 2) { }
|
||||
```
|
|
@ -1,22 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `_.and_then(|x| Some(y))`, `_.and_then(|x| Ok(y))` or
|
||||
`_.or_else(|x| Err(y))`.
|
||||
|
||||
### Why is this bad?
|
||||
Readability, this can be written more concisely as
|
||||
`_.map(|x| y)` or `_.map_err(|x| y)`.
|
||||
|
||||
### Example
|
||||
```
|
||||
let _ = opt().and_then(|s| Some(s.len()));
|
||||
let _ = res().and_then(|s| if s.len() == 42 { Ok(10) } else { Ok(20) });
|
||||
let _ = res().or_else(|s| if s.len() == 42 { Err(10) } else { Err(20) });
|
||||
```
|
||||
|
||||
The correct use would be:
|
||||
|
||||
```
|
||||
let _ = opt().map(|s| s.len());
|
||||
let _ = res().map(|s| if s.len() == 42 { 10 } else { 20 });
|
||||
let _ = res().map_err(|s| if s.len() == 42 { 10 } else { 20 });
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for `warn`/`deny`/`forbid` attributes targeting the whole clippy::restriction category.
|
||||
|
||||
### Why is this bad?
|
||||
Restriction lints sometimes are in contrast with other lints or even go against idiomatic rust.
|
||||
These lints should only be enabled on a lint-by-lint basis and with careful consideration.
|
||||
|
||||
### Example
|
||||
```
|
||||
#![deny(clippy::restriction)]
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
#![deny(clippy::as_conversions)]
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
### What it does
|
||||
Checks for `if` conditions that use blocks containing an
|
||||
expression, statements or conditions that use closures with blocks.
|
||||
|
||||
### Why is this bad?
|
||||
Style, using blocks in the condition makes it hard to read.
|
||||
|
||||
### Examples
|
||||
```
|
||||
if { true } { /* ... */ }
|
||||
|
||||
if { let x = somefunc(); x } { /* ... */ }
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
if true { /* ... */ }
|
||||
|
||||
let res = { let x = somefunc(); x };
|
||||
if res { /* ... */ }
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
This lint warns about boolean comparisons in assert-like macros.
|
||||
|
||||
### Why is this bad?
|
||||
It is shorter to use the equivalent.
|
||||
|
||||
### Example
|
||||
```
|
||||
assert_eq!("a".is_empty(), false);
|
||||
assert_ne!("a".is_empty(), true);
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
assert!(!"a".is_empty());
|
||||
```
|
|
@ -1,18 +0,0 @@
|
|||
### What it does
|
||||
Checks for expressions of the form `x == true`,
|
||||
`x != true` and order comparisons such as `x < true` (or vice versa) and
|
||||
suggest using the variable directly.
|
||||
|
||||
### Why is this bad?
|
||||
Unnecessary code.
|
||||
|
||||
### Example
|
||||
```
|
||||
if x == true {}
|
||||
if y == false {}
|
||||
```
|
||||
use `x` directly:
|
||||
```
|
||||
if x {}
|
||||
if !y {}
|
||||
```
|
|
@ -1,26 +0,0 @@
|
|||
### What it does
|
||||
Instead of using an if statement to convert a bool to an int,
|
||||
this lint suggests using a `from()` function or an `as` coercion.
|
||||
|
||||
### Why is this bad?
|
||||
Coercion or `from()` is idiomatic way to convert bool to a number.
|
||||
Both methods are guaranteed to return 1 for true, and 0 for false.
|
||||
|
||||
See https://doc.rust-lang.org/std/primitive.bool.html#impl-From%3Cbool%3E
|
||||
|
||||
### Example
|
||||
```
|
||||
if condition {
|
||||
1_i64
|
||||
} else {
|
||||
0
|
||||
};
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
i64::from(condition);
|
||||
```
|
||||
or
|
||||
```
|
||||
condition as i64;
|
||||
```
|
|
@ -1,26 +0,0 @@
|
|||
### What it does
|
||||
Checks for the usage of `&expr as *const T` or
|
||||
`&mut expr as *mut T`, and suggest using `ptr::addr_of` or
|
||||
`ptr::addr_of_mut` instead.
|
||||
|
||||
### Why is this bad?
|
||||
This would improve readability and avoid creating a reference
|
||||
that points to an uninitialized value or unaligned place.
|
||||
Read the `ptr::addr_of` docs for more information.
|
||||
|
||||
### Example
|
||||
```
|
||||
let val = 1;
|
||||
let p = &val as *const i32;
|
||||
|
||||
let mut val_mut = 1;
|
||||
let p_mut = &mut val_mut as *mut i32;
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let val = 1;
|
||||
let p = std::ptr::addr_of!(val);
|
||||
|
||||
let mut val_mut = 1;
|
||||
let p_mut = std::ptr::addr_of_mut!(val_mut);
|
||||
```
|
|
@ -1,27 +0,0 @@
|
|||
### What it does
|
||||
Checks for `&*(&T)`.
|
||||
|
||||
### Why is this bad?
|
||||
Dereferencing and then borrowing a reference value has no effect in most cases.
|
||||
|
||||
### Known problems
|
||||
False negative on such code:
|
||||
```
|
||||
let x = &12;
|
||||
let addr_x = &x as *const _ as usize;
|
||||
let addr_y = &&*x as *const _ as usize; // assert ok now, and lint triggered.
|
||||
// But if we fix it, assert will fail.
|
||||
assert_ne!(addr_x, addr_y);
|
||||
```
|
||||
|
||||
### Example
|
||||
```
|
||||
let s = &String::new();
|
||||
|
||||
let a: &String = &* s;
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
let a: &String = s;
|
||||
```
|
|
@ -1,40 +0,0 @@
|
|||
### What it does
|
||||
Checks if `const` items which is interior mutable (e.g.,
|
||||
contains a `Cell`, `Mutex`, `AtomicXxxx`, etc.) has been borrowed directly.
|
||||
|
||||
### Why is this bad?
|
||||
Consts are copied everywhere they are referenced, i.e.,
|
||||
every time you refer to the const a fresh instance of the `Cell` or `Mutex`
|
||||
or `AtomicXxxx` will be created, which defeats the whole purpose of using
|
||||
these types in the first place.
|
||||
|
||||
The `const` value should be stored inside a `static` item.
|
||||
|
||||
### Known problems
|
||||
When an enum has variants with interior mutability, use of its non
|
||||
interior mutable variants can generate false positives. See issue
|
||||
[#3962](https://github.com/rust-lang/rust-clippy/issues/3962)
|
||||
|
||||
Types that have underlying or potential interior mutability trigger the lint whether
|
||||
the interior mutable field is used or not. See issues
|
||||
[#5812](https://github.com/rust-lang/rust-clippy/issues/5812) and
|
||||
[#3825](https://github.com/rust-lang/rust-clippy/issues/3825)
|
||||
|
||||
### Example
|
||||
```
|
||||
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
|
||||
const CONST_ATOM: AtomicUsize = AtomicUsize::new(12);
|
||||
|
||||
CONST_ATOM.store(6, SeqCst); // the content of the atomic is unchanged
|
||||
assert_eq!(CONST_ATOM.load(SeqCst), 12); // because the CONST_ATOM in these lines are distinct
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
|
||||
const CONST_ATOM: AtomicUsize = AtomicUsize::new(12);
|
||||
|
||||
static STATIC_ATOM: AtomicUsize = CONST_ATOM;
|
||||
STATIC_ATOM.store(9, SeqCst);
|
||||
assert_eq!(STATIC_ATOM.load(SeqCst), 9); // use a `static` item to refer to the same instance
|
||||
```
|
|
@ -1,19 +0,0 @@
|
|||
### What it does
|
||||
Checks for use of `&Box<T>` anywhere in the code.
|
||||
Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information.
|
||||
|
||||
### Why is this bad?
|
||||
A `&Box<T>` parameter requires the function caller to box `T` first before passing it to a function.
|
||||
Using `&T` defines a concrete type for the parameter and generalizes the function, this would also
|
||||
auto-deref to `&T` at the function call site if passed a `&Box<T>`.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn foo(bar: &Box<T>) { ... }
|
||||
```
|
||||
|
||||
Better:
|
||||
|
||||
```
|
||||
fn foo(bar: &T) { ... }
|
||||
```
|
|
@ -1,23 +0,0 @@
|
|||
### What it does
|
||||
Checks for use of `Box<T>` where T is a collection such as Vec anywhere in the code.
|
||||
Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information.
|
||||
|
||||
### Why is this bad?
|
||||
Collections already keeps their contents in a separate area on
|
||||
the heap. So if you `Box` them, you just add another level of indirection
|
||||
without any benefit whatsoever.
|
||||
|
||||
### Example
|
||||
```
|
||||
struct X {
|
||||
values: Box<Vec<Foo>>,
|
||||
}
|
||||
```
|
||||
|
||||
Better:
|
||||
|
||||
```
|
||||
struct X {
|
||||
values: Vec<Foo>,
|
||||
}
|
||||
```
|
|
@ -1,17 +0,0 @@
|
|||
### What it does
|
||||
checks for `Box::new(T::default())`, which is better written as
|
||||
`Box::<T>::default()`.
|
||||
|
||||
### Why is this bad?
|
||||
First, it's more complex, involving two calls instead of one.
|
||||
Second, `Box::default()` can be faster
|
||||
[in certain cases](https://nnethercote.github.io/perf-book/standard-library-types.html#box).
|
||||
|
||||
### Example
|
||||
```
|
||||
let x: Box<String> = Box::new(Default::default());
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let x: Box<String> = Box::default();
|
||||
```
|
|
@ -1,18 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `Box<T>` where an unboxed `T` would
|
||||
work fine.
|
||||
|
||||
### Why is this bad?
|
||||
This is an unnecessary allocation, and bad for
|
||||
performance. It is only necessary to allocate if you wish to move the box
|
||||
into something.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn foo(x: Box<u32>) {}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
fn foo(x: u32) {}
|
||||
```
|
|
@ -1,32 +0,0 @@
|
|||
### What it does
|
||||
Checks if the `if` and `else` block contain shared code that can be
|
||||
moved out of the blocks.
|
||||
|
||||
### Why is this bad?
|
||||
Duplicate code is less maintainable.
|
||||
|
||||
### Known problems
|
||||
* The lint doesn't check if the moved expressions modify values that are being used in
|
||||
the if condition. The suggestion can in that case modify the behavior of the program.
|
||||
See [rust-clippy#7452](https://github.com/rust-lang/rust-clippy/issues/7452)
|
||||
|
||||
### Example
|
||||
```
|
||||
let foo = if … {
|
||||
println!("Hello World");
|
||||
13
|
||||
} else {
|
||||
println!("Hello World");
|
||||
42
|
||||
};
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
println!("Hello World");
|
||||
let foo = if … {
|
||||
13
|
||||
} else {
|
||||
42
|
||||
};
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
Warns if a generic shadows a built-in type.
|
||||
|
||||
### Why is this bad?
|
||||
This gives surprising type errors.
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
impl<u32> Foo<u32> {
|
||||
fn impl_func(&self) -> u32 {
|
||||
42
|
||||
}
|
||||
}
|
||||
```
|
|
@ -1,18 +0,0 @@
|
|||
### What it does
|
||||
It checks for `str::bytes().count()` and suggests replacing it with
|
||||
`str::len()`.
|
||||
|
||||
### Why is this bad?
|
||||
`str::bytes().count()` is longer and may not be as performant as using
|
||||
`str::len()`.
|
||||
|
||||
### Example
|
||||
```
|
||||
"hello".bytes().count();
|
||||
String::from("hello").bytes().count();
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
"hello".len();
|
||||
String::from("hello").len();
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for the use of `.bytes().nth()`.
|
||||
|
||||
### Why is this bad?
|
||||
`.as_bytes().get()` is more efficient and more
|
||||
readable.
|
||||
|
||||
### Example
|
||||
```
|
||||
"Hello".bytes().nth(3);
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
"Hello".as_bytes().get(3);
|
||||
```
|
|
@ -1,33 +0,0 @@
|
|||
### What it does
|
||||
Checks to see if all common metadata is defined in
|
||||
`Cargo.toml`. See: https://rust-lang-nursery.github.io/api-guidelines/documentation.html#cargotoml-includes-all-common-metadata-c-metadata
|
||||
|
||||
### Why is this bad?
|
||||
It will be more difficult for users to discover the
|
||||
purpose of the crate, and key information related to it.
|
||||
|
||||
### Example
|
||||
```
|
||||
[package]
|
||||
name = "clippy"
|
||||
version = "0.0.212"
|
||||
repository = "https://github.com/rust-lang/rust-clippy"
|
||||
readme = "README.md"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["clippy", "lint", "plugin"]
|
||||
categories = ["development-tools", "development-tools::cargo-plugins"]
|
||||
```
|
||||
|
||||
Should include a description field like:
|
||||
|
||||
```
|
||||
[package]
|
||||
name = "clippy"
|
||||
version = "0.0.212"
|
||||
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
|
||||
repository = "https://github.com/rust-lang/rust-clippy"
|
||||
readme = "README.md"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["clippy", "lint", "plugin"]
|
||||
categories = ["development-tools", "development-tools::cargo-plugins"]
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
### What it does
|
||||
Checks for calls to `ends_with` with possible file extensions
|
||||
and suggests to use a case-insensitive approach instead.
|
||||
|
||||
### Why is this bad?
|
||||
`ends_with` is case-sensitive and may not detect files with a valid extension.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn is_rust_file(filename: &str) -> bool {
|
||||
filename.ends_with(".rs")
|
||||
}
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
fn is_rust_file(filename: &str) -> bool {
|
||||
let filename = std::path::Path::new(filename);
|
||||
filename.extension()
|
||||
.map_or(false, |ext| ext.eq_ignore_ascii_case("rs"))
|
||||
}
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for uses of the `abs()` method that cast the result to unsigned.
|
||||
|
||||
### Why is this bad?
|
||||
The `unsigned_abs()` method avoids panic when called on the MIN value.
|
||||
|
||||
### Example
|
||||
```
|
||||
let x: i32 = -42;
|
||||
let y: u32 = x.abs() as u32;
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let x: i32 = -42;
|
||||
let y: u32 = x.unsigned_abs();
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts from an enum tuple constructor to an integer.
|
||||
|
||||
### Why is this bad?
|
||||
The cast is easily confused with casting a c-like enum value to an integer.
|
||||
|
||||
### Example
|
||||
```
|
||||
enum E { X(i32) };
|
||||
let _ = E::X as usize;
|
||||
```
|
|
@ -1,12 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts from an enum type to an integral type which will definitely truncate the
|
||||
value.
|
||||
|
||||
### Why is this bad?
|
||||
The resulting integral value will not match the value of the variant it came from.
|
||||
|
||||
### Example
|
||||
```
|
||||
enum E { X = 256 };
|
||||
let _ = E::X as u8;
|
||||
```
|
|
@ -1,26 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts between numerical types that may
|
||||
be replaced by safe conversion functions.
|
||||
|
||||
### Why is this bad?
|
||||
Rust's `as` keyword will perform many kinds of
|
||||
conversions, including silently lossy conversions. Conversion functions such
|
||||
as `i32::from` will only perform lossless conversions. Using the conversion
|
||||
functions prevents conversions from turning into silent lossy conversions if
|
||||
the types of the input expressions ever change, and make it easier for
|
||||
people reading the code to know that the conversion is lossless.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn as_u64(x: u8) -> u64 {
|
||||
x as u64
|
||||
}
|
||||
```
|
||||
|
||||
Using `::from` would look like this:
|
||||
|
||||
```
|
||||
fn as_u64(x: u8) -> u64 {
|
||||
u64::from(x)
|
||||
}
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
Checks for a known NaN float being cast to an integer
|
||||
|
||||
### Why is this bad?
|
||||
NaNs are cast into zero, so one could simply use this and make the
|
||||
code more readable. The lint could also hint at a programmer error.
|
||||
|
||||
### Example
|
||||
```
|
||||
let _: (0.0_f32 / 0.0) as u64;
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let _: = 0_u64;
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts between numerical types that may
|
||||
truncate large values. This is expected behavior, so the cast is `Allow` by
|
||||
default.
|
||||
|
||||
### Why is this bad?
|
||||
In some problem domains, it is good practice to avoid
|
||||
truncation. This lint can be activated to help assess where additional
|
||||
checks could be beneficial.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn as_u8(x: u64) -> u8 {
|
||||
x as u8
|
||||
}
|
||||
```
|
|
@ -1,17 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts from an unsigned type to a signed type of
|
||||
the same size. Performing such a cast is a 'no-op' for the compiler,
|
||||
i.e., nothing is changed at the bit level, and the binary representation of
|
||||
the value is reinterpreted. This can cause wrapping if the value is too big
|
||||
for the target signed type. However, the cast works as defined, so this lint
|
||||
is `Allow` by default.
|
||||
|
||||
### Why is this bad?
|
||||
While such a cast is not bad in itself, the results can
|
||||
be surprising when this is not the intended behavior, as demonstrated by the
|
||||
example below.
|
||||
|
||||
### Example
|
||||
```
|
||||
u32::MAX as i32; // will yield a value of `-1`
|
||||
```
|
|
@ -1,19 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts from any numerical to a float type where
|
||||
the receiving type cannot store all values from the original type without
|
||||
rounding errors. This possible rounding is to be expected, so this lint is
|
||||
`Allow` by default.
|
||||
|
||||
Basically, this warns on casting any integer with 32 or more bits to `f32`
|
||||
or any 64-bit integer to `f64`.
|
||||
|
||||
### Why is this bad?
|
||||
It's not bad at all. But in some applications it can be
|
||||
helpful to know where precision loss can take place. This lint can help find
|
||||
those places in the code.
|
||||
|
||||
### Example
|
||||
```
|
||||
let x = u64::MAX;
|
||||
x as f64;
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts, using `as` or `pointer::cast`,
|
||||
from a less-strictly-aligned pointer to a more-strictly-aligned pointer
|
||||
|
||||
### Why is this bad?
|
||||
Dereferencing the resulting pointer may be undefined
|
||||
behavior.
|
||||
|
||||
### Known problems
|
||||
Using `std::ptr::read_unaligned` and `std::ptr::write_unaligned` or similar
|
||||
on the resulting pointer is fine. Is over-zealous: Casts with manual alignment checks or casts like
|
||||
u64-> u8 -> u16 can be fine. Miri is able to do a more in-depth analysis.
|
||||
|
||||
### Example
|
||||
```
|
||||
let _ = (&1u8 as *const u8) as *const u16;
|
||||
let _ = (&mut 1u8 as *mut u8) as *mut u16;
|
||||
|
||||
(&1u8 as *const u8).cast::<u16>();
|
||||
(&mut 1u8 as *mut u8).cast::<u16>();
|
||||
```
|
|
@ -1,28 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts of `&T` to `&mut T` anywhere in the code.
|
||||
|
||||
### Why is this bad?
|
||||
It’s basically guaranteed to be undefined behavior.
|
||||
`UnsafeCell` is the only way to obtain aliasable data that is considered
|
||||
mutable.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn x(r: &i32) {
|
||||
unsafe {
|
||||
*(r as *const _ as *mut _) += 1;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Instead consider using interior mutability types.
|
||||
|
||||
```
|
||||
use std::cell::UnsafeCell;
|
||||
|
||||
fn x(r: &UnsafeCell<i32>) {
|
||||
unsafe {
|
||||
*r.get() += 1;
|
||||
}
|
||||
}
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
Checks for casts from a signed to an unsigned numerical
|
||||
type. In this case, negative values wrap around to large positive values,
|
||||
which can be quite surprising in practice. However, as the cast works as
|
||||
defined, this lint is `Allow` by default.
|
||||
|
||||
### Why is this bad?
|
||||
Possibly surprising results. You can activate this lint
|
||||
as a one-time check to see where numerical wrapping can arise.
|
||||
|
||||
### Example
|
||||
```
|
||||
let y: i8 = -1;
|
||||
y as u128; // will return 18446744073709551615
|
||||
```
|
|
@ -1,38 +0,0 @@
|
|||
### What it does
|
||||
Checks for `as` casts between raw pointers to slices with differently sized elements.
|
||||
|
||||
### Why is this bad?
|
||||
The produced raw pointer to a slice does not update its length metadata. The produced
|
||||
pointer will point to a different number of bytes than the original pointer because the
|
||||
length metadata of a raw slice pointer is in elements rather than bytes.
|
||||
Producing a slice reference from the raw pointer will either create a slice with
|
||||
less data (which can be surprising) or create a slice with more data and cause Undefined Behavior.
|
||||
|
||||
### Example
|
||||
// Missing data
|
||||
```
|
||||
let a = [1_i32, 2, 3, 4];
|
||||
let p = &a as *const [i32] as *const [u8];
|
||||
unsafe {
|
||||
println!("{:?}", &*p);
|
||||
}
|
||||
```
|
||||
// Undefined Behavior (note: also potential alignment issues)
|
||||
```
|
||||
let a = [1_u8, 2, 3, 4];
|
||||
let p = &a as *const [u8] as *const [u32];
|
||||
unsafe {
|
||||
println!("{:?}", &*p);
|
||||
}
|
||||
```
|
||||
Instead use `ptr::slice_from_raw_parts` to construct a slice from a data pointer and the correct length
|
||||
```
|
||||
let a = [1_i32, 2, 3, 4];
|
||||
let old_ptr = &a as *const [i32];
|
||||
// The data pointer is cast to a pointer to the target `u8` not `[u8]`
|
||||
// The length comes from the known length of 4 i32s times the 4 bytes per i32
|
||||
let new_ptr = core::ptr::slice_from_raw_parts(old_ptr as *const u8, 16);
|
||||
unsafe {
|
||||
println!("{:?}", &*new_ptr);
|
||||
}
|
||||
```
|
|
@ -1,20 +0,0 @@
|
|||
### What it does
|
||||
Checks for a raw slice being cast to a slice pointer
|
||||
|
||||
### Why is this bad?
|
||||
This can result in multiple `&mut` references to the same location when only a pointer is
|
||||
required.
|
||||
`ptr::slice_from_raw_parts` is a safe alternative that doesn't require
|
||||
the same [safety requirements] to be upheld.
|
||||
|
||||
### Example
|
||||
```
|
||||
let _: *const [u8] = std::slice::from_raw_parts(ptr, len) as *const _;
|
||||
let _: *mut [u8] = std::slice::from_raw_parts_mut(ptr, len) as *mut _;
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let _: *const [u8] = std::ptr::slice_from_raw_parts(ptr, len);
|
||||
let _: *mut [u8] = std::ptr::slice_from_raw_parts_mut(ptr, len);
|
||||
```
|
||||
[safety requirements]: https://doc.rust-lang.org/std/slice/fn.from_raw_parts.html#safety
|
|
@ -1,21 +0,0 @@
|
|||
### What it does
|
||||
Checks for expressions where a character literal is cast
|
||||
to `u8` and suggests using a byte literal instead.
|
||||
|
||||
### Why is this bad?
|
||||
In general, casting values to smaller types is
|
||||
error-prone and should be avoided where possible. In the particular case of
|
||||
converting a character literal to u8, it is easy to avoid by just using a
|
||||
byte literal instead. As an added bonus, `b'a'` is even slightly shorter
|
||||
than `'a' as u8`.
|
||||
|
||||
### Example
|
||||
```
|
||||
'x' as u8
|
||||
```
|
||||
|
||||
A better version, using the byte literal:
|
||||
|
||||
```
|
||||
b'x'
|
||||
```
|
|
@ -1,17 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `_.chars().last()` or
|
||||
`_.chars().next_back()` on a `str` to check if it ends with a given char.
|
||||
|
||||
### Why is this bad?
|
||||
Readability, this can be written more concisely as
|
||||
`_.ends_with(_)`.
|
||||
|
||||
### Example
|
||||
```
|
||||
name.chars().last() == Some('_') || name.chars().next_back() == Some('-');
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
name.ends_with('_') || name.ends_with('-');
|
||||
```
|
|
@ -1,19 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `.chars().next()` on a `str` to check
|
||||
if it starts with a given char.
|
||||
|
||||
### Why is this bad?
|
||||
Readability, this can be written more concisely as
|
||||
`_.starts_with(_)`.
|
||||
|
||||
### Example
|
||||
```
|
||||
let name = "foo";
|
||||
if name.chars().next() == Some('_') {};
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
let name = "foo";
|
||||
if name.starts_with('_') {};
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
Checks for explicit bounds checking when casting.
|
||||
|
||||
### Why is this bad?
|
||||
Reduces the readability of statements & is error prone.
|
||||
|
||||
### Example
|
||||
```
|
||||
foo <= i32::MAX as u32;
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
i32::try_from(foo).is_ok();
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `.clone()` on an `&&T`.
|
||||
|
||||
### Why is this bad?
|
||||
Cloning an `&&T` copies the inner `&T`, instead of
|
||||
cloning the underlying `T`.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn main() {
|
||||
let x = vec![1];
|
||||
let y = &&x;
|
||||
let z = y.clone();
|
||||
println!("{:p} {:p}", *y, z); // prints out the same pointer
|
||||
}
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `.clone()` on a `Copy` type.
|
||||
|
||||
### Why is this bad?
|
||||
The only reason `Copy` types implement `Clone` is for
|
||||
generics, not for using the `clone` method on a concrete type.
|
||||
|
||||
### Example
|
||||
```
|
||||
42u64.clone();
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of `.clone()` on a ref-counted pointer,
|
||||
(`Rc`, `Arc`, `rc::Weak`, or `sync::Weak`), and suggests calling Clone via unified
|
||||
function syntax instead (e.g., `Rc::clone(foo)`).
|
||||
|
||||
### Why is this bad?
|
||||
Calling '.clone()' on an Rc, Arc, or Weak
|
||||
can obscure the fact that only the pointer is being cloned, not the underlying
|
||||
data.
|
||||
|
||||
### Example
|
||||
```
|
||||
let x = Rc::new(1);
|
||||
|
||||
x.clone();
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
Rc::clone(&x);
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for usages of `cloned()` on an `Iterator` or `Option` where
|
||||
`copied()` could be used instead.
|
||||
|
||||
### Why is this bad?
|
||||
`copied()` is better because it guarantees that the type being cloned
|
||||
implements `Copy`.
|
||||
|
||||
### Example
|
||||
```
|
||||
[1, 2, 3].iter().cloned();
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
[1, 2, 3].iter().copied();
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for comparisons to NaN.
|
||||
|
||||
### Why is this bad?
|
||||
NaN does not compare meaningfully to anything – not
|
||||
even itself – so those comparisons are simply wrong.
|
||||
|
||||
### Example
|
||||
```
|
||||
if x == f32::NAN { }
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
if x.is_nan() { }
|
||||
```
|
|
@ -1,23 +0,0 @@
|
|||
### What it does
|
||||
This lint checks for equality comparisons with `ptr::null`
|
||||
|
||||
### Why is this bad?
|
||||
It's easier and more readable to use the inherent
|
||||
`.is_null()`
|
||||
method instead
|
||||
|
||||
### Example
|
||||
```
|
||||
use std::ptr;
|
||||
|
||||
if x == ptr::null {
|
||||
// ..
|
||||
}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
if x.is_null() {
|
||||
// ..
|
||||
}
|
||||
```
|
|
@ -1,18 +0,0 @@
|
|||
### What it does
|
||||
Checks for conversions to owned values just for the sake
|
||||
of a comparison.
|
||||
|
||||
### Why is this bad?
|
||||
The comparison can operate on a reference, so creating
|
||||
an owned value effectively throws it away directly afterwards, which is
|
||||
needlessly consuming code and heap space.
|
||||
|
||||
### Example
|
||||
```
|
||||
if x.to_owned() == y {}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
if x == y {}
|
||||
```
|
|
@ -1,13 +0,0 @@
|
|||
### What it does
|
||||
Checks for methods with high cognitive complexity.
|
||||
|
||||
### Why is this bad?
|
||||
Methods of high cognitive complexity tend to be hard to
|
||||
both read and maintain. Also LLVM will tend to optimize small methods better.
|
||||
|
||||
### Known problems
|
||||
Sometimes it's hard to find a way to reduce the
|
||||
complexity.
|
||||
|
||||
### Example
|
||||
You'll see it when you get the warning.
|
|
@ -1,29 +0,0 @@
|
|||
### What it does
|
||||
Checks for collapsible `else { if ... }` expressions
|
||||
that can be collapsed to `else if ...`.
|
||||
|
||||
### Why is this bad?
|
||||
Each `if`-statement adds one level of nesting, which
|
||||
makes code look more complex than it really is.
|
||||
|
||||
### Example
|
||||
```
|
||||
|
||||
if x {
|
||||
…
|
||||
} else {
|
||||
if y {
|
||||
…
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Should be written:
|
||||
|
||||
```
|
||||
if x {
|
||||
…
|
||||
} else if y {
|
||||
…
|
||||
}
|
||||
```
|
|
@ -1,23 +0,0 @@
|
|||
### What it does
|
||||
Checks for nested `if` statements which can be collapsed
|
||||
by `&&`-combining their conditions.
|
||||
|
||||
### Why is this bad?
|
||||
Each `if`-statement adds one level of nesting, which
|
||||
makes code look more complex than it really is.
|
||||
|
||||
### Example
|
||||
```
|
||||
if x {
|
||||
if y {
|
||||
// …
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
if x && y {
|
||||
// …
|
||||
}
|
||||
```
|
|
@ -1,31 +0,0 @@
|
|||
### What it does
|
||||
Finds nested `match` or `if let` expressions where the patterns may be "collapsed" together
|
||||
without adding any branches.
|
||||
|
||||
Note that this lint is not intended to find _all_ cases where nested match patterns can be merged, but only
|
||||
cases where merging would most likely make the code more readable.
|
||||
|
||||
### Why is this bad?
|
||||
It is unnecessarily verbose and complex.
|
||||
|
||||
### Example
|
||||
```
|
||||
fn func(opt: Option<Result<u64, String>>) {
|
||||
let n = match opt {
|
||||
Some(n) => match n {
|
||||
Ok(n) => n,
|
||||
_ => return,
|
||||
}
|
||||
None => return,
|
||||
};
|
||||
}
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
fn func(opt: Option<Result<u64, String>>) {
|
||||
let n = match opt {
|
||||
Some(Ok(n)) => n,
|
||||
_ => return,
|
||||
};
|
||||
}
|
||||
```
|
|
@ -1,19 +0,0 @@
|
|||
### What it does
|
||||
Checks for consecutive calls to `str::replace` (2 or more)
|
||||
that can be collapsed into a single call.
|
||||
|
||||
### Why is this bad?
|
||||
Consecutive `str::replace` calls scan the string multiple times
|
||||
with repetitive code.
|
||||
|
||||
### Example
|
||||
```
|
||||
let hello = "hesuo worpd"
|
||||
.replace('s', "l")
|
||||
.replace("u", "l")
|
||||
.replace('p', "l");
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let hello = "hesuo worpd".replace(&['s', 'u', 'p'], "l");
|
||||
```
|
|
@ -1,36 +0,0 @@
|
|||
### What it does
|
||||
Checks comparison chains written with `if` that can be
|
||||
rewritten with `match` and `cmp`.
|
||||
|
||||
### Why is this bad?
|
||||
`if` is not guaranteed to be exhaustive and conditionals can get
|
||||
repetitive
|
||||
|
||||
### Known problems
|
||||
The match statement may be slower due to the compiler
|
||||
not inlining the call to cmp. See issue [#5354](https://github.com/rust-lang/rust-clippy/issues/5354)
|
||||
|
||||
### Example
|
||||
```
|
||||
fn f(x: u8, y: u8) {
|
||||
if x > y {
|
||||
a()
|
||||
} else if x < y {
|
||||
b()
|
||||
} else {
|
||||
c()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
use std::cmp::Ordering;
|
||||
fn f(x: u8, y: u8) {
|
||||
match x.cmp(&y) {
|
||||
Ordering::Greater => a(),
|
||||
Ordering::Less => b(),
|
||||
Ordering::Equal => c()
|
||||
}
|
||||
}
|
||||
```
|
|
@ -1,31 +0,0 @@
|
|||
### What it does
|
||||
Checks for comparing to an empty slice such as `""` or `[]`,
|
||||
and suggests using `.is_empty()` where applicable.
|
||||
|
||||
### Why is this bad?
|
||||
Some structures can answer `.is_empty()` much faster
|
||||
than checking for equality. So it is good to get into the habit of using
|
||||
`.is_empty()`, and having it is cheap.
|
||||
Besides, it makes the intent clearer than a manual comparison in some contexts.
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
if s == "" {
|
||||
..
|
||||
}
|
||||
|
||||
if arr == [] {
|
||||
..
|
||||
}
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
if s.is_empty() {
|
||||
..
|
||||
}
|
||||
|
||||
if arr.is_empty() {
|
||||
..
|
||||
}
|
||||
```
|
|
@ -1,20 +0,0 @@
|
|||
### What it does
|
||||
Checks for types that implement `Copy` as well as
|
||||
`Iterator`.
|
||||
|
||||
### Why is this bad?
|
||||
Implicit copies can be confusing when working with
|
||||
iterator combinators.
|
||||
|
||||
### Example
|
||||
```
|
||||
#[derive(Copy, Clone)]
|
||||
struct Countdown(u8);
|
||||
|
||||
impl Iterator for Countdown {
|
||||
// ...
|
||||
}
|
||||
|
||||
let a: Vec<_> = my_iterator.take(1).collect();
|
||||
let b: Vec<_> = my_iterator.collect();
|
||||
```
|
|
@ -1,35 +0,0 @@
|
|||
### What it does
|
||||
Checks for use of `crate` as opposed to `$crate` in a macro definition.
|
||||
|
||||
### Why is this bad?
|
||||
`crate` refers to the macro call's crate, whereas `$crate` refers to the macro definition's
|
||||
crate. Rarely is the former intended. See:
|
||||
https://doc.rust-lang.org/reference/macros-by-example.html#hygiene
|
||||
|
||||
### Example
|
||||
```
|
||||
#[macro_export]
|
||||
macro_rules! print_message {
|
||||
() => {
|
||||
println!("{}", crate::MESSAGE);
|
||||
};
|
||||
}
|
||||
pub const MESSAGE: &str = "Hello!";
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
#[macro_export]
|
||||
macro_rules! print_message {
|
||||
() => {
|
||||
println!("{}", $crate::MESSAGE);
|
||||
};
|
||||
}
|
||||
pub const MESSAGE: &str = "Hello!";
|
||||
```
|
||||
|
||||
Note that if the use of `crate` is intentional, an `allow` attribute can be applied to the
|
||||
macro definition, e.g.:
|
||||
```
|
||||
#[allow(clippy::crate_in_macro_def)]
|
||||
macro_rules! ok { ... crate::foo ... }
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
Checks usage of `std::fs::create_dir` and suggest using `std::fs::create_dir_all` instead.
|
||||
|
||||
### Why is this bad?
|
||||
Sometimes `std::fs::create_dir` is mistakenly chosen over `std::fs::create_dir_all`.
|
||||
|
||||
### Example
|
||||
```
|
||||
std::fs::create_dir("foo");
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
std::fs::create_dir_all("foo");
|
||||
```
|
|
@ -1,12 +0,0 @@
|
|||
### What it does
|
||||
Checks for transmutes between a type `T` and `*T`.
|
||||
|
||||
### Why is this bad?
|
||||
It's easy to mistakenly transmute between a type and a
|
||||
pointer to that type.
|
||||
|
||||
### Example
|
||||
```
|
||||
core::intrinsics::transmute(t) // where the result type is the same as
|
||||
// `*t` or `&t`'s
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of dbg!() macro.
|
||||
|
||||
### Why is this bad?
|
||||
`dbg!` macro is intended as a debugging tool. It
|
||||
should not be in version control.
|
||||
|
||||
### Example
|
||||
```
|
||||
dbg!(true)
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
true
|
||||
```
|
|
@ -1,18 +0,0 @@
|
|||
### What it does
|
||||
Checks for function/method calls with a mutable
|
||||
parameter in `debug_assert!`, `debug_assert_eq!` and `debug_assert_ne!` macros.
|
||||
|
||||
### Why is this bad?
|
||||
In release builds `debug_assert!` macros are optimized out by the
|
||||
compiler.
|
||||
Therefore mutating something in a `debug_assert!` macro results in different behavior
|
||||
between a release and debug build.
|
||||
|
||||
### Example
|
||||
```
|
||||
debug_assert_eq!(vec![3].pop(), Some(3));
|
||||
|
||||
// or
|
||||
|
||||
debug_assert!(takes_a_mut_parameter(&mut x));
|
||||
```
|
|
@ -1,13 +0,0 @@
|
|||
### What it does
|
||||
Warns if there is a better representation for a numeric literal.
|
||||
|
||||
### Why is this bad?
|
||||
Especially for big powers of 2 a hexadecimal representation is more
|
||||
readable than a decimal representation.
|
||||
|
||||
### Example
|
||||
```
|
||||
`255` => `0xFF`
|
||||
`65_535` => `0xFFFF`
|
||||
`4_042_322_160` => `0xF0F0_F0F0`
|
||||
```
|
|
@ -1,46 +0,0 @@
|
|||
### What it does
|
||||
Checks for declaration of `const` items which is interior
|
||||
mutable (e.g., contains a `Cell`, `Mutex`, `AtomicXxxx`, etc.).
|
||||
|
||||
### Why is this bad?
|
||||
Consts are copied everywhere they are referenced, i.e.,
|
||||
every time you refer to the const a fresh instance of the `Cell` or `Mutex`
|
||||
or `AtomicXxxx` will be created, which defeats the whole purpose of using
|
||||
these types in the first place.
|
||||
|
||||
The `const` should better be replaced by a `static` item if a global
|
||||
variable is wanted, or replaced by a `const fn` if a constructor is wanted.
|
||||
|
||||
### Known problems
|
||||
A "non-constant" const item is a legacy way to supply an
|
||||
initialized value to downstream `static` items (e.g., the
|
||||
`std::sync::ONCE_INIT` constant). In this case the use of `const` is legit,
|
||||
and this lint should be suppressed.
|
||||
|
||||
Even though the lint avoids triggering on a constant whose type has enums that have variants
|
||||
with interior mutability, and its value uses non interior mutable variants (see
|
||||
[#3962](https://github.com/rust-lang/rust-clippy/issues/3962) and
|
||||
[#3825](https://github.com/rust-lang/rust-clippy/issues/3825) for examples);
|
||||
it complains about associated constants without default values only based on its types;
|
||||
which might not be preferable.
|
||||
There're other enums plus associated constants cases that the lint cannot handle.
|
||||
|
||||
Types that have underlying or potential interior mutability trigger the lint whether
|
||||
the interior mutable field is used or not. See issues
|
||||
[#5812](https://github.com/rust-lang/rust-clippy/issues/5812) and
|
||||
|
||||
### Example
|
||||
```
|
||||
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
|
||||
|
||||
const CONST_ATOM: AtomicUsize = AtomicUsize::new(12);
|
||||
CONST_ATOM.store(6, SeqCst); // the content of the atomic is unchanged
|
||||
assert_eq!(CONST_ATOM.load(SeqCst), 12); // because the CONST_ATOM in these lines are distinct
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
static STATIC_ATOM: AtomicUsize = AtomicUsize::new(15);
|
||||
STATIC_ATOM.store(9, SeqCst);
|
||||
assert_eq!(STATIC_ATOM.load(SeqCst), 9); // use a `static` item to refer to the same instance
|
||||
```
|
|
@ -1,15 +0,0 @@
|
|||
### What it does
|
||||
It checks for `std::iter::Empty::default()` and suggests replacing it with
|
||||
`std::iter::empty()`.
|
||||
### Why is this bad?
|
||||
`std::iter::empty()` is the more idiomatic way.
|
||||
### Example
|
||||
```
|
||||
let _ = std::iter::Empty::<usize>::default();
|
||||
let iter: std::iter::Empty<usize> = std::iter::Empty::default();
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
let _ = std::iter::empty::<usize>();
|
||||
let iter: std::iter::Empty<usize> = std::iter::empty();
|
||||
```
|
|
@ -1,28 +0,0 @@
|
|||
### What it does
|
||||
Checks for usage of unconstrained numeric literals which may cause default numeric fallback in type
|
||||
inference.
|
||||
|
||||
Default numeric fallback means that if numeric types have not yet been bound to concrete
|
||||
types at the end of type inference, then integer type is bound to `i32`, and similarly
|
||||
floating type is bound to `f64`.
|
||||
|
||||
See [RFC0212](https://github.com/rust-lang/rfcs/blob/master/text/0212-restore-int-fallback.md) for more information about the fallback.
|
||||
|
||||
### Why is this bad?
|
||||
For those who are very careful about types, default numeric fallback
|
||||
can be a pitfall that cause unexpected runtime behavior.
|
||||
|
||||
### Known problems
|
||||
This lint can only be allowed at the function level or above.
|
||||
|
||||
### Example
|
||||
```
|
||||
let i = 10;
|
||||
let f = 1.23;
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
let i = 10i32;
|
||||
let f = 1.23f64;
|
||||
```
|
|
@ -1,16 +0,0 @@
|
|||
### What it does
|
||||
Checks for literal calls to `Default::default()`.
|
||||
|
||||
### Why is this bad?
|
||||
It's easier for the reader if the name of the type is used, rather than the
|
||||
generic `Default`.
|
||||
|
||||
### Example
|
||||
```
|
||||
let s: String = Default::default();
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
let s = String::default();
|
||||
```
|
|
@ -1,36 +0,0 @@
|
|||
### What it does
|
||||
Displays a warning when a union is declared with the default representation (without a `#[repr(C)]` attribute).
|
||||
|
||||
### Why is this bad?
|
||||
Unions in Rust have unspecified layout by default, despite many people thinking that they
|
||||
lay out each field at the start of the union (like C does). That is, there are no guarantees
|
||||
about the offset of the fields for unions with multiple non-ZST fields without an explicitly
|
||||
specified layout. These cases may lead to undefined behavior in unsafe blocks.
|
||||
|
||||
### Example
|
||||
```
|
||||
union Foo {
|
||||
a: i32,
|
||||
b: u32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _x: u32 = unsafe {
|
||||
Foo { a: 0_i32 }.b // Undefined behavior: `b` is allowed to be padding
|
||||
};
|
||||
}
|
||||
```
|
||||
Use instead:
|
||||
```
|
||||
#[repr(C)]
|
||||
union Foo {
|
||||
a: i32,
|
||||
b: u32,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _x: u32 = unsafe {
|
||||
Foo { a: 0_i32 }.b // Now defined behavior, this is just an i32 -> u32 transmute
|
||||
};
|
||||
}
|
||||
```
|
|
@ -1,24 +0,0 @@
|
|||
### What it does
|
||||
Checks for `#[cfg_attr(rustfmt, rustfmt_skip)]` and suggests to replace it
|
||||
with `#[rustfmt::skip]`.
|
||||
|
||||
### Why is this bad?
|
||||
Since tool_attributes ([rust-lang/rust#44690](https://github.com/rust-lang/rust/issues/44690))
|
||||
are stable now, they should be used instead of the old `cfg_attr(rustfmt)` attributes.
|
||||
|
||||
### Known problems
|
||||
This lint doesn't detect crate level inner attributes, because they get
|
||||
processed before the PreExpansionPass lints get executed. See
|
||||
[#3123](https://github.com/rust-lang/rust-clippy/pull/3123#issuecomment-422321765)
|
||||
|
||||
### Example
|
||||
```
|
||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||
fn main() { }
|
||||
```
|
||||
|
||||
Use instead:
|
||||
```
|
||||
#[rustfmt::skip]
|
||||
fn main() { }
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue