1 //! This file is managed by `cargo dev update_lints`. Do not edit or format this file.
3 use std::lazy::SyncLazy;
8 pub use lint::LINT_LEVELS;
11 pub static ALL_LINTS: SyncLazy<Vec<Lint>> = SyncLazy::new(|| {
12 // begin lint list, do not remove this comment, it’s used in `update_lints`
15 name: "absurd_extreme_comparisons",
17 desc: "a comparison with a maximum or minimum value that is always true or false",
22 name: "almost_swapped",
24 desc: "`foo = bar; bar = foo` sequence",
29 name: "approx_constant",
31 desc: "the approximate of a known float constant (in `std::fXX::consts`)",
33 module: "approx_const",
36 name: "as_conversions",
38 desc: "using a potentially dangerous silent `as` conversion",
40 module: "as_conversions",
43 name: "assertions_on_constants",
45 desc: "`assert!(true)` / `assert!(false)` will be optimized out by the compiler, and should probably be replaced by a `panic!()` or `unreachable!()`",
47 module: "assertions_on_constants",
50 name: "assign_op_pattern",
52 desc: "assigning the result of an operation on a variable to that same variable",
57 name: "async_yields_async",
59 desc: "async blocks that return a type that can be awaited",
61 module: "async_yields_async",
64 name: "await_holding_lock",
66 desc: "Inside an async function, holding a MutexGuard while calling await",
68 module: "await_holding_invalid",
71 name: "await_holding_refcell_ref",
73 desc: "Inside an async function, holding a RefCell ref while calling await",
75 module: "await_holding_invalid",
80 desc: "expressions of the form `_ & mask == select` that will only ever return `true` or `false`",
85 name: "bind_instead_of_map",
87 desc: "using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`",
92 name: "blacklisted_name",
94 desc: "usage of a blacklisted/placeholder name",
96 module: "blacklisted_name",
99 name: "blanket_clippy_restriction_lints",
101 desc: "enabling the complete restriction group",
106 name: "blocks_in_if_conditions",
108 desc: "useless or complex blocks that can be eliminated in conditions",
110 module: "blocks_in_if_conditions",
113 name: "bool_comparison",
115 desc: "comparing a variable to a boolean, e.g., `if x == true` or `if x != true`",
117 module: "needless_bool",
120 name: "borrow_interior_mutable_const",
122 desc: "referencing `const` with interior mutability",
124 module: "non_copy_const",
127 name: "borrowed_box",
129 desc: "a borrow of a boxed type",
136 desc: "usage of `Box<Vec<T>>`, vector elements are already on the heap",
143 desc: "using `Box<T>` where unnecessary",
148 name: "builtin_type_shadow",
150 desc: "shadowing a builtin type",
152 module: "misc_early",
155 name: "cargo_common_metadata",
157 desc: "common metadata is defined in `Cargo.toml`",
159 module: "cargo_common_metadata",
162 name: "cast_lossless",
164 desc: "casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`",
169 name: "cast_possible_truncation",
171 desc: "casts that may cause truncation of the value, e.g., `x as u8` where `x: u32`, or `x as i32` where `x: f32`",
176 name: "cast_possible_wrap",
178 desc: "casts that may cause wrapping around the value, e.g., `x as i32` where `x: u32` and `x > i32::MAX`",
183 name: "cast_precision_loss",
185 desc: "casts that cause loss of precision, e.g., `x as f32` where `x: u64`",
190 name: "cast_ptr_alignment",
192 desc: "cast from a pointer to a more-strictly-aligned pointer",
197 name: "cast_ref_to_mut",
198 group: "correctness",
199 desc: "a cast of reference to a mutable pointer",
204 name: "cast_sign_loss",
206 desc: "casts from signed types to unsigned types, e.g., `x as u32` where `x: i32`",
211 name: "char_lit_as_u8",
213 desc: "casting a character literal to `u8` truncates",
218 name: "chars_last_cmp",
220 desc: "using `.chars().last()` or `.chars().next_back()` to check if a string ends with a char",
225 name: "chars_next_cmp",
227 desc: "using `.chars().next()` to check if a string starts with a char",
232 name: "checked_conversions",
234 desc: "`try_from` could replace manual bounds checking when casting",
236 module: "checked_conversions",
239 name: "clone_double_ref",
240 group: "correctness",
241 desc: "using `clone` on `&&T`",
246 name: "clone_on_copy",
248 desc: "using `clone` on a `Copy` type",
253 name: "clone_on_ref_ptr",
254 group: "restriction",
255 desc: "using \'clone\' on a ref-counted pointer",
261 group: "correctness",
262 desc: "comparisons to `NAN`, which will always return false, probably not intended",
269 desc: "comparing a pointer to a null pointer, suggesting to use `.is_null()` instead.",
276 desc: "creating owned instances for comparing with others, e.g., `x == \"foo\".to_string()`",
281 name: "cognitive_complexity",
283 desc: "functions that should be split up into multiple functions",
285 module: "cognitive_complexity",
288 name: "collapsible_if",
290 desc: "`if`s that can be collapsed (e.g., `if x { if y { ... } }` and `else { if x { ... } }`)",
292 module: "collapsible_if",
295 name: "comparison_chain",
297 desc: "`if`s that can be rewritten with `match` and `cmp`",
299 module: "comparison_chain",
302 name: "comparison_to_empty",
304 desc: "checking `x == \"\"` or `x == []` (or similar) when `.is_empty()` could be used instead",
309 name: "copy_iterator",
311 desc: "implementing `Iterator` on a `Copy` type",
313 module: "copy_iterator",
317 group: "restriction",
318 desc: "calling `std::fs::create_dir` instead of `std::fs::create_dir_all`",
320 module: "create_dir",
323 name: "crosspointer_transmute",
325 desc: "transmutes that have to or from types that are a pointer to the other",
331 group: "restriction",
332 desc: "`dbg!` macro is intended as a debugging tool",
337 name: "debug_assert_with_mut_call",
339 desc: "mutable arguments in `debug_assert{,_ne,_eq}!`",
341 module: "mutable_debug_assertion",
344 name: "decimal_literal_representation",
345 group: "restriction",
346 desc: "using decimal representation when hexadecimal would be better",
348 module: "literal_representation",
351 name: "declare_interior_mutable_const",
353 desc: "declaring `const` with interior mutability",
355 module: "non_copy_const",
358 name: "default_trait_access",
360 desc: "checks for literal calls to `Default::default()`",
365 name: "deprecated_cfg_attr",
367 desc: "usage of `cfg_attr(rustfmt)` instead of tool attributes",
372 name: "deprecated_semver",
373 group: "correctness",
374 desc: "use of `#[deprecated(since = \"x\")]` where x is not semver",
379 name: "deref_addrof",
381 desc: "use of `*&` or `*&mut` in an expression",
386 name: "derive_hash_xor_eq",
387 group: "correctness",
388 desc: "deriving `Hash` but implementing `PartialEq` explicitly",
393 name: "derive_ord_xor_partial_ord",
394 group: "correctness",
395 desc: "deriving `Ord` but implementing `PartialOrd` explicitly",
400 name: "disallowed_method",
402 desc: "use of a disallowed method call",
404 module: "disallowed_method",
407 name: "diverging_sub_expression",
409 desc: "whether an expression contains a diverging sub expression",
411 module: "eval_order_dependence",
414 name: "doc_markdown",
416 desc: "presence of `_`, `::` or camel-case outside backticks in documentation",
421 name: "double_comparisons",
423 desc: "unnecessary double comparisons that can be simplified",
425 module: "double_comparison",
428 name: "double_must_use",
430 desc: "`#[must_use]` attribute on a `#[must_use]`-returning function / method",
437 desc: "`--x`, which is a double negation of `x` and not a pre-decrement as in C/C++",
439 module: "misc_early",
442 name: "double_parens",
444 desc: "Warn on unnecessary double parentheses",
446 module: "double_parens",
450 group: "correctness",
451 desc: "calls to `std::mem::drop` with a value that implements Copy",
453 module: "drop_forget_ref",
457 group: "correctness",
458 desc: "calls to `std::mem::drop` with a reference instead of an owned value",
460 module: "drop_forget_ref",
463 name: "duplicate_underscore_argument",
465 desc: "function arguments having names which only differ by an underscore",
467 module: "misc_early",
470 name: "duration_subsec",
472 desc: "checks for calculation of subsecond microseconds or milliseconds",
474 module: "duration_subsec",
477 name: "else_if_without_else",
478 group: "restriction",
479 desc: "`if` expression with an `else if`, but without a final `else` branch",
481 module: "else_if_without_else",
486 desc: "enum with no variants",
488 module: "empty_enum",
491 name: "empty_line_after_outer_attr",
493 desc: "empty line after outer attribute",
500 desc: "empty `loop {}`, which should block or sleep",
505 name: "enum_clike_unportable_variant",
506 group: "correctness",
507 desc: "C-like enums that are `repr(isize/usize)` and have values that don\'t fit into an `i32`",
509 module: "enum_clike",
512 name: "enum_glob_use",
514 desc: "use items that import all variants of an enum",
516 module: "wildcard_imports",
519 name: "enum_variant_names",
521 desc: "enums where all variants share a prefix/postfix",
523 module: "enum_variants",
527 group: "correctness",
528 desc: "equal operands on both sides of a comparison or bitwise combination (e.g., `x == x`)",
534 group: "correctness",
535 desc: "using erasing operations, e.g., `x * 0` or `y & 0`",
537 module: "erasing_op",
540 name: "eval_order_dependence",
542 desc: "whether a variable read occurs before a write depends on sub-expression evaluation order",
544 module: "eval_order_dependence",
547 name: "excessive_precision",
549 desc: "excessive precision for float literal",
551 module: "float_literal",
555 group: "restriction",
556 desc: "`std::process::exit` is called, terminating the program",
561 name: "expect_fun_call",
563 desc: "using any `expect` method with a function call",
569 group: "restriction",
570 desc: "using `.expect()` on `Result` or `Option`, which might be better handled",
575 name: "expl_impl_clone_on_copy",
577 desc: "implementing `Clone` explicitly on `Copy` types",
582 name: "explicit_counter_loop",
584 desc: "for-looping with an explicit counter when `_.enumerate()` would do",
589 name: "explicit_deref_methods",
591 desc: "Explicit use of deref or deref_mut method while not in a method chain.",
593 module: "dereference",
596 name: "explicit_into_iter_loop",
598 desc: "for-looping over `_.into_iter()` when `_` would do",
603 name: "explicit_iter_loop",
605 desc: "for-looping over `_.iter()` or `_.iter_mut()` when `&_` or `&mut _` would do",
610 name: "explicit_write",
612 desc: "using the `write!()` family of functions instead of the `print!()` family of functions, when using the latter would work",
614 module: "explicit_write",
617 name: "extra_unused_lifetimes",
619 desc: "unused lifetimes in function definitions",
624 name: "fallible_impl_from",
626 desc: "Warn on impls of `From<..>` that contain `panic!()` or `unwrap()`",
628 module: "fallible_impl_from",
631 name: "field_reassign_with_default",
633 desc: "binding initialized with Default should have its fields set in the initializer",
638 name: "filetype_is_file",
639 group: "restriction",
640 desc: "`FileType::is_file` is not recommended to test for readable file type",
647 desc: "using combinations of `filter`, `map`, `filter_map` and `flat_map` which can usually be written as a single method call",
652 name: "filter_map_next",
654 desc: "using combination of `filter_map` and `next` which can usually be written as a single method call",
661 desc: "using `filter(p).next()`, which is more succinctly expressed as `.find(p)`",
668 desc: "using a combination of `find` and `map` can usually be written as a single method call",
673 name: "flat_map_identity",
675 desc: "call to `flat_map` where `flatten` is sufficient",
680 name: "float_arithmetic",
681 group: "restriction",
682 desc: "any floating-point arithmetic statement",
684 module: "arithmetic",
688 group: "correctness",
689 desc: "using `==` or `!=` on float values instead of comparing difference with an epsilon",
694 name: "float_cmp_const",
695 group: "restriction",
696 desc: "using `==` or `!=` on float constants instead of comparing difference with an epsilon",
701 name: "float_equality_without_abs",
702 group: "correctness",
703 desc: "float equality check without `.abs()`",
705 module: "float_equality_without_abs",
708 name: "fn_address_comparisons",
709 group: "correctness",
710 desc: "comparison with an address of a function item",
712 module: "unnamed_address",
715 name: "fn_params_excessive_bools",
717 desc: "using too many bools in function parameters",
719 module: "excessive_bools",
722 name: "fn_to_numeric_cast",
724 desc: "casting a function pointer to a numeric type other than usize",
729 name: "fn_to_numeric_cast_with_truncation",
731 desc: "casting a function pointer to a numeric type not wide enough to store the address",
738 desc: "looping on a map using `iter` when `keys` or `values` would do",
743 name: "for_loops_over_fallibles",
744 group: "correctness",
745 desc: "for-looping over an `Option` or a `Result`, which is more clearly expressed as an `if let`",
751 group: "correctness",
752 desc: "calls to `std::mem::forget` with a value that implements Copy",
754 module: "drop_forget_ref",
758 group: "correctness",
759 desc: "calls to `std::mem::forget` with a reference instead of an owned value",
761 module: "drop_forget_ref",
764 name: "from_iter_instead_of_collect",
766 desc: "use `.collect()` instead of `::from_iter()`",
771 name: "future_not_send",
773 desc: "public Futures must be Send",
775 module: "future_not_send",
778 name: "get_last_with_len",
780 desc: "Using `x.get(x.len() - 1)` when `x.last()` is correct and simpler",
782 module: "get_last_with_len",
786 group: "restriction",
787 desc: "using `.get().unwrap()` or `.get_mut().unwrap()` when using `[]` would work instead",
794 desc: "using identity operations, e.g., `x + 0` or `y / 1`",
796 module: "identity_op",
799 name: "if_let_mutex",
800 group: "correctness",
801 desc: "locking a `Mutex` in an `if let` block can cause deadlocks",
803 module: "if_let_mutex",
806 name: "if_let_some_result",
808 desc: "usage of `ok()` in `if let Some(pat)` statements is unnecessary, match on `Ok(pat)` instead",
810 module: "if_let_some_result",
815 desc: "`if` branches that could be swapped so no negation operation is necessary on the condition",
817 module: "if_not_else",
820 name: "if_same_then_else",
821 group: "correctness",
822 desc: "`if` with the same `then` and `else` blocks",
827 name: "ifs_same_cond",
828 group: "correctness",
829 desc: "consecutive `if`s with the same condition",
834 name: "implicit_hasher",
836 desc: "missing generalization over different hashers",
841 name: "implicit_return",
842 group: "restriction",
843 desc: "use a return statement like `return expr` instead of an expression",
845 module: "implicit_return",
848 name: "implicit_saturating_sub",
850 desc: "Perform saturating subtraction instead of implicitly checking lower bound of data type",
852 module: "implicit_saturating_sub",
855 name: "imprecise_flops",
857 desc: "usage of imprecise floating point operations",
859 module: "floating_point_arithmetic",
862 name: "inconsistent_digit_grouping",
864 desc: "integer literals with digits grouped inconsistently",
866 module: "literal_representation",
869 name: "indexing_slicing",
870 group: "restriction",
871 desc: "indexing/slicing usage",
873 module: "indexing_slicing",
876 name: "ineffective_bit_mask",
877 group: "correctness",
878 desc: "expressions where a bit mask will be rendered useless by a comparison, e.g., `(x | 1) > 2`",
883 name: "inefficient_to_string",
885 desc: "using `to_string` on `&&T` where `T: ToString`",
890 name: "infallible_destructuring_match",
892 desc: "a `match` statement with a single infallible arm instead of a `let`",
897 name: "infinite_iter",
898 group: "correctness",
899 desc: "infinite iteration",
901 module: "infinite_iter",
904 name: "inherent_to_string",
906 desc: "type implements inherent method `to_string()`, but should instead implement the `Display` trait",
908 module: "inherent_to_string",
911 name: "inherent_to_string_shadow_display",
912 group: "correctness",
913 desc: "type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait",
915 module: "inherent_to_string",
918 name: "inline_always",
920 desc: "use of `#[inline(always)]`",
925 name: "inline_asm_x86_att_syntax",
926 group: "restriction",
927 desc: "prefer Intel x86 assembly syntax",
929 module: "asm_syntax",
932 name: "inline_asm_x86_intel_syntax",
933 group: "restriction",
934 desc: "prefer AT&T x86 assembly syntax",
936 module: "asm_syntax",
939 name: "inline_fn_without_body",
940 group: "correctness",
941 desc: "use of `#[inline]` on trait methods without bodies",
943 module: "inline_fn_without_body",
946 name: "int_plus_one",
948 desc: "instead of using `x >= y + 1`, use `x > y`",
950 module: "int_plus_one",
953 name: "integer_arithmetic",
954 group: "restriction",
955 desc: "any integer arithmetic expression which could overflow or panic",
957 module: "arithmetic",
960 name: "integer_division",
961 group: "restriction",
962 desc: "integer division may cause loss of precision",
964 module: "integer_division",
967 name: "into_iter_on_ref",
969 desc: "using `.into_iter()` on a reference",
974 name: "invalid_atomic_ordering",
975 group: "correctness",
976 desc: "usage of invalid atomic ordering in atomic operations and memory fences",
978 module: "atomic_ordering",
981 name: "invalid_regex",
982 group: "correctness",
983 desc: "invalid regular expressions",
988 name: "invalid_upcast_comparisons",
990 desc: "a comparison involving an upcast which is always true or false",
995 name: "invisible_characters",
996 group: "correctness",
997 desc: "using an invisible character in a string literal, which is confusing",
1002 name: "items_after_statements",
1004 desc: "blocks where an item comes after a statement",
1006 module: "items_after_statements",
1009 name: "iter_cloned_collect",
1011 desc: "using `.cloned().collect()` on slice to create a `Vec`",
1016 name: "iter_next_loop",
1017 group: "correctness",
1018 desc: "for-looping over `_.next()` which is probably not intended",
1023 name: "iter_next_slice",
1025 desc: "using `.iter().next()` on a sliced array, which can be shortened to just `.get()`",
1032 desc: "using `.iter().nth()` on a standard library type with O(1) element access",
1037 name: "iter_nth_zero",
1039 desc: "replace `iter.nth(0)` with `iter.next()`",
1044 name: "iter_skip_next",
1046 desc: "using `.skip(x).next()` on an iterator",
1051 name: "iterator_step_by_zero",
1052 group: "correctness",
1053 desc: "using `Iterator::step_by(0)`, which will panic at runtime",
1058 name: "just_underscores_and_digits",
1060 desc: "unclear name",
1062 module: "non_expressive_names",
1065 name: "large_const_arrays",
1067 desc: "large non-scalar const array may cause performance overhead",
1069 module: "large_const_arrays",
1072 name: "large_digit_groups",
1074 desc: "grouping digits into groups that are too large",
1076 module: "literal_representation",
1079 name: "large_enum_variant",
1081 desc: "large size difference between variants on an enum",
1083 module: "large_enum_variant",
1086 name: "large_stack_arrays",
1088 desc: "allocating large arrays on stack may cause stack overflow",
1090 module: "large_stack_arrays",
1093 name: "large_types_passed_by_value",
1095 desc: "functions taking large arguments by value",
1097 module: "pass_by_ref_or_value",
1100 name: "len_without_is_empty",
1102 desc: "traits or impls with a public `len` method but no corresponding `is_empty` method",
1109 desc: "checking `.len() == 0` or `.len() > 0` (or similar) when `.is_empty()` could be used instead",
1114 name: "let_and_return",
1116 desc: "creating a let-binding and then immediately returning it like `let x = expr; x` at the end of a block",
1121 name: "let_underscore_drop",
1123 desc: "non-binding let on a type that implements `Drop`",
1125 module: "let_underscore",
1128 name: "let_underscore_lock",
1129 group: "correctness",
1130 desc: "non-binding let on a synchronization lock",
1132 module: "let_underscore",
1135 name: "let_underscore_must_use",
1136 group: "restriction",
1137 desc: "non-binding let on a `#[must_use]` expression",
1139 module: "let_underscore",
1142 name: "let_unit_value",
1144 desc: "creating a `let` binding to a value of unit type, which usually can\'t be used afterwards",
1151 desc: "usage of LinkedList, usually a vector is faster, or a more specialized data structure like a `VecDeque`",
1157 group: "correctness",
1158 desc: "boolean expressions that contain terminals which can be eliminated",
1163 name: "lossy_float_literal",
1164 group: "restriction",
1165 desc: "lossy whole number float literals",
1167 module: "float_literal",
1170 name: "macro_use_imports",
1172 desc: "#[macro_use] is no longer needed",
1174 module: "macro_use",
1177 name: "main_recursion",
1179 desc: "recursion using the entrypoint",
1181 module: "main_recursion",
1184 name: "manual_async_fn",
1186 desc: "manual implementations of `async` functions can be simplified using the dedicated syntax",
1188 module: "manual_async_fn",
1191 name: "manual_memcpy",
1193 desc: "manually copying items between slices",
1198 name: "manual_non_exhaustive",
1200 desc: "manual implementations of the non-exhaustive pattern can be simplified using #[non_exhaustive]",
1202 module: "manual_non_exhaustive",
1205 name: "manual_ok_or",
1207 desc: "finds patterns that can be encoded more concisely with `Option::ok_or`",
1209 module: "manual_ok_or",
1212 name: "manual_range_contains",
1214 desc: "manually reimplementing {`Range`, `RangeInclusive`}`::contains`",
1219 name: "manual_saturating_arithmetic",
1221 desc: "`.chcked_add/sub(x).unwrap_or(MAX/MIN)`",
1226 name: "manual_strip",
1227 group: "complexity",
1228 desc: "suggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing",
1230 module: "manual_strip",
1233 name: "manual_swap",
1234 group: "complexity",
1235 desc: "manual swap of two variables",
1240 name: "manual_unwrap_or",
1241 group: "complexity",
1242 desc: "finds patterns that can be encoded more concisely with `Option::unwrap_or` or `Result::unwrap_or`",
1244 module: "manual_unwrap_or",
1247 name: "many_single_char_names",
1249 desc: "too many single character bindings",
1251 module: "non_expressive_names",
1256 desc: "using `iterator.map(|x| x.clone())`, or dereferencing closures for `Copy` types",
1258 module: "map_clone",
1261 name: "map_collect_result_unit",
1263 desc: "using `.map(_).collect::<Result<(),_>()`, which can be replaced with `try_for_each`",
1270 desc: "use of `contains_key` followed by `insert` on a `HashMap` or `BTreeMap`",
1275 name: "map_err_ignore",
1277 desc: "`map_err` should not ignore the original error",
1279 module: "map_err_ignore",
1282 name: "map_flatten",
1284 desc: "using combinations of `flatten` and `map` which can usually be written as a single method call",
1289 name: "map_identity",
1290 group: "complexity",
1291 desc: "using iterator.map(|x| x)",
1293 module: "map_identity",
1296 name: "map_unwrap_or",
1298 desc: "using `.map(f).unwrap_or(a)` or `.map(f).unwrap_or_else(func)`, which are more succinctly expressed as `map_or(a, f)` or `map_or_else(a, f)`",
1303 name: "match_as_ref",
1304 group: "complexity",
1305 desc: "a `match` on an Option value instead of using `as_ref()` or `as_mut`",
1312 desc: "a `match` on a boolean expression instead of an `if..else` block",
1317 name: "match_like_matches_macro",
1319 desc: "a match that could be written with the matches! macro",
1324 name: "match_on_vec_items",
1326 desc: "matching on vector elements can panic",
1328 module: "match_on_vec_items",
1331 name: "match_overlapping_arm",
1333 desc: "a `match` with overlapping arms",
1338 name: "match_ref_pats",
1340 desc: "a `match` or `if let` with all arms prefixed with `&` instead of deref-ing the match expression",
1345 name: "match_same_arms",
1347 desc: "`match` with identical arm bodies",
1352 name: "match_single_binding",
1353 group: "complexity",
1354 desc: "a match with a single binding instead of using `let` statement",
1359 name: "match_wild_err_arm",
1361 desc: "a `match` with `Err(_)` arm and take drastic actions",
1366 name: "match_wildcard_for_single_variants",
1368 desc: "a wildcard enum match for a single variant",
1373 name: "maybe_infinite_iter",
1375 desc: "possible infinite iteration",
1377 module: "infinite_iter",
1380 name: "mem_discriminant_non_enum",
1381 group: "correctness",
1382 desc: "calling `mem::descriminant` on non-enum type",
1384 module: "mem_discriminant",
1388 group: "restriction",
1389 desc: "`mem::forget` usage on `Drop` types, likely to cause memory leaks",
1391 module: "mem_forget",
1394 name: "mem_replace_option_with_none",
1396 desc: "replacing an `Option` with `None` instead of `take()`",
1398 module: "mem_replace",
1401 name: "mem_replace_with_default",
1403 desc: "replacing a value of type `T` with `T::default()` instead of using `std::mem::take`",
1405 module: "mem_replace",
1408 name: "mem_replace_with_uninit",
1409 group: "correctness",
1410 desc: "`mem::replace(&mut _, mem::uninitialized())` or `mem::replace(&mut _, mem::zeroed())`",
1412 module: "mem_replace",
1416 group: "correctness",
1417 desc: "`min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant",
1422 name: "mismatched_target_os",
1423 group: "correctness",
1424 desc: "usage of `cfg(operating_system)` instead of `cfg(target_os = \"operating_system\")`",
1429 name: "misrefactored_assign_op",
1430 group: "complexity",
1431 desc: "having a variable on both sides of an assign op",
1433 module: "assign_ops",
1436 name: "missing_const_for_fn",
1438 desc: "Lint functions definitions that could be made `const fn`",
1440 module: "missing_const_for_fn",
1443 name: "missing_docs_in_private_items",
1444 group: "restriction",
1445 desc: "detects missing documentation for public and private members",
1447 module: "missing_doc",
1450 name: "missing_errors_doc",
1452 desc: "`pub fn` returns `Result` without `# Errors` in doc comment",
1457 name: "missing_inline_in_public_items",
1458 group: "restriction",
1459 desc: "detects missing `#[inline]` attribute for public callables (functions, trait methods, methods...)",
1461 module: "missing_inline",
1464 name: "missing_safety_doc",
1466 desc: "`pub unsafe fn` without `# Safety` docs",
1471 name: "mistyped_literal_suffixes",
1472 group: "correctness",
1473 desc: "mistyped literal suffix",
1475 module: "literal_representation",
1478 name: "mixed_case_hex_literals",
1480 desc: "hex literals whose letter digits are not consistently upper- or lowercased",
1482 module: "misc_early",
1485 name: "module_inception",
1487 desc: "modules that have the same name as their parent module",
1489 module: "enum_variants",
1492 name: "module_name_repetitions",
1494 desc: "type names prefixed/postfixed with their containing module\'s name",
1496 module: "enum_variants",
1499 name: "modulo_arithmetic",
1500 group: "restriction",
1501 desc: "any modulo arithmetic statement",
1503 module: "modulo_arithmetic",
1507 group: "correctness",
1508 desc: "taking a number modulo 1, which always returns 0",
1513 name: "multiple_crate_versions",
1515 desc: "multiple versions of the same crate being used",
1517 module: "multiple_crate_versions",
1520 name: "multiple_inherent_impl",
1521 group: "restriction",
1522 desc: "Multiple inherent impl that could be grouped",
1524 module: "inherent_impl",
1527 name: "must_use_candidate",
1529 desc: "function or method that could take a `#[must_use]` attribute",
1531 module: "functions",
1534 name: "must_use_unit",
1536 desc: "`#[must_use]` attribute on a unit-returning function / method",
1538 module: "functions",
1541 name: "mut_from_ref",
1542 group: "correctness",
1543 desc: "fns that create mutable refs from immutable ref args",
1550 desc: "usage of double-mut refs, e.g., `&mut &mut ...`",
1555 name: "mut_mutex_lock",
1557 desc: "`&mut Mutex::lock` does unnecessary locking",
1559 module: "mut_mutex_lock",
1562 name: "mut_range_bound",
1563 group: "complexity",
1564 desc: "for loop over a range where one of the bounds is a mutable variable",
1569 name: "mutable_key_type",
1570 group: "correctness",
1571 desc: "Check for mutable `Map`/`Set` key type",
1576 name: "mutex_atomic",
1578 desc: "using a mutex where an atomic value could be used instead",
1580 module: "mutex_atomic",
1583 name: "mutex_integer",
1585 desc: "using a mutex for an integer type",
1587 module: "mutex_atomic",
1590 name: "naive_bytecount",
1592 desc: "use of naive `<slice>.filter(|&x| x == y).count()` to count byte values",
1594 module: "bytecount",
1597 name: "needless_arbitrary_self_type",
1598 group: "complexity",
1599 desc: "type of `self` parameter is already by default `Self`",
1601 module: "needless_arbitrary_self_type",
1604 name: "needless_bool",
1605 group: "complexity",
1606 desc: "if-statements with plain booleans in the then- and else-clause, e.g., `if p { true } else { false }`",
1608 module: "needless_bool",
1611 name: "needless_borrow",
1613 desc: "taking a reference that is going to be automatically dereferenced",
1615 module: "needless_borrow",
1618 name: "needless_borrowed_reference",
1619 group: "complexity",
1620 desc: "taking a needless borrowed reference",
1622 module: "needless_borrowed_ref",
1625 name: "needless_collect",
1627 desc: "collecting an iterator when collect is not needed",
1632 name: "needless_continue",
1634 desc: "`continue` statements that can be replaced by a rearrangement of code",
1636 module: "needless_continue",
1639 name: "needless_doctest_main",
1641 desc: "presence of `fn main() {` in code examples",
1646 name: "needless_lifetimes",
1647 group: "complexity",
1648 desc: "using explicit lifetimes for references in function arguments when elision rules would allow omitting them",
1650 module: "lifetimes",
1653 name: "needless_pass_by_value",
1655 desc: "functions taking arguments by value, but not consuming them in its body",
1657 module: "needless_pass_by_value",
1660 name: "needless_range_loop",
1662 desc: "for-looping over a range of indices where an iterator over items would do",
1667 name: "needless_return",
1669 desc: "using a return statement like `return expr;` where an expression would suffice",
1674 name: "needless_update",
1675 group: "complexity",
1676 desc: "using `Foo { ..base }` when there are no missing fields",
1678 module: "needless_update",
1681 name: "neg_cmp_op_on_partial_ord",
1682 group: "complexity",
1683 desc: "The use of negated comparison operators on partially ordered types may produce confusing code.",
1685 module: "neg_cmp_op_on_partial_ord",
1688 name: "neg_multiply",
1690 desc: "multiplying integers with `-1`",
1692 module: "neg_multiply",
1696 group: "correctness",
1697 desc: "any loop that will always `break` or `return`",
1702 name: "new_ret_no_self",
1704 desc: "not returning type containing `Self` in a `new` method",
1709 name: "new_without_default",
1711 desc: "`fn new() -> Self` method without `Default` implementation",
1713 module: "new_without_default",
1717 group: "complexity",
1718 desc: "statements with no effect",
1720 module: "no_effect",
1723 name: "non_ascii_literal",
1725 desc: "using any literal non-ASCII chars in a string literal instead of using the `\\\\u` escape",
1730 name: "nonminimal_bool",
1731 group: "complexity",
1732 desc: "boolean expressions that can be written more concisely",
1737 name: "nonsensical_open_options",
1738 group: "correctness",
1739 desc: "nonsensical combination of options for opening a file",
1741 module: "open_options",
1744 name: "not_unsafe_ptr_arg_deref",
1745 group: "correctness",
1746 desc: "public functions dereferencing raw pointer arguments but not marked `unsafe`",
1748 module: "functions",
1753 desc: "using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result",
1760 desc: "taking a reference to satisfy the type constraints on `==`",
1765 name: "option_as_ref_deref",
1766 group: "complexity",
1767 desc: "using `as_ref().map(Deref::deref)`, which is more succinctly expressed as `as_deref()`",
1772 name: "option_env_unwrap",
1773 group: "correctness",
1774 desc: "using `option_env!(...).unwrap()` to get environment variable",
1776 module: "option_env_unwrap",
1779 name: "option_if_let_else",
1781 desc: "reimplementation of Option::map_or",
1783 module: "option_if_let_else",
1786 name: "option_map_or_none",
1788 desc: "using `Option.map_or(None, f)`, which is more succinctly expressed as `and_then(f)`",
1793 name: "option_map_unit_fn",
1794 group: "complexity",
1795 desc: "using `option.map(f)`, where `f` is a function or closure that returns `()`",
1797 module: "map_unit_fn",
1800 name: "option_option",
1802 desc: "usage of `Option<Option<T>>`",
1807 name: "or_fun_call",
1809 desc: "using any `*or` method with a function call, which suggests `*or_else`",
1814 name: "out_of_bounds_indexing",
1815 group: "correctness",
1816 desc: "out of bounds constant indexing",
1818 module: "indexing_slicing",
1821 name: "overflow_check_conditional",
1822 group: "complexity",
1823 desc: "overflow checks inspired by C which are likely to panic",
1825 module: "overflow_check_conditional",
1829 group: "restriction",
1830 desc: "usage of the `panic!` macro",
1832 module: "panic_unimplemented",
1835 name: "panic_in_result_fn",
1836 group: "restriction",
1837 desc: "functions of type `Result<..>` that contain `panic!()`, `todo!()` or `unreachable()` or `unimplemented()` ",
1839 module: "panic_in_result_fn",
1842 name: "panicking_unwrap",
1843 group: "correctness",
1844 desc: "checks for calls of `unwrap[_err]()` that will always fail",
1849 name: "partialeq_ne_impl",
1850 group: "complexity",
1851 desc: "re-implementing `PartialEq::ne`",
1853 module: "partialeq_ne_impl",
1856 name: "path_buf_push_overwrite",
1858 desc: "calling `push` with file system root on `PathBuf` can overwrite it",
1860 module: "path_buf_push_overwrite",
1863 name: "pattern_type_mismatch",
1864 group: "restriction",
1865 desc: "type of pattern does not match the expression type",
1867 module: "pattern_type_mismatch",
1870 name: "possible_missing_comma",
1871 group: "correctness",
1872 desc: "possible missing comma in array",
1874 module: "formatting",
1878 group: "complexity",
1879 desc: "operations where precedence may be unclear",
1881 module: "precedence",
1884 name: "print_literal",
1886 desc: "printing a literal with a format string",
1891 name: "print_stdout",
1892 group: "restriction",
1893 desc: "printing on stdout",
1898 name: "print_with_newline",
1900 desc: "using `print!()` with a format string that ends in a single newline",
1905 name: "println_empty_string",
1907 desc: "using `println!(\"\")` with an empty string",
1914 desc: "fn arguments of the type `&Vec<...>` or `&String`, suggesting to use `&[...]` or `&str` instead, respectively",
1921 desc: "use `std::ptr::eq` when comparing raw pointers",
1926 name: "ptr_offset_with_cast",
1927 group: "complexity",
1928 desc: "unneeded pointer offset cast",
1930 module: "ptr_offset_with_cast",
1933 name: "pub_enum_variant_names",
1935 desc: "public enums where all variants share a prefix/postfix",
1937 module: "enum_variants",
1940 name: "question_mark",
1942 desc: "checks for expressions that could be replaced by the question mark operator",
1944 module: "question_mark",
1947 name: "range_minus_one",
1949 desc: "`x..=(y-1)` reads better as `x..y`",
1954 name: "range_plus_one",
1956 desc: "`x..(y+1)` reads better as `x..=y`",
1961 name: "range_zip_with_len",
1962 group: "complexity",
1963 desc: "zipping iterator with a range when `enumerate()` would do",
1969 group: "restriction",
1970 desc: "shared ownership of a buffer type",
1975 name: "redundant_allocation",
1977 desc: "redundant allocation",
1982 name: "redundant_clone",
1984 desc: "`clone()` of an owned value that is going to be dropped immediately",
1986 module: "redundant_clone",
1989 name: "redundant_closure",
1991 desc: "redundant closures, i.e., `|a| foo(a)` (which can be written as just `foo`)",
1993 module: "eta_reduction",
1996 name: "redundant_closure_call",
1997 group: "complexity",
1998 desc: "throwaway closures called in the expression they are defined",
2000 module: "redundant_closure_call",
2003 name: "redundant_closure_for_method_calls",
2005 desc: "redundant closures for method calls",
2007 module: "eta_reduction",
2010 name: "redundant_field_names",
2012 desc: "checks for fields in struct literals where shorthands could be used",
2014 module: "redundant_field_names",
2017 name: "redundant_pattern",
2019 desc: "using `name @ _` in a pattern",
2021 module: "misc_early",
2024 name: "redundant_pattern_matching",
2026 desc: "use the proper utility function avoiding an `if let`",
2031 name: "redundant_pub_crate",
2033 desc: "Using `pub(crate)` visibility on items that are not crate visible due to the visibility of the module that contains them.",
2035 module: "redundant_pub_crate",
2038 name: "redundant_static_lifetimes",
2040 desc: "Using explicit `\'static` lifetime for constants or statics when elision rules would allow omitting them.",
2042 module: "redundant_static_lifetimes",
2045 name: "ref_in_deref",
2046 group: "complexity",
2047 desc: "Use of reference in auto dereference expression.",
2049 module: "reference",
2052 name: "ref_option_ref",
2054 desc: "use `Option<&T>` instead of `&Option<&T>`",
2056 module: "ref_option_ref",
2059 name: "repeat_once",
2060 group: "complexity",
2061 desc: "using `.repeat(1)` instead of `String.clone()`, `str.to_string()` or `slice.to_vec()` ",
2063 module: "repeat_once",
2066 name: "rest_pat_in_fully_bound_structs",
2067 group: "restriction",
2068 desc: "a match on a struct that binds all fields but still uses the wildcard pattern",
2073 name: "result_map_or_into_option",
2075 desc: "using `Result.map_or(None, Some)`, which is more succinctly expressed as `ok()`",
2080 name: "result_map_unit_fn",
2081 group: "complexity",
2082 desc: "using `result.map(f)`, where `f` is a function or closure that returns `()`",
2084 module: "map_unit_fn",
2087 name: "result_unit_err",
2089 desc: "public function returning `Result` with an `Err` type of `()`",
2091 module: "functions",
2094 name: "reversed_empty_ranges",
2095 group: "correctness",
2096 desc: "reversing the limits of range expressions, resulting in empty ranges",
2101 name: "same_functions_in_if_condition",
2103 desc: "consecutive `if`s with the same function call",
2108 name: "same_item_push",
2110 desc: "the same item is pushed inside of a for loop",
2115 name: "search_is_some",
2116 group: "complexity",
2117 desc: "using an iterator or string search followed by `is_some()`, which is more succinctly expressed as a call to `any()` or `contains()`",
2122 name: "self_assignment",
2123 group: "correctness",
2124 desc: "explicit self-assignment",
2126 module: "self_assignment",
2129 name: "serde_api_misuse",
2130 group: "correctness",
2131 desc: "various things that will negatively affect your serde experience",
2133 module: "serde_api",
2136 name: "shadow_reuse",
2137 group: "restriction",
2138 desc: "rebinding a name to an expression that re-uses the original value, e.g., `let x = x + 1`",
2143 name: "shadow_same",
2144 group: "restriction",
2145 desc: "rebinding a name to itself, e.g., `let mut x = &mut x`",
2150 name: "shadow_unrelated",
2152 desc: "rebinding a name without even using the original value",
2157 name: "short_circuit_statement",
2158 group: "complexity",
2159 desc: "using a short circuit boolean condition as a statement",
2164 name: "should_implement_trait",
2166 desc: "defining a method that should be implementing a std trait",
2171 name: "similar_names",
2173 desc: "similarly named items and bindings",
2175 module: "non_expressive_names",
2178 name: "single_char_add_str",
2180 desc: "`push_str()` or `insert_str()` used with a single-character string literal as parameter",
2185 name: "single_char_pattern",
2187 desc: "using a single-character str where a char could be used, e.g., `_.split(\"x\")`",
2192 name: "single_component_path_imports",
2194 desc: "imports with single component path are redundant",
2196 module: "single_component_path_imports",
2199 name: "single_element_loop",
2200 group: "complexity",
2201 desc: "there is no reason to have a single element loop",
2206 name: "single_match",
2208 desc: "a `match` statement with a single nontrivial arm (i.e., where the other arm is `_ => {}`) instead of `if let`",
2213 name: "single_match_else",
2215 desc: "a `match` statement with two arms where the second arm\'s pattern is a placeholder instead of a specific match pattern",
2220 name: "skip_while_next",
2221 group: "complexity",
2222 desc: "using `skip_while(p).next()`, which is more succinctly expressed as `.find(!p)`",
2227 name: "slow_vector_initialization",
2229 desc: "slow vector initialization",
2231 module: "slow_vector_initialization",
2234 name: "stable_sort_primitive",
2236 desc: "use of sort() when sort_unstable() is equivalent",
2238 module: "stable_sort_primitive",
2242 group: "restriction",
2243 desc: "using `x + ..` where x is a `String` instead of `push_str()`",
2248 name: "string_add_assign",
2250 desc: "using `x = x + ..` where x is a `String` instead of `push_str()`",
2255 name: "string_extend_chars",
2257 desc: "using `x.extend(s.chars())` where s is a `&str` or `String`",
2262 name: "string_from_utf8_as_bytes",
2263 group: "complexity",
2264 desc: "casting string slices to byte slices and back",
2269 name: "string_lit_as_bytes",
2271 desc: "calling `as_bytes` on a string literal instead of using a byte string literal",
2276 name: "struct_excessive_bools",
2278 desc: "using too many bools in a struct",
2280 module: "excessive_bools",
2283 name: "suboptimal_flops",
2285 desc: "usage of sub-optimal floating point operations",
2287 module: "floating_point_arithmetic",
2290 name: "suspicious_arithmetic_impl",
2291 group: "correctness",
2292 desc: "suspicious use of operators in impl of arithmetic trait",
2294 module: "suspicious_trait_impl",
2297 name: "suspicious_assignment_formatting",
2299 desc: "suspicious formatting of `*=`, `-=` or `!=`",
2301 module: "formatting",
2304 name: "suspicious_else_formatting",
2306 desc: "suspicious formatting of `else`",
2308 module: "formatting",
2311 name: "suspicious_map",
2312 group: "complexity",
2313 desc: "suspicious usage of map",
2318 name: "suspicious_op_assign_impl",
2319 group: "correctness",
2320 desc: "suspicious use of operators in impl of OpAssign trait",
2322 module: "suspicious_trait_impl",
2325 name: "suspicious_unary_op_formatting",
2327 desc: "suspicious formatting of unary `-` or `!` on the RHS of a BinOp",
2329 module: "formatting",
2332 name: "tabs_in_doc_comments",
2334 desc: "using tabs in doc comments is not recommended",
2336 module: "tabs_in_doc_comments",
2339 name: "temporary_assignment",
2340 group: "complexity",
2341 desc: "assignments to temporaries",
2343 module: "temporary_assignment",
2346 name: "to_digit_is_some",
2348 desc: "`char.is_digit()` is clearer",
2350 module: "to_digit_is_some",
2353 name: "to_string_in_display",
2354 group: "correctness",
2355 desc: "`to_string` method used while implementing `Display` trait",
2357 module: "to_string_in_display",
2361 group: "restriction",
2362 desc: "`todo!` should not be present in production code",
2364 module: "panic_unimplemented",
2367 name: "too_many_arguments",
2368 group: "complexity",
2369 desc: "functions with too many arguments",
2371 module: "functions",
2374 name: "too_many_lines",
2376 desc: "functions with too many lines",
2378 module: "functions",
2381 name: "toplevel_ref_arg",
2383 desc: "an entire binding declared as `ref`, in a function argument or a `let` statement",
2388 name: "trait_duplication_in_bounds",
2390 desc: "Check if the same trait bounds are specified twice during a function declaration",
2392 module: "trait_bounds",
2395 name: "transmute_bytes_to_str",
2396 group: "complexity",
2397 desc: "transmutes from a `&[u8]` to a `&str`",
2399 module: "transmute",
2402 name: "transmute_float_to_int",
2403 group: "complexity",
2404 desc: "transmutes from a float to an integer",
2406 module: "transmute",
2409 name: "transmute_int_to_bool",
2410 group: "complexity",
2411 desc: "transmutes from an integer to a `bool`",
2413 module: "transmute",
2416 name: "transmute_int_to_char",
2417 group: "complexity",
2418 desc: "transmutes from an integer to a `char`",
2420 module: "transmute",
2423 name: "transmute_int_to_float",
2424 group: "complexity",
2425 desc: "transmutes from an integer to a float",
2427 module: "transmute",
2430 name: "transmute_ptr_to_ptr",
2431 group: "complexity",
2432 desc: "transmutes from a pointer to a pointer / a reference to a reference",
2434 module: "transmute",
2437 name: "transmute_ptr_to_ref",
2438 group: "complexity",
2439 desc: "transmutes from a pointer to a reference type",
2441 module: "transmute",
2444 name: "transmutes_expressible_as_ptr_casts",
2445 group: "complexity",
2446 desc: "transmutes that could be a pointer cast",
2448 module: "transmute",
2451 name: "transmuting_null",
2452 group: "correctness",
2453 desc: "transmutes from a null pointer to a reference, which is undefined behavior",
2455 module: "transmuting_null",
2458 name: "trivial_regex",
2460 desc: "trivial regular expressions",
2465 name: "trivially_copy_pass_by_ref",
2467 desc: "functions taking small copyable arguments by reference",
2469 module: "pass_by_ref_or_value",
2474 desc: "return errors explicitly rather than hiding them behind a `?`",
2479 name: "type_complexity",
2480 group: "complexity",
2481 desc: "usage of very complex types that might be better factored into `type` definitions",
2486 name: "type_repetition_in_bounds",
2488 desc: "Types are repeated unnecessary in trait bounds use `+` instead of using `T: _, T: _`",
2490 module: "trait_bounds",
2493 name: "undropped_manually_drops",
2494 group: "correctness",
2495 desc: "use of safe `std::mem::drop` function to drop a std::mem::ManuallyDrop, which will not drop the inner value",
2497 module: "undropped_manually_drops",
2500 name: "unicode_not_nfc",
2502 desc: "using a Unicode literal not in NFC normal form (see [Unicode tr15](http://www.unicode.org/reports/tr15/) for further information)",
2507 name: "unimplemented",
2508 group: "restriction",
2509 desc: "`unimplemented!` should not be present in production code",
2511 module: "panic_unimplemented",
2514 name: "uninit_assumed_init",
2515 group: "correctness",
2516 desc: "`MaybeUninit::uninit().assume_init()`",
2522 group: "complexity",
2523 desc: "passing unit to a function",
2529 group: "correctness",
2530 desc: "comparing unit values",
2535 name: "unit_return_expecting_ord",
2536 group: "correctness",
2537 desc: "fn arguments of type Fn(...) -> Ord returning the unit type ().",
2539 module: "unit_return_expecting_ord",
2542 name: "unknown_clippy_lints",
2544 desc: "unknown_lints for scoped Clippy lints",
2549 name: "unnecessary_cast",
2550 group: "complexity",
2551 desc: "cast to the same type, e.g., `x as i32` where `x: i32`",
2556 name: "unnecessary_filter_map",
2557 group: "complexity",
2558 desc: "using `filter_map` when a more succinct alternative exists",
2563 name: "unnecessary_fold",
2565 desc: "using `fold` when a more succinct alternative exists",
2570 name: "unnecessary_lazy_evaluations",
2572 desc: "using unnecessary lazy evaluation, which can be replaced with simpler eager evaluation",
2577 name: "unnecessary_mut_passed",
2579 desc: "an argument passed as a mutable reference although the callee only demands an immutable reference",
2581 module: "mut_reference",
2584 name: "unnecessary_operation",
2585 group: "complexity",
2586 desc: "outer expressions with no effect",
2588 module: "no_effect",
2591 name: "unnecessary_sort_by",
2592 group: "complexity",
2593 desc: "Use of `Vec::sort_by` when `Vec::sort_by_key` or `Vec::sort` would be clearer",
2595 module: "unnecessary_sort_by",
2598 name: "unnecessary_unwrap",
2599 group: "complexity",
2600 desc: "checks for calls of `unwrap[_err]()` that cannot fail",
2605 name: "unnecessary_wraps",
2606 group: "complexity",
2607 desc: "functions that only return `Ok` or `Some`",
2609 module: "unnecessary_wraps",
2612 name: "unneeded_field_pattern",
2613 group: "restriction",
2614 desc: "struct fields bound to a wildcard instead of using `..`",
2616 module: "misc_early",
2619 name: "unneeded_wildcard_pattern",
2620 group: "complexity",
2621 desc: "tuple patterns with a wildcard pattern (`_`) is next to a rest pattern (`..`)",
2623 module: "misc_early",
2626 name: "unnested_or_patterns",
2628 desc: "unnested or-patterns, e.g., `Foo(Bar) | Foo(Baz) instead of `Foo(Bar | Baz)`",
2630 module: "unnested_or_patterns",
2633 name: "unreachable",
2634 group: "restriction",
2635 desc: "`unreachable!` should not be present in production code",
2637 module: "panic_unimplemented",
2640 name: "unreadable_literal",
2642 desc: "long integer literal without underscores",
2644 module: "literal_representation",
2647 name: "unsafe_derive_deserialize",
2649 desc: "deriving `serde::Deserialize` on a type that has methods using `unsafe`",
2654 name: "unsafe_removed_from_name",
2656 desc: "`unsafe` removed from API names on import",
2658 module: "unsafe_removed_from_name",
2661 name: "unseparated_literal_suffix",
2663 desc: "literals whose suffix is not separated by an underscore",
2665 module: "misc_early",
2668 name: "unsound_collection_transmute",
2669 group: "correctness",
2670 desc: "transmute between collections of layout-incompatible types",
2672 module: "transmute",
2675 name: "unused_io_amount",
2676 group: "correctness",
2677 desc: "unused written/read amount",
2679 module: "unused_io_amount",
2682 name: "unused_self",
2684 desc: "methods that contain a `self` argument but don\'t use it",
2686 module: "unused_self",
2689 name: "unused_unit",
2691 desc: "needless unit expression",
2693 module: "unused_unit",
2696 name: "unusual_byte_groupings",
2698 desc: "binary or hex literals that aren\'t grouped by four",
2700 module: "literal_representation",
2703 name: "unwrap_in_result",
2704 group: "restriction",
2705 desc: "functions of type `Result<..>` or `Option`<...> that contain `expect()` or `unwrap()`",
2707 module: "unwrap_in_result",
2710 name: "unwrap_used",
2711 group: "restriction",
2712 desc: "using `.unwrap()` on `Result` or `Option`, which should at least get a better message using `expect()`",
2718 group: "restriction",
2719 desc: "use of `Debug`-based formatting",
2726 desc: "unnecessary structure name repetition whereas `Self` is applicable",
2731 name: "used_underscore_binding",
2733 desc: "using a binding which is prefixed with an underscore",
2738 name: "useless_asref",
2739 group: "complexity",
2740 desc: "using `as_ref` where the types before and after the call are the same",
2745 name: "useless_attribute",
2746 group: "correctness",
2747 desc: "use of lint attributes on `extern crate` items",
2752 name: "useless_conversion",
2753 group: "complexity",
2754 desc: "calls to `Into`, `TryInto`, `From`, `TryFrom`, or `IntoIter` which perform useless conversions to the same type",
2756 module: "useless_conversion",
2759 name: "useless_format",
2760 group: "complexity",
2761 desc: "useless use of `format!`",
2766 name: "useless_let_if_seq",
2768 desc: "unidiomatic `let mut` declaration followed by initialization in `if`",
2770 module: "let_if_seq",
2773 name: "useless_transmute",
2775 desc: "transmutes that have the same to and from types or could be a cast/coercion",
2777 module: "transmute",
2780 name: "useless_vec",
2782 desc: "useless `vec!`",
2788 group: "complexity",
2789 desc: "usage of `Vec<Box<T>>` where T: Sized, vector elements are already on the heap",
2794 name: "vec_resize_to_zero",
2795 group: "correctness",
2796 desc: "emptying a vector with `resize(0, an_int)` instead of `clear()` is probably an argument inversion mistake",
2798 module: "vec_resize_to_zero",
2801 name: "verbose_bit_mask",
2803 desc: "expressions where a bit mask is less readable than the corresponding method call",
2808 name: "verbose_file_reads",
2809 group: "restriction",
2810 desc: "use of `File::read_to_end` or `File::read_to_string`",
2812 module: "verbose_file_reads",
2815 name: "vtable_address_comparisons",
2816 group: "correctness",
2817 desc: "comparison with an address of a trait vtable",
2819 module: "unnamed_address",
2822 name: "while_immutable_condition",
2823 group: "correctness",
2824 desc: "variables used within while expression are not mutated in the body",
2829 name: "while_let_loop",
2830 group: "complexity",
2831 desc: "`loop { if let { ... } else break }`, which can be written as a `while let` loop",
2836 name: "while_let_on_iterator",
2838 desc: "using a while-let loop instead of a for loop on an iterator",
2843 name: "wildcard_dependencies",
2845 desc: "wildcard dependencies being used",
2847 module: "wildcard_dependencies",
2850 name: "wildcard_enum_match_arm",
2851 group: "restriction",
2852 desc: "a wildcard enum match arm using `_`",
2857 name: "wildcard_imports",
2859 desc: "lint `use _::*` statements",
2861 module: "wildcard_imports",
2864 name: "wildcard_in_or_patterns",
2865 group: "complexity",
2866 desc: "a wildcard pattern used with others patterns in same match arm",
2871 name: "write_literal",
2873 desc: "writing a literal with a format string",
2878 name: "write_with_newline",
2880 desc: "using `write!()` with a format string that ends in a single newline",
2885 name: "writeln_empty_string",
2887 desc: "using `writeln!(buf, \"\")` with an empty string",
2892 name: "wrong_pub_self_convention",
2893 group: "restriction",
2894 desc: "defining a public method named with an established prefix (like \"into_\") that takes `self` with the wrong convention",
2899 name: "wrong_self_convention",
2901 desc: "defining a method named with an established prefix (like \"into_\") that takes `self` with the wrong convention",
2906 name: "wrong_transmute",
2907 group: "correctness",
2908 desc: "transmutes that are confusing at best, undefined behaviour at worst and always useless",
2910 module: "transmute",
2913 name: "zero_divided_by_zero",
2914 group: "complexity",
2915 desc: "usage of `0.0 / 0.0` to obtain NaN instead of `f32::NAN` or `f64::NAN`",
2917 module: "zero_div_zero",
2920 name: "zero_prefixed_literal",
2921 group: "complexity",
2922 desc: "integer literals starting with `0`",
2924 module: "misc_early",
2929 desc: "using `0 as *{const, mut} T`",
2935 group: "correctness",
2936 desc: "Check for offset calculations on raw pointers to zero-sized types",
2941 // end lint list, do not remove this comment, it’s used in `update_lints`