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_lock",
73 desc: "expressions of the form `_ & mask == select` that will only ever return `true` or `false`",
78 name: "bind_instead_of_map",
80 desc: "using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`",
85 name: "blacklisted_name",
87 desc: "usage of a blacklisted/placeholder name",
89 module: "blacklisted_name",
92 name: "blanket_clippy_restriction_lints",
94 desc: "enabling the complete restriction group",
99 name: "blocks_in_if_conditions",
101 desc: "useless or complex blocks that can be eliminated in conditions",
103 module: "blocks_in_if_conditions",
106 name: "bool_comparison",
108 desc: "comparing a variable to a boolean, e.g., `if x == true` or `if x != true`",
110 module: "needless_bool",
113 name: "borrow_interior_mutable_const",
115 desc: "referencing `const` with interior mutability",
117 module: "non_copy_const",
120 name: "borrowed_box",
122 desc: "a borrow of a boxed type",
129 desc: "usage of `Box<Vec<T>>`, vector elements are already on the heap",
136 desc: "using `Box<T>` where unnecessary",
141 name: "builtin_type_shadow",
143 desc: "shadowing a builtin type",
145 module: "misc_early",
148 name: "cargo_common_metadata",
150 desc: "common metadata is defined in `Cargo.toml`",
152 module: "cargo_common_metadata",
155 name: "cast_lossless",
157 desc: "casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`",
162 name: "cast_possible_truncation",
164 desc: "casts that may cause truncation of the value, e.g., `x as u8` where `x: u32`, or `x as i32` where `x: f32`",
169 name: "cast_possible_wrap",
171 desc: "casts that may cause wrapping around the value, e.g., `x as i32` where `x: u32` and `x > i32::MAX`",
176 name: "cast_precision_loss",
178 desc: "casts that cause loss of precision, e.g., `x as f32` where `x: u64`",
183 name: "cast_ptr_alignment",
185 desc: "cast from a pointer to a more-strictly-aligned pointer",
190 name: "cast_ref_to_mut",
191 group: "correctness",
192 desc: "a cast of reference to a mutable pointer",
197 name: "cast_sign_loss",
199 desc: "casts from signed types to unsigned types, e.g., `x as u32` where `x: i32`",
204 name: "char_lit_as_u8",
206 desc: "casting a character literal to `u8` truncates",
211 name: "chars_last_cmp",
213 desc: "using `.chars().last()` or `.chars().next_back()` to check if a string ends with a char",
218 name: "chars_next_cmp",
220 desc: "using `.chars().next()` to check if a string starts with a char",
225 name: "checked_conversions",
227 desc: "`try_from` could replace manual bounds checking when casting",
229 module: "checked_conversions",
232 name: "clone_double_ref",
233 group: "correctness",
234 desc: "using `clone` on `&&T`",
239 name: "clone_on_copy",
241 desc: "using `clone` on a `Copy` type",
246 name: "clone_on_ref_ptr",
247 group: "restriction",
248 desc: "using \'clone\' on a ref-counted pointer",
254 group: "correctness",
255 desc: "comparisons to `NAN`, which will always return false, probably not intended",
262 desc: "comparing a pointer to a null pointer, suggesting to use `.is_null()` instead.",
269 desc: "creating owned instances for comparing with others, e.g., `x == \"foo\".to_string()`",
274 name: "cognitive_complexity",
276 desc: "functions that should be split up into multiple functions",
278 module: "cognitive_complexity",
281 name: "collapsible_if",
283 desc: "`if`s that can be collapsed (e.g., `if x { if y { ... } }` and `else { if x { ... } }`)",
285 module: "collapsible_if",
288 name: "comparison_chain",
290 desc: "`if`s that can be rewritten with `match` and `cmp`",
292 module: "comparison_chain",
295 name: "copy_iterator",
297 desc: "implementing `Iterator` on a `Copy` type",
299 module: "copy_iterator",
303 group: "restriction",
304 desc: "calling `std::fs::create_dir` instead of `std::fs::create_dir_all`",
306 module: "create_dir",
309 name: "crosspointer_transmute",
311 desc: "transmutes that have to or from types that are a pointer to the other",
317 group: "restriction",
318 desc: "`dbg!` macro is intended as a debugging tool",
323 name: "debug_assert_with_mut_call",
325 desc: "mutable arguments in `debug_assert{,_ne,_eq}!`",
327 module: "mutable_debug_assertion",
330 name: "decimal_literal_representation",
331 group: "restriction",
332 desc: "using decimal representation when hexadecimal would be better",
334 module: "literal_representation",
337 name: "declare_interior_mutable_const",
339 desc: "declaring `const` with interior mutability",
341 module: "non_copy_const",
344 name: "default_trait_access",
346 desc: "checks for literal calls to `Default::default()`",
348 module: "default_trait_access",
351 name: "deprecated_cfg_attr",
353 desc: "usage of `cfg_attr(rustfmt)` instead of tool attributes",
358 name: "deprecated_semver",
359 group: "correctness",
360 desc: "use of `#[deprecated(since = \"x\")]` where x is not semver",
365 name: "deref_addrof",
367 desc: "use of `*&` or `*&mut` in an expression",
372 name: "derive_hash_xor_eq",
373 group: "correctness",
374 desc: "deriving `Hash` but implementing `PartialEq` explicitly",
379 name: "derive_ord_xor_partial_ord",
380 group: "correctness",
381 desc: "deriving `Ord` but implementing `PartialOrd` explicitly",
386 name: "disallowed_method",
388 desc: "use of a disallowed method call",
390 module: "disallowed_method",
393 name: "diverging_sub_expression",
395 desc: "whether an expression contains a diverging sub expression",
397 module: "eval_order_dependence",
400 name: "doc_markdown",
402 desc: "presence of `_`, `::` or camel-case outside backticks in documentation",
407 name: "double_comparisons",
409 desc: "unnecessary double comparisons that can be simplified",
411 module: "double_comparison",
414 name: "double_must_use",
416 desc: "`#[must_use]` attribute on a `#[must_use]`-returning function / method",
423 desc: "`--x`, which is a double negation of `x` and not a pre-decrement as in C/C++",
425 module: "misc_early",
428 name: "double_parens",
430 desc: "Warn on unnecessary double parentheses",
432 module: "double_parens",
436 group: "correctness",
437 desc: "calls to `std::mem::drop` with a value that implements Copy",
439 module: "drop_forget_ref",
443 group: "correctness",
444 desc: "calls to `std::mem::drop` with a reference instead of an owned value",
446 module: "drop_forget_ref",
449 name: "duplicate_underscore_argument",
451 desc: "function arguments having names which only differ by an underscore",
453 module: "misc_early",
456 name: "duration_subsec",
458 desc: "checks for calculation of subsecond microseconds or milliseconds",
460 module: "duration_subsec",
463 name: "else_if_without_else",
464 group: "restriction",
465 desc: "`if` expression with an `else if`, but without a final `else` branch",
467 module: "else_if_without_else",
472 desc: "enum with no variants",
474 module: "empty_enum",
477 name: "empty_line_after_outer_attr",
479 desc: "empty line after outer attribute",
486 desc: "empty `loop {}`, which should block or sleep",
491 name: "enum_clike_unportable_variant",
492 group: "correctness",
493 desc: "C-like enums that are `repr(isize/usize)` and have values that don\'t fit into an `i32`",
495 module: "enum_clike",
498 name: "enum_glob_use",
500 desc: "use items that import all variants of an enum",
502 module: "wildcard_imports",
505 name: "enum_variant_names",
507 desc: "enums where all variants share a prefix/postfix",
509 module: "enum_variants",
513 group: "correctness",
514 desc: "equal operands on both sides of a comparison or bitwise combination (e.g., `x == x`)",
520 group: "correctness",
521 desc: "using erasing operations, e.g., `x * 0` or `y & 0`",
523 module: "erasing_op",
526 name: "eval_order_dependence",
528 desc: "whether a variable read occurs before a write depends on sub-expression evaluation order",
530 module: "eval_order_dependence",
533 name: "excessive_precision",
535 desc: "excessive precision for float literal",
537 module: "float_literal",
541 group: "restriction",
542 desc: "`std::process::exit` is called, terminating the program",
547 name: "expect_fun_call",
549 desc: "using any `expect` method with a function call",
555 group: "restriction",
556 desc: "using `.expect()` on `Result` or `Option`, which might be better handled",
561 name: "expl_impl_clone_on_copy",
563 desc: "implementing `Clone` explicitly on `Copy` types",
568 name: "explicit_counter_loop",
570 desc: "for-looping with an explicit counter when `_.enumerate()` would do",
575 name: "explicit_deref_methods",
577 desc: "Explicit use of deref or deref_mut method while not in a method chain.",
579 module: "dereference",
582 name: "explicit_into_iter_loop",
584 desc: "for-looping over `_.into_iter()` when `_` would do",
589 name: "explicit_iter_loop",
591 desc: "for-looping over `_.iter()` or `_.iter_mut()` when `&_` or `&mut _` would do",
596 name: "explicit_write",
598 desc: "using the `write!()` family of functions instead of the `print!()` family of functions, when using the latter would work",
600 module: "explicit_write",
603 name: "extra_unused_lifetimes",
605 desc: "unused lifetimes in function definitions",
610 name: "fallible_impl_from",
612 desc: "Warn on impls of `From<..>` that contain `panic!()` or `unwrap()`",
614 module: "fallible_impl_from",
617 name: "filetype_is_file",
618 group: "restriction",
619 desc: "`FileType::is_file` is not recommended to test for readable file type",
626 desc: "using combinations of `filter`, `map`, `filter_map` and `flat_map` which can usually be written as a single method call",
631 name: "filter_map_next",
633 desc: "using combination of `filter_map` and `next` which can usually be written as a single method call",
640 desc: "using `filter(p).next()`, which is more succinctly expressed as `.find(p)`",
647 desc: "using a combination of `find` and `map` can usually be written as a single method call",
652 name: "flat_map_identity",
654 desc: "call to `flat_map` where `flatten` is sufficient",
659 name: "float_arithmetic",
660 group: "restriction",
661 desc: "any floating-point arithmetic statement",
663 module: "arithmetic",
667 group: "correctness",
668 desc: "using `==` or `!=` on float values instead of comparing difference with an epsilon",
673 name: "float_cmp_const",
674 group: "restriction",
675 desc: "using `==` or `!=` on float constants instead of comparing difference with an epsilon",
680 name: "float_equality_without_abs",
681 group: "correctness",
682 desc: "float equality check without `.abs()`",
684 module: "float_equality_without_abs",
687 name: "fn_address_comparisons",
688 group: "correctness",
689 desc: "comparison with an address of a function item",
691 module: "unnamed_address",
694 name: "fn_params_excessive_bools",
696 desc: "using too many bools in function parameters",
698 module: "excessive_bools",
701 name: "fn_to_numeric_cast",
703 desc: "casting a function pointer to a numeric type other than usize",
708 name: "fn_to_numeric_cast_with_truncation",
710 desc: "casting a function pointer to a numeric type not wide enough to store the address",
717 desc: "looping on a map using `iter` when `keys` or `values` would do",
722 name: "for_loops_over_fallibles",
723 group: "correctness",
724 desc: "for-looping over an `Option` or a `Result`, which is more clearly expressed as an `if let`",
730 group: "correctness",
731 desc: "calls to `std::mem::forget` with a value that implements Copy",
733 module: "drop_forget_ref",
737 group: "correctness",
738 desc: "calls to `std::mem::forget` with a reference instead of an owned value",
740 module: "drop_forget_ref",
743 name: "future_not_send",
745 desc: "public Futures must be Send",
747 module: "future_not_send",
750 name: "get_last_with_len",
752 desc: "Using `x.get(x.len() - 1)` when `x.last()` is correct and simpler",
754 module: "get_last_with_len",
758 group: "restriction",
759 desc: "using `.get().unwrap()` or `.get_mut().unwrap()` when using `[]` would work instead",
766 desc: "using identity operations, e.g., `x + 0` or `y / 1`",
768 module: "identity_op",
771 name: "if_let_mutex",
772 group: "correctness",
773 desc: "locking a `Mutex` in an `if let` block can cause deadlocks",
775 module: "if_let_mutex",
778 name: "if_let_some_result",
780 desc: "usage of `ok()` in `if let Some(pat)` statements is unnecessary, match on `Ok(pat)` instead",
782 module: "if_let_some_result",
787 desc: "`if` branches that could be swapped so no negation operation is necessary on the condition",
789 module: "if_not_else",
792 name: "if_same_then_else",
793 group: "correctness",
794 desc: "`if` with the same `then` and `else` blocks",
799 name: "ifs_same_cond",
800 group: "correctness",
801 desc: "consecutive `if`s with the same condition",
806 name: "implicit_hasher",
808 desc: "missing generalization over different hashers",
813 name: "implicit_return",
814 group: "restriction",
815 desc: "use a return statement like `return expr` instead of an expression",
817 module: "implicit_return",
820 name: "implicit_saturating_sub",
822 desc: "Perform saturating subtraction instead of implicitly checking lower bound of data type",
824 module: "implicit_saturating_sub",
827 name: "imprecise_flops",
829 desc: "usage of imprecise floating point operations",
831 module: "floating_point_arithmetic",
834 name: "inconsistent_digit_grouping",
836 desc: "integer literals with digits grouped inconsistently",
838 module: "literal_representation",
841 name: "indexing_slicing",
842 group: "restriction",
843 desc: "indexing/slicing usage",
845 module: "indexing_slicing",
848 name: "ineffective_bit_mask",
849 group: "correctness",
850 desc: "expressions where a bit mask will be rendered useless by a comparison, e.g., `(x | 1) > 2`",
855 name: "inefficient_to_string",
857 desc: "using `to_string` on `&&T` where `T: ToString`",
862 name: "infallible_destructuring_match",
864 desc: "a `match` statement with a single infallible arm instead of a `let`",
869 name: "infinite_iter",
870 group: "correctness",
871 desc: "infinite iteration",
873 module: "infinite_iter",
876 name: "inherent_to_string",
878 desc: "type implements inherent method `to_string()`, but should instead implement the `Display` trait",
880 module: "inherent_to_string",
883 name: "inherent_to_string_shadow_display",
884 group: "correctness",
885 desc: "type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait",
887 module: "inherent_to_string",
890 name: "inline_always",
892 desc: "use of `#[inline(always)]`",
897 name: "inline_asm_x86_att_syntax",
898 group: "restriction",
899 desc: "prefer Intel x86 assembly syntax",
901 module: "asm_syntax",
904 name: "inline_asm_x86_intel_syntax",
905 group: "restriction",
906 desc: "prefer AT&T x86 assembly syntax",
908 module: "asm_syntax",
911 name: "inline_fn_without_body",
912 group: "correctness",
913 desc: "use of `#[inline]` on trait methods without bodies",
915 module: "inline_fn_without_body",
918 name: "int_plus_one",
920 desc: "instead of using `x >= y + 1`, use `x > y`",
922 module: "int_plus_one",
925 name: "integer_arithmetic",
926 group: "restriction",
927 desc: "any integer arithmetic expression which could overflow or panic",
929 module: "arithmetic",
932 name: "integer_division",
933 group: "restriction",
934 desc: "integer division may cause loss of precision",
936 module: "integer_division",
939 name: "into_iter_on_ref",
941 desc: "using `.into_iter()` on a reference",
946 name: "invalid_atomic_ordering",
947 group: "correctness",
948 desc: "usage of invalid atomic ordering in atomic operations and memory fences",
950 module: "atomic_ordering",
953 name: "invalid_regex",
954 group: "correctness",
955 desc: "invalid regular expressions",
960 name: "invalid_upcast_comparisons",
962 desc: "a comparison involving an upcast which is always true or false",
967 name: "invisible_characters",
968 group: "correctness",
969 desc: "using an invisible character in a string literal, which is confusing",
974 name: "items_after_statements",
976 desc: "blocks where an item comes after a statement",
978 module: "items_after_statements",
981 name: "iter_cloned_collect",
983 desc: "using `.cloned().collect()` on slice to create a `Vec`",
988 name: "iter_next_loop",
989 group: "correctness",
990 desc: "for-looping over `_.next()` which is probably not intended",
995 name: "iter_next_slice",
997 desc: "using `.iter().next()` on a sliced array, which can be shortened to just `.get()`",
1004 desc: "using `.iter().nth()` on a standard library type with O(1) element access",
1009 name: "iter_nth_zero",
1011 desc: "replace `iter.nth(0)` with `iter.next()`",
1016 name: "iter_skip_next",
1018 desc: "using `.skip(x).next()` on an iterator",
1023 name: "iterator_step_by_zero",
1024 group: "correctness",
1025 desc: "using `Iterator::step_by(0)`, which will panic at runtime",
1030 name: "just_underscores_and_digits",
1032 desc: "unclear name",
1034 module: "non_expressive_names",
1037 name: "large_const_arrays",
1039 desc: "large non-scalar const array may cause performance overhead",
1041 module: "large_const_arrays",
1044 name: "large_digit_groups",
1046 desc: "grouping digits into groups that are too large",
1048 module: "literal_representation",
1051 name: "large_enum_variant",
1053 desc: "large size difference between variants on an enum",
1055 module: "large_enum_variant",
1058 name: "large_stack_arrays",
1060 desc: "allocating large arrays on stack may cause stack overflow",
1062 module: "large_stack_arrays",
1065 name: "len_without_is_empty",
1067 desc: "traits or impls with a public `len` method but no corresponding `is_empty` method",
1074 desc: "checking `.len() == 0` or `.len() > 0` (or similar) when `.is_empty()` could be used instead",
1079 name: "let_and_return",
1081 desc: "creating a let-binding and then immediately returning it like `let x = expr; x` at the end of a block",
1086 name: "let_underscore_lock",
1087 group: "correctness",
1088 desc: "non-binding let on a synchronization lock",
1090 module: "let_underscore",
1093 name: "let_underscore_must_use",
1094 group: "restriction",
1095 desc: "non-binding let on a `#[must_use]` expression",
1097 module: "let_underscore",
1100 name: "let_unit_value",
1102 desc: "creating a `let` binding to a value of unit type, which usually can\'t be used afterwards",
1109 desc: "usage of LinkedList, usually a vector is faster, or a more specialized data structure like a `VecDeque`",
1115 group: "correctness",
1116 desc: "boolean expressions that contain terminals which can be eliminated",
1121 name: "lossy_float_literal",
1122 group: "restriction",
1123 desc: "lossy whole number float literals",
1125 module: "float_literal",
1128 name: "macro_use_imports",
1130 desc: "#[macro_use] is no longer needed",
1132 module: "macro_use",
1135 name: "main_recursion",
1137 desc: "recursion using the entrypoint",
1139 module: "main_recursion",
1142 name: "manual_async_fn",
1144 desc: "manual implementations of `async` functions can be simplified using the dedicated syntax",
1146 module: "manual_async_fn",
1149 name: "manual_memcpy",
1151 desc: "manually copying items between slices",
1156 name: "manual_non_exhaustive",
1158 desc: "manual implementations of the non-exhaustive pattern can be simplified using #[non_exhaustive]",
1160 module: "manual_non_exhaustive",
1163 name: "manual_saturating_arithmetic",
1165 desc: "`.chcked_add/sub(x).unwrap_or(MAX/MIN)`",
1170 name: "manual_strip",
1171 group: "complexity",
1172 desc: "suggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing",
1174 module: "manual_strip",
1177 name: "manual_swap",
1178 group: "complexity",
1179 desc: "manual swap of two variables",
1184 name: "manual_unwrap_or",
1185 group: "complexity",
1186 desc: "finds patterns that can be encoded more concisely with `Option::unwrap_or`",
1188 module: "manual_unwrap_or",
1191 name: "many_single_char_names",
1193 desc: "too many single character bindings",
1195 module: "non_expressive_names",
1200 desc: "using `iterator.map(|x| x.clone())`, or dereferencing closures for `Copy` types",
1202 module: "map_clone",
1207 desc: "use of `contains_key` followed by `insert` on a `HashMap` or `BTreeMap`",
1212 name: "map_err_ignore",
1214 desc: "`map_err` should not ignore the original error",
1216 module: "map_err_ignore",
1219 name: "map_flatten",
1221 desc: "using combinations of `flatten` and `map` which can usually be written as a single method call",
1226 name: "map_identity",
1227 group: "complexity",
1228 desc: "using iterator.map(|x| x)",
1230 module: "map_identity",
1233 name: "map_unwrap_or",
1235 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)`",
1240 name: "match_as_ref",
1241 group: "complexity",
1242 desc: "a `match` on an Option value instead of using `as_ref()` or `as_mut`",
1249 desc: "a `match` on a boolean expression instead of an `if..else` block",
1254 name: "match_like_matches_macro",
1256 desc: "a match that could be written with the matches! macro",
1261 name: "match_on_vec_items",
1263 desc: "matching on vector elements can panic",
1265 module: "match_on_vec_items",
1268 name: "match_overlapping_arm",
1270 desc: "a `match` with overlapping arms",
1275 name: "match_ref_pats",
1277 desc: "a `match` or `if let` with all arms prefixed with `&` instead of deref-ing the match expression",
1282 name: "match_same_arms",
1284 desc: "`match` with identical arm bodies",
1289 name: "match_single_binding",
1290 group: "complexity",
1291 desc: "a match with a single binding instead of using `let` statement",
1296 name: "match_wild_err_arm",
1298 desc: "a `match` with `Err(_)` arm and take drastic actions",
1303 name: "match_wildcard_for_single_variants",
1305 desc: "a wildcard enum match for a single variant",
1310 name: "maybe_infinite_iter",
1312 desc: "possible infinite iteration",
1314 module: "infinite_iter",
1317 name: "mem_discriminant_non_enum",
1318 group: "correctness",
1319 desc: "calling `mem::descriminant` on non-enum type",
1321 module: "mem_discriminant",
1325 group: "restriction",
1326 desc: "`mem::forget` usage on `Drop` types, likely to cause memory leaks",
1328 module: "mem_forget",
1331 name: "mem_replace_option_with_none",
1333 desc: "replacing an `Option` with `None` instead of `take()`",
1335 module: "mem_replace",
1338 name: "mem_replace_with_default",
1340 desc: "replacing a value of type `T` with `T::default()` instead of using `std::mem::take`",
1342 module: "mem_replace",
1345 name: "mem_replace_with_uninit",
1346 group: "correctness",
1347 desc: "`mem::replace(&mut _, mem::uninitialized())` or `mem::replace(&mut _, mem::zeroed())`",
1349 module: "mem_replace",
1353 group: "correctness",
1354 desc: "`min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant",
1359 name: "mismatched_target_os",
1360 group: "correctness",
1361 desc: "usage of `cfg(operating_system)` instead of `cfg(target_os = \"operating_system\")`",
1366 name: "misrefactored_assign_op",
1367 group: "complexity",
1368 desc: "having a variable on both sides of an assign op",
1370 module: "assign_ops",
1373 name: "missing_const_for_fn",
1375 desc: "Lint functions definitions that could be made `const fn`",
1377 module: "missing_const_for_fn",
1380 name: "missing_docs_in_private_items",
1381 group: "restriction",
1382 desc: "detects missing documentation for public and private members",
1384 module: "missing_doc",
1387 name: "missing_errors_doc",
1389 desc: "`pub fn` returns `Result` without `# Errors` in doc comment",
1394 name: "missing_inline_in_public_items",
1395 group: "restriction",
1396 desc: "detects missing `#[inline]` attribute for public callables (functions, trait methods, methods...)",
1398 module: "missing_inline",
1401 name: "missing_safety_doc",
1403 desc: "`pub unsafe fn` without `# Safety` docs",
1408 name: "mistyped_literal_suffixes",
1409 group: "correctness",
1410 desc: "mistyped literal suffix",
1412 module: "literal_representation",
1415 name: "mixed_case_hex_literals",
1417 desc: "hex literals whose letter digits are not consistently upper- or lowercased",
1419 module: "misc_early",
1422 name: "module_inception",
1424 desc: "modules that have the same name as their parent module",
1426 module: "enum_variants",
1429 name: "module_name_repetitions",
1431 desc: "type names prefixed/postfixed with their containing module\'s name",
1433 module: "enum_variants",
1436 name: "modulo_arithmetic",
1437 group: "restriction",
1438 desc: "any modulo arithmetic statement",
1440 module: "modulo_arithmetic",
1444 group: "correctness",
1445 desc: "taking a number modulo 1, which always returns 0",
1450 name: "multiple_crate_versions",
1452 desc: "multiple versions of the same crate being used",
1454 module: "multiple_crate_versions",
1457 name: "multiple_inherent_impl",
1458 group: "restriction",
1459 desc: "Multiple inherent impl that could be grouped",
1461 module: "inherent_impl",
1464 name: "must_use_candidate",
1466 desc: "function or method that could take a `#[must_use]` attribute",
1468 module: "functions",
1471 name: "must_use_unit",
1473 desc: "`#[must_use]` attribute on a unit-returning function / method",
1475 module: "functions",
1478 name: "mut_from_ref",
1479 group: "correctness",
1480 desc: "fns that create mutable refs from immutable ref args",
1487 desc: "usage of double-mut refs, e.g., `&mut &mut ...`",
1492 name: "mut_range_bound",
1493 group: "complexity",
1494 desc: "for loop over a range where one of the bounds is a mutable variable",
1499 name: "mutable_key_type",
1500 group: "correctness",
1501 desc: "Check for mutable `Map`/`Set` key type",
1506 name: "mutex_atomic",
1508 desc: "using a mutex where an atomic value could be used instead",
1510 module: "mutex_atomic",
1513 name: "mutex_integer",
1515 desc: "using a mutex for an integer type",
1517 module: "mutex_atomic",
1520 name: "naive_bytecount",
1522 desc: "use of naive `<slice>.filter(|&x| x == y).count()` to count byte values",
1524 module: "bytecount",
1527 name: "needless_arbitrary_self_type",
1528 group: "complexity",
1529 desc: "type of `self` parameter is already by default `Self`",
1531 module: "needless_arbitrary_self_type",
1534 name: "needless_bool",
1535 group: "complexity",
1536 desc: "if-statements with plain booleans in the then- and else-clause, e.g., `if p { true } else { false }`",
1538 module: "needless_bool",
1541 name: "needless_borrow",
1543 desc: "taking a reference that is going to be automatically dereferenced",
1545 module: "needless_borrow",
1548 name: "needless_borrowed_reference",
1549 group: "complexity",
1550 desc: "taking a needless borrowed reference",
1552 module: "needless_borrowed_ref",
1555 name: "needless_collect",
1557 desc: "collecting an iterator when collect is not needed",
1562 name: "needless_continue",
1564 desc: "`continue` statements that can be replaced by a rearrangement of code",
1566 module: "needless_continue",
1569 name: "needless_doctest_main",
1571 desc: "presence of `fn main() {` in code examples",
1576 name: "needless_lifetimes",
1577 group: "complexity",
1578 desc: "using explicit lifetimes for references in function arguments when elision rules would allow omitting them",
1580 module: "lifetimes",
1583 name: "needless_pass_by_value",
1585 desc: "functions taking arguments by value, but not consuming them in its body",
1587 module: "needless_pass_by_value",
1590 name: "needless_range_loop",
1592 desc: "for-looping over a range of indices where an iterator over items would do",
1597 name: "needless_return",
1599 desc: "using a return statement like `return expr;` where an expression would suffice",
1604 name: "needless_update",
1605 group: "complexity",
1606 desc: "using `Foo { ..base }` when there are no missing fields",
1608 module: "needless_update",
1611 name: "neg_cmp_op_on_partial_ord",
1612 group: "complexity",
1613 desc: "The use of negated comparison operators on partially ordered types may produce confusing code.",
1615 module: "neg_cmp_op_on_partial_ord",
1618 name: "neg_multiply",
1620 desc: "multiplying integers with `-1`",
1622 module: "neg_multiply",
1626 group: "correctness",
1627 desc: "any loop that will always `break` or `return`",
1632 name: "new_ret_no_self",
1634 desc: "not returning type containing `Self` in a `new` method",
1639 name: "new_without_default",
1641 desc: "`fn new() -> Self` method without `Default` implementation",
1643 module: "new_without_default",
1647 group: "complexity",
1648 desc: "statements with no effect",
1650 module: "no_effect",
1653 name: "non_ascii_literal",
1655 desc: "using any literal non-ASCII chars in a string literal instead of using the `\\\\u` escape",
1660 name: "nonminimal_bool",
1661 group: "complexity",
1662 desc: "boolean expressions that can be written more concisely",
1667 name: "nonsensical_open_options",
1668 group: "correctness",
1669 desc: "nonsensical combination of options for opening a file",
1671 module: "open_options",
1674 name: "not_unsafe_ptr_arg_deref",
1675 group: "correctness",
1676 desc: "public functions dereferencing raw pointer arguments but not marked `unsafe`",
1678 module: "functions",
1683 desc: "using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result",
1690 desc: "taking a reference to satisfy the type constraints on `==`",
1695 name: "option_as_ref_deref",
1696 group: "complexity",
1697 desc: "using `as_ref().map(Deref::deref)`, which is more succinctly expressed as `as_deref()`",
1702 name: "option_env_unwrap",
1703 group: "correctness",
1704 desc: "using `option_env!(...).unwrap()` to get environment variable",
1706 module: "option_env_unwrap",
1709 name: "option_if_let_else",
1711 desc: "reimplementation of Option::map_or",
1713 module: "option_if_let_else",
1716 name: "option_map_or_none",
1718 desc: "using `Option.map_or(None, f)`, which is more succinctly expressed as `and_then(f)`",
1723 name: "option_map_unit_fn",
1724 group: "complexity",
1725 desc: "using `option.map(f)`, where `f` is a function or closure that returns `()`",
1727 module: "map_unit_fn",
1730 name: "option_option",
1732 desc: "usage of `Option<Option<T>>`",
1737 name: "or_fun_call",
1739 desc: "using any `*or` method with a function call, which suggests `*or_else`",
1744 name: "out_of_bounds_indexing",
1745 group: "correctness",
1746 desc: "out of bounds constant indexing",
1748 module: "indexing_slicing",
1751 name: "overflow_check_conditional",
1752 group: "complexity",
1753 desc: "overflow checks inspired by C which are likely to panic",
1755 module: "overflow_check_conditional",
1759 group: "restriction",
1760 desc: "usage of the `panic!` macro",
1762 module: "panic_unimplemented",
1765 name: "panic_in_result_fn",
1766 group: "restriction",
1767 desc: "functions of type `Result<..>` that contain `panic!()`, `todo!()` or `unreachable()` or `unimplemented()` ",
1769 module: "panic_in_result_fn",
1772 name: "panic_params",
1774 desc: "missing parameters in `panic!` calls",
1776 module: "panic_unimplemented",
1779 name: "panicking_unwrap",
1780 group: "correctness",
1781 desc: "checks for calls of `unwrap[_err]()` that will always fail",
1786 name: "partialeq_ne_impl",
1787 group: "complexity",
1788 desc: "re-implementing `PartialEq::ne`",
1790 module: "partialeq_ne_impl",
1793 name: "path_buf_push_overwrite",
1795 desc: "calling `push` with file system root on `PathBuf` can overwrite it",
1797 module: "path_buf_push_overwrite",
1800 name: "pattern_type_mismatch",
1801 group: "restriction",
1802 desc: "type of pattern does not match the expression type",
1804 module: "pattern_type_mismatch",
1807 name: "possible_missing_comma",
1808 group: "correctness",
1809 desc: "possible missing comma in array",
1811 module: "formatting",
1815 group: "complexity",
1816 desc: "operations where precedence may be unclear",
1818 module: "precedence",
1821 name: "print_literal",
1823 desc: "printing a literal with a format string",
1828 name: "print_stdout",
1829 group: "restriction",
1830 desc: "printing on stdout",
1835 name: "print_with_newline",
1837 desc: "using `print!()` with a format string that ends in a single newline",
1842 name: "println_empty_string",
1844 desc: "using `println!(\"\")` with an empty string",
1851 desc: "fn arguments of the type `&Vec<...>` or `&String`, suggesting to use `&[...]` or `&str` instead, respectively",
1858 desc: "use `std::ptr::eq` when comparing raw pointers",
1863 name: "ptr_offset_with_cast",
1864 group: "complexity",
1865 desc: "unneeded pointer offset cast",
1867 module: "ptr_offset_with_cast",
1870 name: "pub_enum_variant_names",
1872 desc: "public enums where all variants share a prefix/postfix",
1874 module: "enum_variants",
1877 name: "question_mark",
1879 desc: "checks for expressions that could be replaced by the question mark operator",
1881 module: "question_mark",
1884 name: "range_minus_one",
1886 desc: "`x..=(y-1)` reads better as `x..y`",
1891 name: "range_plus_one",
1893 desc: "`x..(y+1)` reads better as `x..=y`",
1898 name: "range_zip_with_len",
1899 group: "complexity",
1900 desc: "zipping iterator with a range when `enumerate()` would do",
1906 group: "restriction",
1907 desc: "shared ownership of a buffer type",
1912 name: "redundant_allocation",
1914 desc: "redundant allocation",
1919 name: "redundant_clone",
1921 desc: "`clone()` of an owned value that is going to be dropped immediately",
1923 module: "redundant_clone",
1926 name: "redundant_closure",
1928 desc: "redundant closures, i.e., `|a| foo(a)` (which can be written as just `foo`)",
1930 module: "eta_reduction",
1933 name: "redundant_closure_call",
1934 group: "complexity",
1935 desc: "throwaway closures called in the expression they are defined",
1937 module: "redundant_closure_call",
1940 name: "redundant_closure_for_method_calls",
1942 desc: "redundant closures for method calls",
1944 module: "eta_reduction",
1947 name: "redundant_field_names",
1949 desc: "checks for fields in struct literals where shorthands could be used",
1951 module: "redundant_field_names",
1954 name: "redundant_pattern",
1956 desc: "using `name @ _` in a pattern",
1958 module: "misc_early",
1961 name: "redundant_pattern_matching",
1963 desc: "use the proper utility function avoiding an `if let`",
1968 name: "redundant_pub_crate",
1970 desc: "Using `pub(crate)` visibility on items that are not crate visible due to the visibility of the module that contains them.",
1972 module: "redundant_pub_crate",
1975 name: "redundant_static_lifetimes",
1977 desc: "Using explicit `\'static` lifetime for constants or statics when elision rules would allow omitting them.",
1979 module: "redundant_static_lifetimes",
1982 name: "ref_in_deref",
1983 group: "complexity",
1984 desc: "Use of reference in auto dereference expression.",
1986 module: "reference",
1989 name: "repeat_once",
1990 group: "complexity",
1991 desc: "using `.repeat(1)` instead of `String.clone()`, `str.to_string()` or `slice.to_vec()` ",
1993 module: "repeat_once",
1996 name: "rest_pat_in_fully_bound_structs",
1997 group: "restriction",
1998 desc: "a match on a struct that binds all fields but still uses the wildcard pattern",
2003 name: "result_map_or_into_option",
2005 desc: "using `Result.map_or(None, Some)`, which is more succinctly expressed as `ok()`",
2010 name: "result_map_unit_fn",
2011 group: "complexity",
2012 desc: "using `result.map(f)`, where `f` is a function or closure that returns `()`",
2014 module: "map_unit_fn",
2017 name: "result_unit_err",
2019 desc: "public function returning `Result` with an `Err` type of `()`",
2021 module: "functions",
2024 name: "reversed_empty_ranges",
2025 group: "correctness",
2026 desc: "reversing the limits of range expressions, resulting in empty ranges",
2031 name: "same_functions_in_if_condition",
2033 desc: "consecutive `if`s with the same function call",
2038 name: "same_item_push",
2040 desc: "the same item is pushed inside of a for loop",
2045 name: "search_is_some",
2046 group: "complexity",
2047 desc: "using an iterator search followed by `is_some()`, which is more succinctly expressed as a call to `any()`",
2052 name: "self_assignment",
2053 group: "correctness",
2054 desc: "explicit self-assignment",
2056 module: "self_assignment",
2059 name: "serde_api_misuse",
2060 group: "correctness",
2061 desc: "various things that will negatively affect your serde experience",
2063 module: "serde_api",
2066 name: "shadow_reuse",
2067 group: "restriction",
2068 desc: "rebinding a name to an expression that re-uses the original value, e.g., `let x = x + 1`",
2073 name: "shadow_same",
2074 group: "restriction",
2075 desc: "rebinding a name to itself, e.g., `let mut x = &mut x`",
2080 name: "shadow_unrelated",
2082 desc: "rebinding a name without even using the original value",
2087 name: "short_circuit_statement",
2088 group: "complexity",
2089 desc: "using a short circuit boolean condition as a statement",
2094 name: "should_implement_trait",
2096 desc: "defining a method that should be implementing a std trait",
2101 name: "similar_names",
2103 desc: "similarly named items and bindings",
2105 module: "non_expressive_names",
2108 name: "single_char_pattern",
2110 desc: "using a single-character str where a char could be used, e.g., `_.split(\"x\")`",
2115 name: "single_char_push_str",
2117 desc: "`push_str()` used with a single-character string literal as parameter",
2122 name: "single_component_path_imports",
2124 desc: "imports with single component path are redundant",
2126 module: "single_component_path_imports",
2129 name: "single_element_loop",
2130 group: "complexity",
2131 desc: "there is no reason to have a single element loop",
2136 name: "single_match",
2138 desc: "a `match` statement with a single nontrivial arm (i.e., where the other arm is `_ => {}`) instead of `if let`",
2143 name: "single_match_else",
2145 desc: "a `match` statement with two arms where the second arm\'s pattern is a placeholder instead of a specific match pattern",
2150 name: "skip_while_next",
2151 group: "complexity",
2152 desc: "using `skip_while(p).next()`, which is more succinctly expressed as `.find(!p)`",
2157 name: "slow_vector_initialization",
2159 desc: "slow vector initialization",
2161 module: "slow_vector_initialization",
2164 name: "stable_sort_primitive",
2166 desc: "use of sort() when sort_unstable() is equivalent",
2168 module: "stable_sort_primitive",
2172 group: "restriction",
2173 desc: "using `x + ..` where x is a `String` instead of `push_str()`",
2178 name: "string_add_assign",
2180 desc: "using `x = x + ..` where x is a `String` instead of `push_str()`",
2185 name: "string_extend_chars",
2187 desc: "using `x.extend(s.chars())` where s is a `&str` or `String`",
2192 name: "string_lit_as_bytes",
2194 desc: "calling `as_bytes` on a string literal instead of using a byte string literal",
2199 name: "struct_excessive_bools",
2201 desc: "using too many bools in a struct",
2203 module: "excessive_bools",
2206 name: "suboptimal_flops",
2208 desc: "usage of sub-optimal floating point operations",
2210 module: "floating_point_arithmetic",
2213 name: "suspicious_arithmetic_impl",
2214 group: "correctness",
2215 desc: "suspicious use of operators in impl of arithmetic trait",
2217 module: "suspicious_trait_impl",
2220 name: "suspicious_assignment_formatting",
2222 desc: "suspicious formatting of `*=`, `-=` or `!=`",
2224 module: "formatting",
2227 name: "suspicious_else_formatting",
2229 desc: "suspicious formatting of `else`",
2231 module: "formatting",
2234 name: "suspicious_map",
2235 group: "complexity",
2236 desc: "suspicious usage of map",
2241 name: "suspicious_op_assign_impl",
2242 group: "correctness",
2243 desc: "suspicious use of operators in impl of OpAssign trait",
2245 module: "suspicious_trait_impl",
2248 name: "suspicious_unary_op_formatting",
2250 desc: "suspicious formatting of unary `-` or `!` on the RHS of a BinOp",
2252 module: "formatting",
2255 name: "tabs_in_doc_comments",
2257 desc: "using tabs in doc comments is not recommended",
2259 module: "tabs_in_doc_comments",
2262 name: "temporary_assignment",
2263 group: "complexity",
2264 desc: "assignments to temporaries",
2266 module: "temporary_assignment",
2269 name: "temporary_cstring_as_ptr",
2270 group: "correctness",
2271 desc: "getting the inner pointer of a temporary `CString`",
2276 name: "to_digit_is_some",
2278 desc: "`char.is_digit()` is clearer",
2280 module: "to_digit_is_some",
2283 name: "to_string_in_display",
2284 group: "correctness",
2285 desc: "`to_string` method used while implementing `Display` trait",
2287 module: "to_string_in_display",
2291 group: "restriction",
2292 desc: "`todo!` should not be present in production code",
2294 module: "panic_unimplemented",
2297 name: "too_many_arguments",
2298 group: "complexity",
2299 desc: "functions with too many arguments",
2301 module: "functions",
2304 name: "too_many_lines",
2306 desc: "functions with too many lines",
2308 module: "functions",
2311 name: "toplevel_ref_arg",
2313 desc: "an entire binding declared as `ref`, in a function argument or a `let` statement",
2318 name: "trait_duplication_in_bounds",
2320 desc: "Check if the same trait bounds are specified twice during a function declaration",
2322 module: "trait_bounds",
2325 name: "transmute_bytes_to_str",
2326 group: "complexity",
2327 desc: "transmutes from a `&[u8]` to a `&str`",
2329 module: "transmute",
2332 name: "transmute_float_to_int",
2333 group: "complexity",
2334 desc: "transmutes from a float to an integer",
2336 module: "transmute",
2339 name: "transmute_int_to_bool",
2340 group: "complexity",
2341 desc: "transmutes from an integer to a `bool`",
2343 module: "transmute",
2346 name: "transmute_int_to_char",
2347 group: "complexity",
2348 desc: "transmutes from an integer to a `char`",
2350 module: "transmute",
2353 name: "transmute_int_to_float",
2354 group: "complexity",
2355 desc: "transmutes from an integer to a float",
2357 module: "transmute",
2360 name: "transmute_ptr_to_ptr",
2361 group: "complexity",
2362 desc: "transmutes from a pointer to a pointer / a reference to a reference",
2364 module: "transmute",
2367 name: "transmute_ptr_to_ref",
2368 group: "complexity",
2369 desc: "transmutes from a pointer to a reference type",
2371 module: "transmute",
2374 name: "transmutes_expressible_as_ptr_casts",
2375 group: "complexity",
2376 desc: "transmutes that could be a pointer cast",
2378 module: "transmute",
2381 name: "transmuting_null",
2382 group: "correctness",
2383 desc: "transmutes from a null pointer to a reference, which is undefined behavior",
2385 module: "transmuting_null",
2388 name: "trivial_regex",
2390 desc: "trivial regular expressions",
2395 name: "trivially_copy_pass_by_ref",
2397 desc: "functions taking small copyable arguments by reference",
2399 module: "trivially_copy_pass_by_ref",
2404 desc: "return errors explicitly rather than hiding them behind a `?`",
2409 name: "type_complexity",
2410 group: "complexity",
2411 desc: "usage of very complex types that might be better factored into `type` definitions",
2416 name: "type_repetition_in_bounds",
2418 desc: "Types are repeated unnecessary in trait bounds use `+` instead of using `T: _, T: _`",
2420 module: "trait_bounds",
2423 name: "unicode_not_nfc",
2425 desc: "using a Unicode literal not in NFC normal form (see [Unicode tr15](http://www.unicode.org/reports/tr15/) for further information)",
2430 name: "unimplemented",
2431 group: "restriction",
2432 desc: "`unimplemented!` should not be present in production code",
2434 module: "panic_unimplemented",
2437 name: "uninit_assumed_init",
2438 group: "correctness",
2439 desc: "`MaybeUninit::uninit().assume_init()`",
2445 group: "complexity",
2446 desc: "passing unit to a function",
2452 group: "correctness",
2453 desc: "comparing unit values",
2458 name: "unit_return_expecting_ord",
2459 group: "correctness",
2460 desc: "fn arguments of type Fn(...) -> Ord returning the unit type ().",
2462 module: "unit_return_expecting_ord",
2465 name: "unknown_clippy_lints",
2467 desc: "unknown_lints for scoped Clippy lints",
2472 name: "unnecessary_cast",
2473 group: "complexity",
2474 desc: "cast to the same type, e.g., `x as i32` where `x: i32`",
2479 name: "unnecessary_filter_map",
2480 group: "complexity",
2481 desc: "using `filter_map` when a more succinct alternative exists",
2486 name: "unnecessary_fold",
2488 desc: "using `fold` when a more succinct alternative exists",
2493 name: "unnecessary_lazy_evaluations",
2495 desc: "using unnecessary lazy evaluation, which can be replaced with simpler eager evaluation",
2500 name: "unnecessary_mut_passed",
2502 desc: "an argument passed as a mutable reference although the callee only demands an immutable reference",
2504 module: "mut_reference",
2507 name: "unnecessary_operation",
2508 group: "complexity",
2509 desc: "outer expressions with no effect",
2511 module: "no_effect",
2514 name: "unnecessary_sort_by",
2515 group: "complexity",
2516 desc: "Use of `Vec::sort_by` when `Vec::sort_by_key` or `Vec::sort` would be clearer",
2518 module: "unnecessary_sort_by",
2521 name: "unnecessary_unwrap",
2522 group: "complexity",
2523 desc: "checks for calls of `unwrap[_err]()` that cannot fail",
2528 name: "unneeded_field_pattern",
2529 group: "restriction",
2530 desc: "struct fields bound to a wildcard instead of using `..`",
2532 module: "misc_early",
2535 name: "unneeded_wildcard_pattern",
2536 group: "complexity",
2537 desc: "tuple patterns with a wildcard pattern (`_`) is next to a rest pattern (`..`)",
2539 module: "misc_early",
2542 name: "unnested_or_patterns",
2544 desc: "unnested or-patterns, e.g., `Foo(Bar) | Foo(Baz) instead of `Foo(Bar | Baz)`",
2546 module: "unnested_or_patterns",
2549 name: "unreachable",
2550 group: "restriction",
2551 desc: "`unreachable!` should not be present in production code",
2553 module: "panic_unimplemented",
2556 name: "unreadable_literal",
2558 desc: "long integer literal without underscores",
2560 module: "literal_representation",
2563 name: "unsafe_derive_deserialize",
2565 desc: "deriving `serde::Deserialize` on a type that has methods using `unsafe`",
2570 name: "unsafe_removed_from_name",
2572 desc: "`unsafe` removed from API names on import",
2574 module: "unsafe_removed_from_name",
2577 name: "unseparated_literal_suffix",
2579 desc: "literals whose suffix is not separated by an underscore",
2581 module: "misc_early",
2584 name: "unsound_collection_transmute",
2585 group: "correctness",
2586 desc: "transmute between collections of layout-incompatible types",
2588 module: "transmute",
2591 name: "unused_io_amount",
2592 group: "correctness",
2593 desc: "unused written/read amount",
2595 module: "unused_io_amount",
2598 name: "unused_self",
2600 desc: "methods that contain a `self` argument but don\'t use it",
2602 module: "unused_self",
2605 name: "unused_unit",
2607 desc: "needless unit expression",
2609 module: "unused_unit",
2612 name: "unwrap_in_result",
2613 group: "restriction",
2614 desc: "functions of type `Result<..>` or `Option`<...> that contain `expect()` or `unwrap()`",
2616 module: "unwrap_in_result",
2619 name: "unwrap_used",
2620 group: "restriction",
2621 desc: "using `.unwrap()` on `Result` or `Option`, which should at least get a better message using `expect()`",
2627 group: "restriction",
2628 desc: "use of `Debug`-based formatting",
2635 desc: "unnecessary structure name repetition whereas `Self` is applicable",
2640 name: "used_underscore_binding",
2642 desc: "using a binding which is prefixed with an underscore",
2647 name: "useless_asref",
2648 group: "complexity",
2649 desc: "using `as_ref` where the types before and after the call are the same",
2654 name: "useless_attribute",
2655 group: "correctness",
2656 desc: "use of lint attributes on `extern crate` items",
2661 name: "useless_conversion",
2662 group: "complexity",
2663 desc: "calls to `Into`, `TryInto`, `From`, `TryFrom`, `IntoIter` that performs useless conversions to the same type",
2665 module: "useless_conversion",
2668 name: "useless_format",
2669 group: "complexity",
2670 desc: "useless use of `format!`",
2675 name: "useless_let_if_seq",
2677 desc: "unidiomatic `let mut` declaration followed by initialization in `if`",
2679 module: "let_if_seq",
2682 name: "useless_transmute",
2684 desc: "transmutes that have the same to and from types or could be a cast/coercion",
2686 module: "transmute",
2689 name: "useless_vec",
2691 desc: "useless `vec!`",
2697 group: "complexity",
2698 desc: "usage of `Vec<Box<T>>` where T: Sized, vector elements are already on the heap",
2703 name: "vec_resize_to_zero",
2704 group: "correctness",
2705 desc: "emptying a vector with `resize(0, an_int)` instead of `clear()` is probably an argument inversion mistake",
2707 module: "vec_resize_to_zero",
2710 name: "verbose_bit_mask",
2712 desc: "expressions where a bit mask is less readable than the corresponding method call",
2717 name: "verbose_file_reads",
2718 group: "restriction",
2719 desc: "use of `File::read_to_end` or `File::read_to_string`",
2721 module: "verbose_file_reads",
2724 name: "vtable_address_comparisons",
2725 group: "correctness",
2726 desc: "comparison with an address of a trait vtable",
2728 module: "unnamed_address",
2731 name: "while_immutable_condition",
2732 group: "correctness",
2733 desc: "variables used within while expression are not mutated in the body",
2738 name: "while_let_loop",
2739 group: "complexity",
2740 desc: "`loop { if let { ... } else break }`, which can be written as a `while let` loop",
2745 name: "while_let_on_iterator",
2747 desc: "using a while-let loop instead of a for loop on an iterator",
2752 name: "wildcard_dependencies",
2754 desc: "wildcard dependencies being used",
2756 module: "wildcard_dependencies",
2759 name: "wildcard_enum_match_arm",
2760 group: "restriction",
2761 desc: "a wildcard enum match arm using `_`",
2766 name: "wildcard_imports",
2768 desc: "lint `use _::*` statements",
2770 module: "wildcard_imports",
2773 name: "wildcard_in_or_patterns",
2774 group: "complexity",
2775 desc: "a wildcard pattern used with others patterns in same match arm",
2780 name: "write_literal",
2782 desc: "writing a literal with a format string",
2787 name: "write_with_newline",
2789 desc: "using `write!()` with a format string that ends in a single newline",
2794 name: "writeln_empty_string",
2796 desc: "using `writeln!(buf, \"\")` with an empty string",
2801 name: "wrong_pub_self_convention",
2802 group: "restriction",
2803 desc: "defining a public method named with an established prefix (like \"into_\") that takes `self` with the wrong convention",
2808 name: "wrong_self_convention",
2810 desc: "defining a method named with an established prefix (like \"into_\") that takes `self` with the wrong convention",
2815 name: "wrong_transmute",
2816 group: "correctness",
2817 desc: "transmutes that are confusing at best, undefined behaviour at worst and always useless",
2819 module: "transmute",
2822 name: "zero_divided_by_zero",
2823 group: "complexity",
2824 desc: "usage of `0.0 / 0.0` to obtain NaN instead of `f32::NAN` or `f64::NAN`",
2826 module: "zero_div_zero",
2829 name: "zero_prefixed_literal",
2830 group: "complexity",
2831 desc: "integer literals starting with `0`",
2833 module: "misc_early",
2838 desc: "using `0 as *{const, mut} T`",
2844 group: "correctness",
2845 desc: "Check for offset calculations on raw pointers to zero-sized types",
2850 // end lint list, do not remove this comment, it’s used in `update_lints`