1 //! This file is managed by util/dev update_lints. Do not edit.
5 pub use lint::LintLevel;
6 pub use lint::LINT_LEVELS;
8 pub const ALL_LINTS: [Lint; 304] = [
10 name: "absurd_extreme_comparisons",
12 desc: "a comparison with a maximum or minimum value that is always true or false",
17 name: "almost_swapped",
19 desc: "`foo = bar; bar = foo` sequence",
24 name: "approx_constant",
26 desc: "the approximate of a known float constant (in `std::fXX::consts`)",
28 module: "approx_const",
31 name: "assertions_on_constants",
33 desc: "`assert!(true)` / `assert!(false)` will be optimized out by the compiler, and should probably be replaced by a `panic!()` or `unreachable!()`",
35 module: "assertions_on_constants",
38 name: "assign_op_pattern",
40 desc: "assigning the result of an operation on a variable to that same variable",
47 desc: "expressions of the form `_ & mask == select` that will only ever return `true` or `false`",
52 name: "blacklisted_name",
54 desc: "usage of a blacklisted/placeholder name",
56 module: "blacklisted_name",
59 name: "block_in_if_condition_expr",
61 desc: "braces that can be eliminated in conditions, e.g., `if { true } ...`",
63 module: "block_in_if_condition",
66 name: "block_in_if_condition_stmt",
68 desc: "complex blocks in conditions, e.g., `if { let x = true; x } ...`",
70 module: "block_in_if_condition",
73 name: "bool_comparison",
75 desc: "comparing a variable to a boolean, e.g., `if x == true` or `if x != true`",
77 module: "needless_bool",
80 name: "borrow_interior_mutable_const",
82 desc: "referencing const with interior mutability",
84 module: "non_copy_const",
89 desc: "a borrow of a boxed type",
96 desc: "usage of `Box<Vec<T>>`, vector elements are already on the heap",
103 desc: "using `Box<T>` where unnecessary",
108 name: "builtin_type_shadow",
110 desc: "shadowing a builtin type",
112 module: "misc_early",
115 name: "cargo_common_metadata",
117 desc: "common metadata is defined in `Cargo.toml`",
119 module: "cargo_common_metadata",
122 name: "cast_lossless",
124 desc: "casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`",
129 name: "cast_possible_truncation",
131 desc: "casts that may cause truncation of the value, e.g., `x as u8` where `x: u32`, or `x as i32` where `x: f32`",
136 name: "cast_possible_wrap",
138 desc: "casts that may cause wrapping around the value, e.g., `x as i32` where `x: u32` and `x > i32::MAX`",
143 name: "cast_precision_loss",
145 desc: "casts that cause loss of precision, e.g., `x as f32` where `x: u64`",
150 name: "cast_ptr_alignment",
151 group: "correctness",
152 desc: "cast from a pointer to a more-strictly-aligned pointer",
157 name: "cast_ref_to_mut",
158 group: "correctness",
159 desc: "a cast of reference to a mutable pointer",
164 name: "cast_sign_loss",
166 desc: "casts from signed types to unsigned types, e.g., `x as u32` where `x: i32`",
171 name: "char_lit_as_u8",
173 desc: "casting a character literal to u8",
178 name: "chars_last_cmp",
180 desc: "using `.chars().last()` or `.chars().next_back()` to check if a string ends with a char",
185 name: "chars_next_cmp",
187 desc: "using `.chars().next()` to check if a string starts with a char",
192 name: "checked_conversions",
194 desc: "`try_from` could replace manual bounds checking when casting",
196 module: "checked_conversions",
199 name: "clone_double_ref",
200 group: "correctness",
201 desc: "using `clone` on `&&T`",
206 name: "clone_on_copy",
208 desc: "using `clone` on a `Copy` type",
213 name: "clone_on_ref_ptr",
214 group: "restriction",
215 desc: "using \'clone\' on a ref-counted pointer",
221 group: "correctness",
222 desc: "comparisons to NAN, which will always return false, probably not intended",
229 desc: "comparing a pointer to a null pointer, suggesting to use `.is_null()` instead.",
236 desc: "creating owned instances for comparing with others, e.g., `x == \"foo\".to_string()`",
241 name: "cognitive_complexity",
243 desc: "functions that should be split up into multiple functions",
245 module: "cognitive_complexity",
248 name: "collapsible_if",
250 desc: "`if`s that can be collapsed (e.g., `if x { if y { ... } }` and `else { if x { ... } }`)",
252 module: "collapsible_if",
255 name: "const_static_lifetime",
257 desc: "Using explicit `\'static` lifetime for constants when elision rules would allow omitting them.",
259 module: "const_static_lifetime",
262 name: "copy_iterator",
264 desc: "implementing `Iterator` on a `Copy` type",
266 module: "copy_iterator",
269 name: "crosspointer_transmute",
271 desc: "transmutes that have to or from types that are a pointer to the other",
277 group: "restriction",
278 desc: "`dbg!` macro is intended as a debugging tool",
283 name: "decimal_literal_representation",
284 group: "restriction",
285 desc: "using decimal representation when hexadecimal would be better",
287 module: "literal_representation",
290 name: "declare_interior_mutable_const",
291 group: "correctness",
292 desc: "declaring const with interior mutability",
294 module: "non_copy_const",
297 name: "default_trait_access",
299 desc: "checks for literal calls to Default::default()",
301 module: "default_trait_access",
304 name: "deprecated_cfg_attr",
306 desc: "usage of `cfg_attr(rustfmt)` instead of `tool_attributes`",
311 name: "deprecated_semver",
312 group: "correctness",
313 desc: "use of `#[deprecated(since = \"x\")]` where x is not semver",
318 name: "deref_addrof",
320 desc: "use of `*&` or `*&mut` in an expression",
325 name: "derive_hash_xor_eq",
326 group: "correctness",
327 desc: "deriving `Hash` but implementing `PartialEq` explicitly",
332 name: "diverging_sub_expression",
334 desc: "whether an expression contains a diverging sub expression",
336 module: "eval_order_dependence",
339 name: "doc_markdown",
341 desc: "presence of `_`, `::` or camel-case outside backticks in documentation",
346 name: "double_comparisons",
348 desc: "unnecessary double comparisons that can be simplified",
350 module: "double_comparison",
355 desc: "`--x`, which is a double negation of `x` and not a pre-decrement as in C/C++",
357 module: "misc_early",
360 name: "double_parens",
362 desc: "Warn on unnecessary double parentheses",
364 module: "double_parens",
368 group: "correctness",
369 desc: "Bounds of the form `T: Drop` are useless",
371 module: "drop_bounds",
375 group: "correctness",
376 desc: "calls to `std::mem::drop` with a value that implements Copy",
378 module: "drop_forget_ref",
382 group: "correctness",
383 desc: "calls to `std::mem::drop` with a reference instead of an owned value",
385 module: "drop_forget_ref",
388 name: "duplicate_underscore_argument",
390 desc: "function arguments having names which only differ by an underscore",
392 module: "misc_early",
395 name: "duration_subsec",
397 desc: "checks for calculation of subsecond microseconds or milliseconds",
399 module: "duration_subsec",
402 name: "else_if_without_else",
403 group: "restriction",
404 desc: "if expression with an `else if`, but without a final `else` branch",
406 module: "else_if_without_else",
411 desc: "enum with no variants",
413 module: "empty_enum",
416 name: "empty_line_after_outer_attr",
418 desc: "empty line after outer attribute",
425 desc: "empty `loop {}`, which should block or sleep",
430 name: "enum_clike_unportable_variant",
431 group: "correctness",
432 desc: "C-like enums that are `repr(isize/usize)` and have values that don\'t fit into an `i32`",
434 module: "enum_clike",
437 name: "enum_glob_use",
439 desc: "use items that import all variants of an enum",
441 module: "enum_glob_use",
444 name: "enum_variant_names",
446 desc: "enums where all variants share a prefix/postfix",
448 module: "enum_variants",
452 group: "correctness",
453 desc: "equal operands on both sides of a comparison or bitwise combination (e.g., `x == x`)",
459 group: "correctness",
460 desc: "using erasing operations, e.g., `x * 0` or `y & 0`",
462 module: "erasing_op",
465 name: "eval_order_dependence",
467 desc: "whether a variable read occurs before a write depends on sub-expression evaluation order",
469 module: "eval_order_dependence",
472 name: "excessive_precision",
474 desc: "excessive precision for float literal",
476 module: "excessive_precision",
479 name: "expect_fun_call",
481 desc: "using any `expect` method with a function call",
486 name: "expl_impl_clone_on_copy",
488 desc: "implementing `Clone` explicitly on `Copy` types",
493 name: "explicit_counter_loop",
495 desc: "for-looping with an explicit counter when `_.enumerate()` would do",
500 name: "explicit_into_iter_loop",
502 desc: "for-looping over `_.into_iter()` when `_` would do",
507 name: "explicit_iter_loop",
509 desc: "for-looping over `_.iter()` or `_.iter_mut()` when `&_` or `&mut _` would do",
514 name: "explicit_write",
516 desc: "using the `write!()` family of functions instead of the `print!()` family of functions, when using the latter would work",
518 module: "explicit_write",
521 name: "extra_unused_lifetimes",
523 desc: "unused lifetimes in function definitions",
528 name: "fallible_impl_from",
530 desc: "Warn on impls of `From<..>` that contain `panic!()` or `unwrap()`",
532 module: "fallible_impl_from",
537 desc: "using combinations of `filter`, `map`, `filter_map` and `flat_map` which can usually be written as a single method call",
542 name: "filter_map_next",
544 desc: "using combination of `filter_map` and `next` which can usually be written as a single method call",
551 desc: "using `filter(p).next()`, which is more succinctly expressed as `.find(p)`",
558 desc: "using a combination of `find` and `map` can usually be written as a single method call",
563 name: "float_arithmetic",
564 group: "restriction",
565 desc: "any floating-point arithmetic statement",
567 module: "arithmetic",
571 group: "correctness",
572 desc: "using `==` or `!=` on float values instead of comparing difference with an epsilon",
577 name: "float_cmp_const",
578 group: "restriction",
579 desc: "using `==` or `!=` on float constants instead of comparing difference with an epsilon",
584 name: "fn_to_numeric_cast",
586 desc: "casting a function pointer to a numeric type other than usize",
591 name: "fn_to_numeric_cast_with_truncation",
593 desc: "casting a function pointer to a numeric type not wide enough to store the address",
600 desc: "looping on a map using `iter` when `keys` or `values` would do",
605 name: "for_loop_over_option",
606 group: "correctness",
607 desc: "for-looping over an `Option`, which is more clearly expressed as an `if let`",
612 name: "for_loop_over_result",
613 group: "correctness",
614 desc: "for-looping over a `Result`, which is more clearly expressed as an `if let`",
620 group: "correctness",
621 desc: "calls to `std::mem::forget` with a value that implements Copy",
623 module: "drop_forget_ref",
627 group: "correctness",
628 desc: "calls to `std::mem::forget` with a reference instead of an owned value",
630 module: "drop_forget_ref",
633 name: "get_last_with_len",
635 desc: "Using `x.get(x.len() - 1)` when `x.last()` is correct and simpler",
637 module: "get_last_with_len",
641 group: "restriction",
642 desc: "using `.get().unwrap()` or `.get_mut().unwrap()` when using `[]` would work instead",
647 name: "identity_conversion",
649 desc: "using always-identical `Into`/`From`/`IntoIter` conversions",
651 module: "identity_conversion",
656 desc: "using identity operations, e.g., `x + 0` or `y / 1`",
658 module: "identity_op",
661 name: "if_let_some_result",
663 desc: "usage of `ok()` in `if let Some(pat)` statements is unnecessary, match on `Ok(pat)` instead",
670 desc: "`if` branches that could be swapped so no negation operation is necessary on the condition",
672 module: "if_not_else",
675 name: "if_same_then_else",
676 group: "correctness",
677 desc: "if with the same *then* and *else* blocks",
682 name: "ifs_same_cond",
683 group: "correctness",
684 desc: "consecutive `ifs` with the same condition",
689 name: "implicit_hasher",
691 desc: "missing generalization over different hashers",
696 name: "implicit_return",
697 group: "restriction",
698 desc: "use a return statement like `return expr` instead of an expression",
700 module: "implicit_return",
703 name: "inconsistent_digit_grouping",
705 desc: "integer literals with digits grouped inconsistently",
707 module: "literal_representation",
710 name: "indexing_slicing",
711 group: "restriction",
712 desc: "indexing/slicing usage",
714 module: "indexing_slicing",
717 name: "ineffective_bit_mask",
718 group: "correctness",
719 desc: "expressions where a bit mask will be rendered useless by a comparison, e.g., `(x | 1) > 2`",
724 name: "infallible_destructuring_match",
726 desc: "a match statement with a single infallible arm instead of a `let`",
728 module: "infallible_destructuring_match",
731 name: "infinite_iter",
732 group: "correctness",
733 desc: "infinite iteration",
735 module: "infinite_iter",
738 name: "inline_always",
740 desc: "use of `#[inline(always)]`",
745 name: "inline_fn_without_body",
746 group: "correctness",
747 desc: "use of `#[inline]` on trait methods without bodies",
749 module: "inline_fn_without_body",
752 name: "int_plus_one",
754 desc: "instead of using x >= y + 1, use x > y",
756 module: "int_plus_one",
759 name: "integer_arithmetic",
760 group: "restriction",
761 desc: "any integer arithmetic statement",
763 module: "arithmetic",
766 name: "into_iter_on_array",
767 group: "correctness",
768 desc: "using `.into_iter()` on an array",
773 name: "into_iter_on_ref",
775 desc: "using `.into_iter()` on a reference",
781 group: "correctness",
782 desc: "creation of invalid reference",
784 module: "invalid_ref",
787 name: "invalid_regex",
788 group: "correctness",
789 desc: "invalid regular expressions",
794 name: "invalid_upcast_comparisons",
796 desc: "a comparison involving an upcast which is always true or false",
801 name: "items_after_statements",
803 desc: "blocks where an item comes after a statement",
805 module: "items_after_statements",
808 name: "iter_cloned_collect",
810 desc: "using `.cloned().collect()` on slice to create a `Vec`",
815 name: "iter_next_loop",
816 group: "correctness",
817 desc: "for-looping over `_.next()` which is probably not intended",
824 desc: "using `.iter().nth()` on a standard library type with O(1) element access",
829 name: "iter_skip_next",
831 desc: "using `.skip(x).next()` on an iterator",
836 name: "iterator_step_by_zero",
837 group: "correctness",
838 desc: "using `Iterator::step_by(0)`, which produces an infinite iterator",
843 name: "just_underscores_and_digits",
845 desc: "unclear name",
847 module: "non_expressive_names",
850 name: "large_digit_groups",
852 desc: "grouping digits into groups that are too large",
854 module: "literal_representation",
857 name: "large_enum_variant",
859 desc: "large size difference between variants on an enum",
861 module: "large_enum_variant",
864 name: "len_without_is_empty",
866 desc: "traits or impls with a public `len` method but no corresponding `is_empty` method",
873 desc: "checking `.len() == 0` or `.len() > 0` (or similar) when `.is_empty()` could be used instead",
878 name: "let_and_return",
880 desc: "creating a let-binding and then immediately returning it like `let x = expr; x` at the end of a block",
885 name: "let_unit_value",
887 desc: "creating a let binding to a value of unit type, which usually can\'t be used afterwards",
894 desc: "usage of LinkedList, usually a vector is faster, or a more specialized data structure like a VecDeque",
900 group: "correctness",
901 desc: "boolean expressions that contain terminals which can be eliminated",
906 name: "manual_memcpy",
908 desc: "manually copying items between slices",
915 desc: "manual swap of two variables",
920 name: "many_single_char_names",
922 desc: "too many single character bindings",
924 module: "non_expressive_names",
929 desc: "using `iterator.map(|x| x.clone())`, or dereferencing closures for `Copy` types",
936 desc: "use of `contains_key` followed by `insert` on a `HashMap` or `BTreeMap`",
943 desc: "using combinations of `flatten` and `map` which can usually be written as a single method call",
948 name: "match_as_ref",
950 desc: "a match on an Option value instead of using `as_ref()` or `as_mut`",
957 desc: "a match on a boolean expression instead of an `if..else` block",
962 name: "match_overlapping_arm",
964 desc: "a match with overlapping arms",
969 name: "match_ref_pats",
971 desc: "a match or `if let` with all arms prefixed with `&` instead of deref-ing the match expression",
976 name: "match_same_arms",
978 desc: "`match` with identical arm bodies",
983 name: "match_wild_err_arm",
985 desc: "a match with `Err(_)` arm and take drastic actions",
990 name: "maybe_infinite_iter",
992 desc: "possible infinite iteration",
994 module: "infinite_iter",
997 name: "mem_discriminant_non_enum",
998 group: "correctness",
999 desc: "calling mem::descriminant on non-enum type",
1001 module: "mem_discriminant",
1005 group: "restriction",
1006 desc: "`mem::forget` usage on `Drop` types, likely to cause memory leaks",
1008 module: "mem_forget",
1011 name: "mem_replace_option_with_none",
1013 desc: "replacing an `Option` with `None` instead of `take()`",
1015 module: "mem_replace",
1019 group: "correctness",
1020 desc: "`min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant",
1025 name: "misrefactored_assign_op",
1026 group: "complexity",
1027 desc: "having a variable on both sides of an assign op",
1029 module: "assign_ops",
1032 name: "missing_const_for_fn",
1034 desc: "Lint functions definitions that could be made `const fn`",
1036 module: "missing_const_for_fn",
1039 name: "missing_docs_in_private_items",
1040 group: "restriction",
1041 desc: "detects missing documentation for public and private members",
1043 module: "missing_doc",
1046 name: "missing_inline_in_public_items",
1047 group: "restriction",
1048 desc: "detects missing #[inline] attribute for public callables (functions, trait methods, methods...)",
1050 module: "missing_inline",
1053 name: "mistyped_literal_suffixes",
1054 group: "correctness",
1055 desc: "mistyped literal suffix",
1057 module: "literal_representation",
1060 name: "mixed_case_hex_literals",
1062 desc: "hex literals whose letter digits are not consistently upper- or lowercased",
1064 module: "misc_early",
1067 name: "module_inception",
1069 desc: "modules that have the same name as their parent module",
1071 module: "enum_variants",
1074 name: "module_name_repetitions",
1076 desc: "type names prefixed/postfixed with their containing module\'s name",
1078 module: "enum_variants",
1082 group: "correctness",
1083 desc: "taking a number modulo 1, which always returns 0",
1088 name: "multiple_crate_versions",
1090 desc: "multiple versions of the same crate being used",
1092 module: "multiple_crate_versions",
1095 name: "multiple_inherent_impl",
1096 group: "restriction",
1097 desc: "Multiple inherent impl that could be grouped",
1099 module: "inherent_impl",
1102 name: "mut_from_ref",
1103 group: "correctness",
1104 desc: "fns that create mutable refs from immutable ref args",
1111 desc: "usage of double-mut refs, e.g., `&mut &mut ...`",
1116 name: "mut_range_bound",
1117 group: "complexity",
1118 desc: "for loop over a range where one of the bounds is a mutable variable",
1123 name: "mutex_atomic",
1125 desc: "using a mutex where an atomic value could be used instead",
1127 module: "mutex_atomic",
1130 name: "mutex_integer",
1132 desc: "using a mutex for an integer type",
1134 module: "mutex_atomic",
1137 name: "naive_bytecount",
1139 desc: "use of naive `<slice>.filter(|&x| x == y).count()` to count byte values",
1141 module: "bytecount",
1144 name: "needless_bool",
1145 group: "complexity",
1146 desc: "if-statements with plain booleans in the then- and else-clause, e.g., `if p { true } else { false }`",
1148 module: "needless_bool",
1151 name: "needless_borrow",
1153 desc: "taking a reference that is going to be automatically dereferenced",
1155 module: "needless_borrow",
1158 name: "needless_borrowed_reference",
1159 group: "complexity",
1160 desc: "taking a needless borrowed reference",
1162 module: "needless_borrowed_ref",
1165 name: "needless_collect",
1167 desc: "collecting an iterator when collect is not needed",
1172 name: "needless_continue",
1174 desc: "`continue` statements that can be replaced by a rearrangement of code",
1176 module: "needless_continue",
1179 name: "needless_lifetimes",
1180 group: "complexity",
1181 desc: "using explicit lifetimes for references in function arguments when elision rules would allow omitting them",
1183 module: "lifetimes",
1186 name: "needless_pass_by_value",
1188 desc: "functions taking arguments by value, but not consuming them in its body",
1190 module: "needless_pass_by_value",
1193 name: "needless_range_loop",
1195 desc: "for-looping over a range of indices where an iterator over items would do",
1200 name: "needless_return",
1202 desc: "using a return statement like `return expr;` where an expression would suffice",
1207 name: "needless_update",
1208 group: "complexity",
1209 desc: "using `Foo { ..base }` when there are no missing fields",
1211 module: "needless_update",
1214 name: "neg_cmp_op_on_partial_ord",
1215 group: "complexity",
1216 desc: "The use of negated comparison operators on partially ordered types may produce confusing code.",
1218 module: "neg_cmp_op_on_partial_ord",
1221 name: "neg_multiply",
1223 desc: "multiplying integers with -1",
1225 module: "neg_multiply",
1229 group: "correctness",
1230 desc: "any loop that will always `break` or `return`",
1235 name: "new_ret_no_self",
1237 desc: "not returning `Self` in a `new` method",
1242 name: "new_without_default",
1244 desc: "`fn new() -> Self` method without `Default` implementation",
1246 module: "new_without_default",
1250 group: "complexity",
1251 desc: "statements with no effect",
1253 module: "no_effect",
1256 name: "non_ascii_literal",
1258 desc: "using any literal non-ASCII chars in a string literal instead of using the `\\\\u` escape",
1263 name: "nonminimal_bool",
1264 group: "complexity",
1265 desc: "boolean expressions that can be written more concisely",
1270 name: "nonsensical_open_options",
1271 group: "correctness",
1272 desc: "nonsensical combination of options for opening a file",
1274 module: "open_options",
1277 name: "not_unsafe_ptr_arg_deref",
1278 group: "correctness",
1279 desc: "public functions dereferencing raw pointer arguments but not marked `unsafe`",
1281 module: "functions",
1286 desc: "using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result",
1293 desc: "taking a reference to satisfy the type constraints on `==`",
1298 name: "option_map_or_none",
1300 desc: "using `Option.map_or(None, f)`, which is more succinctly expressed as `and_then(f)`",
1305 name: "option_map_unit_fn",
1306 group: "complexity",
1307 desc: "using `option.map(f)`, where f is a function or closure that returns ()",
1309 module: "map_unit_fn",
1312 name: "option_map_unwrap_or",
1314 desc: "using `Option.map(f).unwrap_or(a)`, which is more succinctly expressed as `map_or(a, f)`",
1319 name: "option_map_unwrap_or_else",
1321 desc: "using `Option.map(f).unwrap_or_else(g)`, which is more succinctly expressed as `map_or_else(g, f)`",
1326 name: "option_option",
1327 group: "complexity",
1328 desc: "usage of `Option<Option<T>>`",
1333 name: "option_unwrap_used",
1334 group: "restriction",
1335 desc: "using `Option.unwrap()`, which should at least get a better message using `expect()`",
1340 name: "or_fun_call",
1342 desc: "using any `*or` method with a function call, which suggests `*or_else`",
1347 name: "out_of_bounds_indexing",
1348 group: "correctness",
1349 desc: "out of bounds constant indexing",
1351 module: "indexing_slicing",
1354 name: "overflow_check_conditional",
1355 group: "complexity",
1356 desc: "overflow checks inspired by C which are likely to panic",
1358 module: "overflow_check_conditional",
1361 name: "panic_params",
1363 desc: "missing parameters in `panic!` calls",
1365 module: "panic_unimplemented",
1368 name: "panicking_unwrap",
1370 desc: "checks for calls of unwrap[_err]() that will always fail",
1375 name: "partialeq_ne_impl",
1376 group: "complexity",
1377 desc: "re-implementing `PartialEq::ne`",
1379 module: "partialeq_ne_impl",
1382 name: "path_buf_push_overwrite",
1384 desc: "calling `push` with file system root on `PathBuf` can overwrite it",
1386 module: "path_buf_push_overwrite",
1389 name: "possible_missing_comma",
1390 group: "correctness",
1391 desc: "possible missing comma in array",
1393 module: "formatting",
1397 group: "complexity",
1398 desc: "operations where precedence may be unclear",
1400 module: "precedence",
1403 name: "print_literal",
1405 desc: "printing a literal with a format string",
1410 name: "print_stdout",
1411 group: "restriction",
1412 desc: "printing on stdout",
1417 name: "print_with_newline",
1419 desc: "using `print!()` with a format string that ends in a single newline",
1424 name: "println_empty_string",
1426 desc: "using `println!(\"\")` with an empty string",
1433 desc: "fn arguments of the type `&Vec<...>` or `&String`, suggesting to use `&[...]` or `&str` instead, respectively",
1438 name: "ptr_offset_with_cast",
1439 group: "complexity",
1440 desc: "unneeded pointer offset cast",
1442 module: "ptr_offset_with_cast",
1445 name: "pub_enum_variant_names",
1447 desc: "enums where all variants share a prefix/postfix",
1449 module: "enum_variants",
1452 name: "question_mark",
1454 desc: "checks for expressions that could be replaced by the question mark operator",
1456 module: "question_mark",
1459 name: "range_minus_one",
1460 group: "complexity",
1461 desc: "`x..=(y-1)` reads better as `x..y`",
1466 name: "range_plus_one",
1467 group: "complexity",
1468 desc: "`x..(y+1)` reads better as `x..=y`",
1473 name: "range_zip_with_len",
1474 group: "complexity",
1475 desc: "zipping iterator with a range when `enumerate()` would do",
1480 name: "redundant_clone",
1482 desc: "`clone()` of an owned value that is going to be dropped immediately",
1484 module: "redundant_clone",
1487 name: "redundant_closure",
1489 desc: "redundant closures, i.e., `|a| foo(a)` (which can be written as just `foo`)",
1491 module: "eta_reduction",
1494 name: "redundant_closure_call",
1495 group: "complexity",
1496 desc: "throwaway closures called in the expression they are defined",
1498 module: "misc_early",
1501 name: "redundant_closure_for_method_calls",
1503 desc: "redundant closures for method calls",
1505 module: "eta_reduction",
1508 name: "redundant_field_names",
1510 desc: "checks for fields in struct literals where shorthands could be used",
1512 module: "redundant_field_names",
1515 name: "redundant_pattern",
1517 desc: "using `name @ _` in a pattern",
1522 name: "redundant_pattern_matching",
1524 desc: "use the proper utility function avoiding an `if let`",
1526 module: "redundant_pattern_matching",
1529 name: "ref_in_deref",
1530 group: "complexity",
1531 desc: "Use of reference in auto dereference expression.",
1533 module: "reference",
1536 name: "regex_macro",
1538 desc: "use of `regex!(_)` instead of `Regex::new(_)`",
1543 name: "replace_consts",
1545 desc: "Lint usages of standard library `const`s that could be replaced by `const fn`s",
1547 module: "replace_consts",
1550 name: "result_map_unit_fn",
1551 group: "complexity",
1552 desc: "using `result.map(f)`, where f is a function or closure that returns ()",
1554 module: "map_unit_fn",
1557 name: "result_map_unwrap_or_else",
1559 desc: "using `Result.map(f).unwrap_or_else(g)`, which is more succinctly expressed as `.ok().map_or_else(g, f)`",
1564 name: "result_unwrap_used",
1565 group: "restriction",
1566 desc: "using `Result.unwrap()`, which might be better handled",
1571 name: "reverse_range_loop",
1572 group: "correctness",
1573 desc: "iteration over an empty range, such as `10..0` or `5..5`",
1578 name: "search_is_some",
1579 group: "complexity",
1580 desc: "using an iterator search followed by `is_some()`, which is more succinctly expressed as a call to `any()`",
1585 name: "serde_api_misuse",
1586 group: "correctness",
1587 desc: "various things that will negatively affect your serde experience",
1589 module: "serde_api",
1592 name: "shadow_reuse",
1593 group: "restriction",
1594 desc: "rebinding a name to an expression that re-uses the original value, e.g., `let x = x + 1`",
1599 name: "shadow_same",
1600 group: "restriction",
1601 desc: "rebinding a name to itself, e.g., `let mut x = &mut x`",
1606 name: "shadow_unrelated",
1608 desc: "rebinding a name without even using the original value",
1613 name: "short_circuit_statement",
1614 group: "complexity",
1615 desc: "using a short circuit boolean condition as a statement",
1620 name: "should_implement_trait",
1622 desc: "defining a method that should be implementing a std trait",
1627 name: "similar_names",
1629 desc: "similarly named items and bindings",
1631 module: "non_expressive_names",
1634 name: "single_char_pattern",
1636 desc: "using a single-character str where a char could be used, e.g., `_.split(\"x\")`",
1641 name: "single_match",
1643 desc: "a match statement with a single nontrivial arm (i.e., where the other arm is `_ => {}`) instead of `if let`",
1648 name: "single_match_else",
1650 desc: "a match statement with a two arms where the second arm\'s pattern is a placeholder instead of a specific match pattern",
1655 name: "slow_vector_initialization",
1657 desc: "slow vector initialization",
1659 module: "slow_vector_initialization",
1663 group: "restriction",
1664 desc: "using `x + ..` where x is a `String` instead of `push_str()`",
1669 name: "string_add_assign",
1671 desc: "using `x = x + ..` where x is a `String` instead of `push_str()`",
1676 name: "string_extend_chars",
1678 desc: "using `x.extend(s.chars())` where s is a `&str` or `String`",
1683 name: "string_lit_as_bytes",
1685 desc: "calling `as_bytes` on a string literal instead of using a byte string literal",
1690 name: "suspicious_arithmetic_impl",
1691 group: "correctness",
1692 desc: "suspicious use of operators in impl of arithmetic trait",
1694 module: "suspicious_trait_impl",
1697 name: "suspicious_assignment_formatting",
1699 desc: "suspicious formatting of `*=`, `-=` or `!=`",
1701 module: "formatting",
1704 name: "suspicious_else_formatting",
1706 desc: "suspicious formatting of `else`",
1708 module: "formatting",
1711 name: "suspicious_op_assign_impl",
1712 group: "correctness",
1713 desc: "suspicious use of operators in impl of OpAssign trait",
1715 module: "suspicious_trait_impl",
1718 name: "temporary_assignment",
1719 group: "complexity",
1720 desc: "assignments to temporaries",
1722 module: "temporary_assignment",
1725 name: "temporary_cstring_as_ptr",
1726 group: "correctness",
1727 desc: "getting the inner pointer of a temporary `CString`",
1732 name: "too_many_arguments",
1733 group: "complexity",
1734 desc: "functions with too many arguments",
1736 module: "functions",
1739 name: "too_many_lines",
1741 desc: "functions with too many lines",
1743 module: "functions",
1746 name: "toplevel_ref_arg",
1748 desc: "an entire binding declared as `ref`, in a function argument or a `let` statement",
1753 name: "transmute_bytes_to_str",
1754 group: "complexity",
1755 desc: "transmutes from a `&[u8]` to a `&str`",
1757 module: "transmute",
1760 name: "transmute_int_to_bool",
1761 group: "complexity",
1762 desc: "transmutes from an integer to a `bool`",
1764 module: "transmute",
1767 name: "transmute_int_to_char",
1768 group: "complexity",
1769 desc: "transmutes from an integer to a `char`",
1771 module: "transmute",
1774 name: "transmute_int_to_float",
1775 group: "complexity",
1776 desc: "transmutes from an integer to a float",
1778 module: "transmute",
1781 name: "transmute_ptr_to_ptr",
1782 group: "complexity",
1783 desc: "transmutes from a pointer to a pointer / a reference to a reference",
1785 module: "transmute",
1788 name: "transmute_ptr_to_ref",
1789 group: "complexity",
1790 desc: "transmutes from a pointer to a reference type",
1792 module: "transmute",
1795 name: "transmuting_null",
1796 group: "correctness",
1797 desc: "transmutes from a null pointer to a reference, which is undefined behavior",
1799 module: "transmuting_null",
1802 name: "trivial_regex",
1804 desc: "trivial regular expressions",
1809 name: "trivially_copy_pass_by_ref",
1811 desc: "functions taking small copyable arguments by reference",
1813 module: "trivially_copy_pass_by_ref",
1816 name: "type_complexity",
1817 group: "complexity",
1818 desc: "usage of very complex types that might be better factored into `type` definitions",
1823 name: "unicode_not_nfc",
1825 desc: "using a unicode literal not in NFC normal form (see [unicode tr15](http://www.unicode.org/reports/tr15/) for further information)",
1830 name: "unimplemented",
1831 group: "restriction",
1832 desc: "`unimplemented!` should not be present in production code",
1834 module: "panic_unimplemented",
1838 group: "complexity",
1839 desc: "passing unit to a function",
1845 group: "correctness",
1846 desc: "comparing unit values",
1851 name: "unknown_clippy_lints",
1853 desc: "unknown_lints for scoped Clippy lints",
1858 name: "unnecessary_cast",
1859 group: "complexity",
1860 desc: "cast to the same type, e.g., `x as i32` where `x: i32`",
1865 name: "unnecessary_filter_map",
1866 group: "complexity",
1867 desc: "using `filter_map` when a more succinct alternative exists",
1872 name: "unnecessary_fold",
1874 desc: "using `fold` when a more succinct alternative exists",
1879 name: "unnecessary_mut_passed",
1881 desc: "an argument passed as a mutable reference although the callee only demands an immutable reference",
1883 module: "mut_reference",
1886 name: "unnecessary_operation",
1887 group: "complexity",
1888 desc: "outer expressions with no effect",
1890 module: "no_effect",
1893 name: "unnecessary_unwrap",
1895 desc: "checks for calls of unwrap[_err]() that cannot fail",
1900 name: "unneeded_field_pattern",
1902 desc: "struct fields bound to a wildcard instead of using `..`",
1904 module: "misc_early",
1907 name: "unreadable_literal",
1909 desc: "long integer literal without underscores",
1911 module: "literal_representation",
1914 name: "unsafe_removed_from_name",
1916 desc: "`unsafe` removed from API names on import",
1918 module: "unsafe_removed_from_name",
1921 name: "unseparated_literal_suffix",
1923 desc: "literals whose suffix is not separated by an underscore",
1925 module: "misc_early",
1928 name: "unused_collect",
1930 desc: "`collect()`ing an iterator without using the result; this is usually better written as a for loop",
1935 name: "unused_io_amount",
1936 group: "correctness",
1937 desc: "unused written/read amount",
1939 module: "unused_io_amount",
1942 name: "unused_label",
1943 group: "complexity",
1944 desc: "unused labels",
1946 module: "unused_label",
1949 name: "unused_unit",
1951 desc: "needless unit expression",
1957 group: "restriction",
1958 desc: "use of `Debug`-based formatting",
1965 desc: "Unnecessary structure name repetition whereas `Self` is applicable",
1970 name: "used_underscore_binding",
1972 desc: "using a binding which is prefixed with an underscore",
1977 name: "useless_asref",
1978 group: "complexity",
1979 desc: "using `as_ref` where the types before and after the call are the same",
1984 name: "useless_attribute",
1985 group: "correctness",
1986 desc: "use of lint attributes on `extern crate` items",
1991 name: "useless_format",
1992 group: "complexity",
1993 desc: "useless use of `format!`",
1998 name: "useless_let_if_seq",
2000 desc: "unidiomatic `let mut` declaration followed by initialization in `if`",
2002 module: "let_if_seq",
2005 name: "useless_transmute",
2006 group: "complexity",
2007 desc: "transmutes that have the same to and from types or could be a cast/coercion",
2009 module: "transmute",
2012 name: "useless_vec",
2014 desc: "useless `vec!`",
2020 group: "complexity",
2021 desc: "usage of `Vec<Box<T>>` where T: Sized, vector elements are already on the heap",
2026 name: "verbose_bit_mask",
2028 desc: "expressions where a bit mask is less readable than the corresponding method call",
2033 name: "while_immutable_condition",
2034 group: "correctness",
2035 desc: "variables used within while expression are not mutated in the body",
2040 name: "while_let_loop",
2041 group: "complexity",
2042 desc: "`loop { if let { ... } else break }`, which can be written as a `while let` loop",
2047 name: "while_let_on_iterator",
2049 desc: "using a while-let loop instead of a for loop on an iterator",
2054 name: "wildcard_dependencies",
2056 desc: "wildcard dependencies being used",
2058 module: "wildcard_dependencies",
2061 name: "wildcard_enum_match_arm",
2062 group: "restriction",
2063 desc: "a wildcard enum match arm using `_`",
2068 name: "write_literal",
2070 desc: "writing a literal with a format string",
2075 name: "write_with_newline",
2077 desc: "using `write!()` with a format string that ends in a single newline",
2082 name: "writeln_empty_string",
2084 desc: "using `writeln!(buf, \"\")` with an empty string",
2089 name: "wrong_pub_self_convention",
2090 group: "restriction",
2091 desc: "defining a public method named with an established prefix (like \"into_\") that takes `self` with the wrong convention",
2096 name: "wrong_self_convention",
2098 desc: "defining a method named with an established prefix (like \"into_\") that takes `self` with the wrong convention",
2103 name: "wrong_transmute",
2104 group: "correctness",
2105 desc: "transmutes that are confusing at best, undefined behaviour at worst and always useless",
2107 module: "transmute",
2110 name: "zero_divided_by_zero",
2111 group: "complexity",
2112 desc: "usage of `0.0 / 0.0` to obtain NaN instead of std::f32::NaN or std::f64::NaN",
2114 module: "zero_div_zero",
2117 name: "zero_prefixed_literal",
2118 group: "complexity",
2119 desc: "integer literals starting with `0`",
2121 module: "misc_early",
2126 desc: "using 0 as *{const, mut} T",
2131 name: "zero_width_space",
2132 group: "correctness",
2133 desc: "using a zero-width space in a string literal, which is confusing",