diff options
-rw-r--r-- | crates/ide_db/src/helpers/generated_lints.rs | 1040 | ||||
-rw-r--r-- | xtask/src/codegen/gen_lint_completions.rs | 5 |
2 files changed, 731 insertions, 314 deletions
diff --git a/crates/ide_db/src/helpers/generated_lints.rs b/crates/ide_db/src/helpers/generated_lints.rs index 6ccb0478e..55438749b 100644 --- a/crates/ide_db/src/helpers/generated_lints.rs +++ b/crates/ide_db/src/helpers/generated_lints.rs | |||
@@ -2419,50 +2419,6 @@ See also its documentation in [the rustdoc book][rustdoc-book-notable_trait]. | |||
2419 | "##, | 2419 | "##, |
2420 | }, | 2420 | }, |
2421 | Lint { | 2421 | Lint { |
2422 | label: "external_doc", | ||
2423 | description: r##"# `external_doc` | ||
2424 | |||
2425 | The tracking issue for this feature is: [#44732] | ||
2426 | |||
2427 | The `external_doc` feature allows the use of the `include` parameter to the `#[doc]` attribute, to | ||
2428 | include external files in documentation. Use the attribute in place of, or in addition to, regular | ||
2429 | doc comments and `#[doc]` attributes, and `rustdoc` will load the given file when it renders | ||
2430 | documentation for your crate. | ||
2431 | |||
2432 | With the following files in the same directory: | ||
2433 | |||
2434 | `external-doc.md`: | ||
2435 | |||
2436 | ```markdown | ||
2437 | # My Awesome Type | ||
2438 | |||
2439 | This is the documentation for this spectacular type. | ||
2440 | ``` | ||
2441 | |||
2442 | `lib.rs`: | ||
2443 | |||
2444 | ```no_run (needs-external-files) | ||
2445 | #![feature(external_doc)] | ||
2446 | |||
2447 | #[doc(include = "external-doc.md")] | ||
2448 | pub struct MyAwesomeType; | ||
2449 | ``` | ||
2450 | |||
2451 | `rustdoc` will load the file `external-doc.md` and use it as the documentation for the `MyAwesomeType` | ||
2452 | struct. | ||
2453 | |||
2454 | When locating files, `rustdoc` will base paths in the `src/` directory, as if they were alongside the | ||
2455 | `lib.rs` for your crate. So if you want a `docs/` folder to live alongside the `src/` directory, | ||
2456 | start your paths with `../docs/` for `rustdoc` to properly find the file. | ||
2457 | |||
2458 | This feature was proposed in [RFC #1990] and initially implemented in PR [#44781]. | ||
2459 | |||
2460 | [#44732]: https://github.com/rust-lang/rust/issues/44732 | ||
2461 | [RFC #1990]: https://github.com/rust-lang/rfcs/pull/1990 | ||
2462 | [#44781]: https://github.com/rust-lang/rust/pull/44781 | ||
2463 | "##, | ||
2464 | }, | ||
2465 | Lint { | ||
2466 | label: "fd", | 2422 | label: "fd", |
2467 | description: r##"# `fd` | 2423 | description: r##"# `fd` |
2468 | 2424 | ||
@@ -5070,7 +5026,10 @@ This feature is internal to the Rust compiler and is not intended for general us | |||
5070 | pub const CLIPPY_LINTS: &[Lint] = &[ | 5026 | pub const CLIPPY_LINTS: &[Lint] = &[ |
5071 | Lint { | 5027 | Lint { |
5072 | label: "clippy::absurd_extreme_comparisons", | 5028 | label: "clippy::absurd_extreme_comparisons", |
5073 | description: r##"Checks for comparisons where one side of the relation is\neither the minimum or maximum value for its type and warns if it involves a\ncase that is always true or always false. Only integer and boolean types are\nchecked."##, | 5029 | description: r##"Checks for comparisons where one side of the relation is |
5030 | either the minimum or maximum value for its type and warns if it involves a | ||
5031 | case that is always true or always false. Only integer and boolean types are | ||
5032 | checked."##, | ||
5074 | }, | 5033 | }, |
5075 | Lint { | 5034 | Lint { |
5076 | label: "clippy::almost_swapped", | 5035 | label: "clippy::almost_swapped", |
@@ -5078,11 +5037,24 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5078 | }, | 5037 | }, |
5079 | Lint { | 5038 | Lint { |
5080 | label: "clippy::approx_constant", | 5039 | label: "clippy::approx_constant", |
5081 | description: r##"Checks for floating point literals that approximate\nconstants which are defined in\n[`std::f32::consts`](https://doc.rust-lang.org/stable/std/f32/consts/#constants)\nor\n[`std::f64::consts`](https://doc.rust-lang.org/stable/std/f64/consts/#constants),\nrespectively, suggesting to use the predefined constant."##, | 5040 | description: r##"Checks for floating point literals that approximate |
5041 | constants which are defined in | ||
5042 | [`std::f32::consts`](https://doc.rust-lang.org/stable/std/f32/consts/#constants) | ||
5043 | or | ||
5044 | [`std::f64::consts`](https://doc.rust-lang.org/stable/std/f64/consts/#constants), | ||
5045 | respectively, suggesting to use the predefined constant."##, | ||
5082 | }, | 5046 | }, |
5083 | Lint { | 5047 | Lint { |
5084 | label: "clippy::as_conversions", | 5048 | label: "clippy::as_conversions", |
5085 | description: r##"Checks for usage of `as` conversions.\n\nNote that this lint is specialized in linting *every single* use of `as`\nregardless of whether good alternatives exist or not.\nIf you want more precise lints for `as`, please consider using these separate lints:\n`unnecessary_cast`, `cast_lossless/possible_truncation/possible_wrap/precision_loss/sign_loss`,\n`fn_to_numeric_cast(_with_truncation)`, `char_lit_as_u8`, `ref_to_mut` and `ptr_as_ptr`.\nThere is a good explanation the reason why this lint should work in this way and how it is useful\n[in this issue](https://github.com/rust-lang/rust-clippy/issues/5122)."##, | 5049 | description: r##"Checks for usage of `as` conversions. |
5050 | |||
5051 | Note that this lint is specialized in linting *every single* use of `as` | ||
5052 | regardless of whether good alternatives exist or not. | ||
5053 | If you want more precise lints for `as`, please consider using these separate lints: | ||
5054 | `unnecessary_cast`, `cast_lossless/possible_truncation/possible_wrap/precision_loss/sign_loss`, | ||
5055 | `fn_to_numeric_cast(_with_truncation)`, `char_lit_as_u8`, `ref_to_mut` and `ptr_as_ptr`. | ||
5056 | There is a good explanation the reason why this lint should work in this way and how it is useful | ||
5057 | [in this issue](https://github.com/rust-lang/rust-clippy/issues/5122)."##, | ||
5086 | }, | 5058 | }, |
5087 | Lint { | 5059 | Lint { |
5088 | label: "clippy::assertions_on_constants", | 5060 | label: "clippy::assertions_on_constants", |
@@ -5090,7 +5062,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5090 | }, | 5062 | }, |
5091 | Lint { | 5063 | Lint { |
5092 | label: "clippy::assign_op_pattern", | 5064 | label: "clippy::assign_op_pattern", |
5093 | description: r##"Checks for `a = a op b` or `a = b commutative_op a`\npatterns."##, | 5065 | description: r##"Checks for `a = a op b` or `a = b commutative_op a` |
5066 | patterns."##, | ||
5094 | }, | 5067 | }, |
5095 | Lint { | 5068 | Lint { |
5096 | label: "clippy::assign_ops", | 5069 | label: "clippy::assign_ops", |
@@ -5098,27 +5071,46 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5098 | }, | 5071 | }, |
5099 | Lint { | 5072 | Lint { |
5100 | label: "clippy::async_yields_async", | 5073 | label: "clippy::async_yields_async", |
5101 | description: r##"Checks for async blocks that yield values of types\nthat can themselves be awaited."##, | 5074 | description: r##"Checks for async blocks that yield values of types |
5075 | that can themselves be awaited."##, | ||
5102 | }, | 5076 | }, |
5103 | Lint { | 5077 | Lint { |
5104 | label: "clippy::await_holding_lock", | 5078 | label: "clippy::await_holding_lock", |
5105 | description: r##"Checks for calls to await while holding a\nnon-async-aware MutexGuard."##, | 5079 | description: r##"Checks for calls to await while holding a |
5080 | non-async-aware MutexGuard."##, | ||
5106 | }, | 5081 | }, |
5107 | Lint { | 5082 | Lint { |
5108 | label: "clippy::await_holding_refcell_ref", | 5083 | label: "clippy::await_holding_refcell_ref", |
5109 | description: r##"Checks for calls to await while holding a\n`RefCell` `Ref` or `RefMut`."##, | 5084 | description: r##"Checks for calls to await while holding a |
5085 | `RefCell` `Ref` or `RefMut`."##, | ||
5110 | }, | 5086 | }, |
5111 | Lint { | 5087 | Lint { |
5112 | label: "clippy::bad_bit_mask", | 5088 | label: "clippy::bad_bit_mask", |
5113 | description: r##"Checks for incompatible bit masks in comparisons.\n\nThe formula for detecting if an expression of the type `_ <bit_op> m\n<cmp_op> c` (where `<bit_op>` is one of {`&`, `|`} and `<cmp_op>` is one of\n{`!=`, `>=`, `>`, `!=`, `>=`, `>`}) can be determined from the following\ntable:\n\n|Comparison |Bit Op|Example |is always|Formula |\n|------------|------|------------|---------|----------------------|\n|`==` or `!=`| `&` |`x & 2 == 3`|`false` |`c & m != c` |\n|`<` or `>=`| `&` |`x & 2 < 3` |`true` |`m < c` |\n|`>` or `<=`| `&` |`x & 1 > 1` |`false` |`m <= c` |\n|`==` or `!=`| `|` |`x | 1 == 0`|`false` |`c | m != c` |\n|`<` or `>=`| `|` |`x | 1 < 1` |`false` |`m >= c` |\n|`<=` or `>` | `|` |`x | 1 > 0` |`true` |`m > c` |"##, | 5089 | description: r##"Checks for incompatible bit masks in comparisons. |
5090 | |||
5091 | The formula for detecting if an expression of the type `_ <bit_op> m | ||
5092 | <cmp_op> c` (where `<bit_op>` is one of {`&`, `|`} and `<cmp_op>` is one of | ||
5093 | {`!=`, `>=`, `>`, `!=`, `>=`, `>`}) can be determined from the following | ||
5094 | table: | ||
5095 | |||
5096 | |Comparison |Bit Op|Example |is always|Formula | | ||
5097 | |------------|------|------------|---------|----------------------| | ||
5098 | |`==` or `!=`| `&` |`x & 2 == 3`|`false` |`c & m != c` | | ||
5099 | |`<` or `>=`| `&` |`x & 2 < 3` |`true` |`m < c` | | ||
5100 | |`>` or `<=`| `&` |`x & 1 > 1` |`false` |`m <= c` | | ||
5101 | |`==` or `!=`| `|` |`x | 1 == 0`|`false` |`c | m != c` | | ||
5102 | |`<` or `>=`| `|` |`x | 1 < 1` |`false` |`m >= c` | | ||
5103 | |`<=` or `>` | `|` |`x | 1 > 0` |`true` |`m > c` |"##, | ||
5114 | }, | 5104 | }, |
5115 | Lint { | 5105 | Lint { |
5116 | label: "clippy::bind_instead_of_map", | 5106 | label: "clippy::bind_instead_of_map", |
5117 | description: r##"Checks for usage of `_.and_then(|x| Some(y))`, `_.and_then(|x| Ok(y))` or\n`_.or_else(|x| Err(y))`."##, | 5107 | description: r##"Checks for usage of `_.and_then(|x| Some(y))`, `_.and_then(|x| Ok(y))` or |
5108 | `_.or_else(|x| Err(y))`."##, | ||
5118 | }, | 5109 | }, |
5119 | Lint { | 5110 | Lint { |
5120 | label: "clippy::blacklisted_name", | 5111 | label: "clippy::blacklisted_name", |
5121 | description: r##"Checks for usage of blacklisted names for variables, such\nas `foo`."##, | 5112 | description: r##"Checks for usage of blacklisted names for variables, such |
5113 | as `foo`."##, | ||
5122 | }, | 5114 | }, |
5123 | Lint { | 5115 | Lint { |
5124 | label: "clippy::blanket_clippy_restriction_lints", | 5116 | label: "clippy::blanket_clippy_restriction_lints", |
@@ -5126,7 +5118,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5126 | }, | 5118 | }, |
5127 | Lint { | 5119 | Lint { |
5128 | label: "clippy::blocks_in_if_conditions", | 5120 | label: "clippy::blocks_in_if_conditions", |
5129 | description: r##"Checks for `if` conditions that use blocks containing an\nexpression, statements or conditions that use closures with blocks."##, | 5121 | description: r##"Checks for `if` conditions that use blocks containing an |
5122 | expression, statements or conditions that use closures with blocks."##, | ||
5130 | }, | 5123 | }, |
5131 | Lint { | 5124 | Lint { |
5132 | label: "clippy::bool_assert_comparison", | 5125 | label: "clippy::bool_assert_comparison", |
@@ -5134,27 +5127,34 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5134 | }, | 5127 | }, |
5135 | Lint { | 5128 | Lint { |
5136 | label: "clippy::bool_comparison", | 5129 | label: "clippy::bool_comparison", |
5137 | description: r##"Checks for expressions of the form `x == true`,\n`x != true` and order comparisons such as `x < true` (or vice versa) and\nsuggest using the variable directly."##, | 5130 | description: r##"Checks for expressions of the form `x == true`, |
5131 | `x != true` and order comparisons such as `x < true` (or vice versa) and | ||
5132 | suggest using the variable directly."##, | ||
5138 | }, | 5133 | }, |
5139 | Lint { | 5134 | Lint { |
5140 | label: "clippy::borrow_interior_mutable_const", | 5135 | label: "clippy::borrow_interior_mutable_const", |
5141 | description: r##"Checks if `const` items which is interior mutable (e.g.,\ncontains a `Cell`, `Mutex`, `AtomicXxxx`, etc.) has been borrowed directly."##, | 5136 | description: r##"Checks if `const` items which is interior mutable (e.g., |
5137 | contains a `Cell`, `Mutex`, `AtomicXxxx`, etc.) has been borrowed directly."##, | ||
5142 | }, | 5138 | }, |
5143 | Lint { | 5139 | Lint { |
5144 | label: "clippy::borrowed_box", | 5140 | label: "clippy::borrowed_box", |
5145 | description: r##"Checks for use of `&Box<T>` anywhere in the code.\nCheck the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information."##, | 5141 | description: r##"Checks for use of `&Box<T>` anywhere in the code. |
5142 | Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information."##, | ||
5146 | }, | 5143 | }, |
5147 | Lint { | 5144 | Lint { |
5148 | label: "clippy::box_vec", | 5145 | label: "clippy::box_vec", |
5149 | description: r##"Checks for use of `Box<Vec<_>>` anywhere in the code.\nCheck the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information."##, | 5146 | description: r##"Checks for use of `Box<Vec<_>>` anywhere in the code. |
5147 | Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information."##, | ||
5150 | }, | 5148 | }, |
5151 | Lint { | 5149 | Lint { |
5152 | label: "clippy::boxed_local", | 5150 | label: "clippy::boxed_local", |
5153 | description: r##"Checks for usage of `Box<T>` where an unboxed `T` would\nwork fine."##, | 5151 | description: r##"Checks for usage of `Box<T>` where an unboxed `T` would |
5152 | work fine."##, | ||
5154 | }, | 5153 | }, |
5155 | Lint { | 5154 | Lint { |
5156 | label: "clippy::branches_sharing_code", | 5155 | label: "clippy::branches_sharing_code", |
5157 | description: r##"Checks if the `if` and `else` block contain shared code that can be\nmoved out of the blocks."##, | 5156 | description: r##"Checks if the `if` and `else` block contain shared code that can be |
5157 | moved out of the blocks."##, | ||
5158 | }, | 5158 | }, |
5159 | Lint { | 5159 | Lint { |
5160 | label: "clippy::builtin_type_shadow", | 5160 | label: "clippy::builtin_type_shadow", |
@@ -5166,31 +5166,48 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5166 | }, | 5166 | }, |
5167 | Lint { | 5167 | Lint { |
5168 | label: "clippy::cargo_common_metadata", | 5168 | label: "clippy::cargo_common_metadata", |
5169 | description: r##"Checks to see if all common metadata is defined in\n`Cargo.toml`. See: https://rust-lang-nursery.github.io/api-guidelines/documentation.html#cargotoml-includes-all-common-metadata-c-metadata"##, | 5169 | description: r##"Checks to see if all common metadata is defined in |
5170 | `Cargo.toml`. See: https://rust-lang-nursery.github.io/api-guidelines/documentation.html#cargotoml-includes-all-common-metadata-c-metadata"##, | ||
5170 | }, | 5171 | }, |
5171 | Lint { | 5172 | Lint { |
5172 | label: "clippy::case_sensitive_file_extension_comparisons", | 5173 | label: "clippy::case_sensitive_file_extension_comparisons", |
5173 | description: r##"Checks for calls to `ends_with` with possible file extensions\nand suggests to use a case-insensitive approach instead."##, | 5174 | description: r##"Checks for calls to `ends_with` with possible file extensions |
5175 | and suggests to use a case-insensitive approach instead."##, | ||
5174 | }, | 5176 | }, |
5175 | Lint { | 5177 | Lint { |
5176 | label: "clippy::cast_lossless", | 5178 | label: "clippy::cast_lossless", |
5177 | description: r##"Checks for casts between numerical types that may\nbe replaced by safe conversion functions."##, | 5179 | description: r##"Checks for casts between numerical types that may |
5180 | be replaced by safe conversion functions."##, | ||
5178 | }, | 5181 | }, |
5179 | Lint { | 5182 | Lint { |
5180 | label: "clippy::cast_possible_truncation", | 5183 | label: "clippy::cast_possible_truncation", |
5181 | description: r##"Checks for casts between numerical types that may\ntruncate large values. This is expected behavior, so the cast is `Allow` by\ndefault."##, | 5184 | description: r##"Checks for casts between numerical types that may |
5185 | truncate large values. This is expected behavior, so the cast is `Allow` by | ||
5186 | default."##, | ||
5182 | }, | 5187 | }, |
5183 | Lint { | 5188 | Lint { |
5184 | label: "clippy::cast_possible_wrap", | 5189 | label: "clippy::cast_possible_wrap", |
5185 | description: r##"Checks for casts from an unsigned type to a signed type of\nthe same size. Performing such a cast is a 'no-op' for the compiler,\ni.e., nothing is changed at the bit level, and the binary representation of\nthe value is reinterpreted. This can cause wrapping if the value is too big\nfor the target signed type. However, the cast works as defined, so this lint\nis `Allow` by default."##, | 5190 | description: r##"Checks for casts from an unsigned type to a signed type of |
5191 | the same size. Performing such a cast is a 'no-op' for the compiler, | ||
5192 | i.e., nothing is changed at the bit level, and the binary representation of | ||
5193 | the value is reinterpreted. This can cause wrapping if the value is too big | ||
5194 | for the target signed type. However, the cast works as defined, so this lint | ||
5195 | is `Allow` by default."##, | ||
5186 | }, | 5196 | }, |
5187 | Lint { | 5197 | Lint { |
5188 | label: "clippy::cast_precision_loss", | 5198 | label: "clippy::cast_precision_loss", |
5189 | description: r##"Checks for casts from any numerical to a float type where\nthe receiving type cannot store all values from the original type without\nrounding errors. This possible rounding is to be expected, so this lint is\n`Allow` by default.\n\nBasically, this warns on casting any integer with 32 or more bits to `f32`\nor any 64-bit integer to `f64`."##, | 5199 | description: r##"Checks for casts from any numerical to a float type where |
5200 | the receiving type cannot store all values from the original type without | ||
5201 | rounding errors. This possible rounding is to be expected, so this lint is | ||
5202 | `Allow` by default. | ||
5203 | |||
5204 | Basically, this warns on casting any integer with 32 or more bits to `f32` | ||
5205 | or any 64-bit integer to `f64`."##, | ||
5190 | }, | 5206 | }, |
5191 | Lint { | 5207 | Lint { |
5192 | label: "clippy::cast_ptr_alignment", | 5208 | label: "clippy::cast_ptr_alignment", |
5193 | description: r##"Checks for casts, using `as` or `pointer::cast`,\nfrom a less-strictly-aligned pointer to a more-strictly-aligned pointer"##, | 5209 | description: r##"Checks for casts, using `as` or `pointer::cast`, |
5210 | from a less-strictly-aligned pointer to a more-strictly-aligned pointer"##, | ||
5194 | }, | 5211 | }, |
5195 | Lint { | 5212 | Lint { |
5196 | label: "clippy::cast_ref_to_mut", | 5213 | label: "clippy::cast_ref_to_mut", |
@@ -5198,19 +5215,25 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5198 | }, | 5215 | }, |
5199 | Lint { | 5216 | Lint { |
5200 | label: "clippy::cast_sign_loss", | 5217 | label: "clippy::cast_sign_loss", |
5201 | description: r##"Checks for casts from a signed to an unsigned numerical\ntype. In this case, negative values wrap around to large positive values,\nwhich can be quite surprising in practice. However, as the cast works as\ndefined, this lint is `Allow` by default."##, | 5218 | description: r##"Checks for casts from a signed to an unsigned numerical |
5219 | type. In this case, negative values wrap around to large positive values, | ||
5220 | which can be quite surprising in practice. However, as the cast works as | ||
5221 | defined, this lint is `Allow` by default."##, | ||
5202 | }, | 5222 | }, |
5203 | Lint { | 5223 | Lint { |
5204 | label: "clippy::char_lit_as_u8", | 5224 | label: "clippy::char_lit_as_u8", |
5205 | description: r##"Checks for expressions where a character literal is cast\nto `u8` and suggests using a byte literal instead."##, | 5225 | description: r##"Checks for expressions where a character literal is cast |
5226 | to `u8` and suggests using a byte literal instead."##, | ||
5206 | }, | 5227 | }, |
5207 | Lint { | 5228 | Lint { |
5208 | label: "clippy::chars_last_cmp", | 5229 | label: "clippy::chars_last_cmp", |
5209 | description: r##"Checks for usage of `_.chars().last()` or\n`_.chars().next_back()` on a `str` to check if it ends with a given char."##, | 5230 | description: r##"Checks for usage of `_.chars().last()` or |
5231 | `_.chars().next_back()` on a `str` to check if it ends with a given char."##, | ||
5210 | }, | 5232 | }, |
5211 | Lint { | 5233 | Lint { |
5212 | label: "clippy::chars_next_cmp", | 5234 | label: "clippy::chars_next_cmp", |
5213 | description: r##"Checks for usage of `.chars().next()` on a `str` to check\nif it starts with a given char."##, | 5235 | description: r##"Checks for usage of `.chars().next()` on a `str` to check |
5236 | if it starts with a given char."##, | ||
5214 | }, | 5237 | }, |
5215 | Lint { | 5238 | Lint { |
5216 | label: "clippy::checked_conversions", | 5239 | label: "clippy::checked_conversions", |
@@ -5226,11 +5249,14 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5226 | }, | 5249 | }, |
5227 | Lint { | 5250 | Lint { |
5228 | label: "clippy::clone_on_ref_ptr", | 5251 | label: "clippy::clone_on_ref_ptr", |
5229 | description: r##"Checks for usage of `.clone()` on a ref-counted pointer,\n(`Rc`, `Arc`, `rc::Weak`, or `sync::Weak`), and suggests calling Clone via unified\nfunction syntax instead (e.g., `Rc::clone(foo)`)."##, | 5252 | description: r##"Checks for usage of `.clone()` on a ref-counted pointer, |
5253 | (`Rc`, `Arc`, `rc::Weak`, or `sync::Weak`), and suggests calling Clone via unified | ||
5254 | function syntax instead (e.g., `Rc::clone(foo)`)."##, | ||
5230 | }, | 5255 | }, |
5231 | Lint { | 5256 | Lint { |
5232 | label: "clippy::cloned_instead_of_copied", | 5257 | label: "clippy::cloned_instead_of_copied", |
5233 | description: r##"Checks for usages of `cloned()` on an `Iterator` or `Option` where\n`copied()` could be used instead."##, | 5258 | description: r##"Checks for usages of `cloned()` on an `Iterator` or `Option` where |
5259 | `copied()` could be used instead."##, | ||
5234 | }, | 5260 | }, |
5235 | Lint { label: "clippy::cmp_nan", description: r##"Checks for comparisons to NaN."## }, | 5261 | Lint { label: "clippy::cmp_nan", description: r##"Checks for comparisons to NaN."## }, |
5236 | Lint { | 5262 | Lint { |
@@ -5239,7 +5265,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5239 | }, | 5265 | }, |
5240 | Lint { | 5266 | Lint { |
5241 | label: "clippy::cmp_owned", | 5267 | label: "clippy::cmp_owned", |
5242 | description: r##"Checks for conversions to owned values just for the sake\nof a comparison."##, | 5268 | description: r##"Checks for conversions to owned values just for the sake |
5269 | of a comparison."##, | ||
5243 | }, | 5270 | }, |
5244 | Lint { | 5271 | Lint { |
5245 | label: "clippy::cognitive_complexity", | 5272 | label: "clippy::cognitive_complexity", |
@@ -5247,27 +5274,36 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5247 | }, | 5274 | }, |
5248 | Lint { | 5275 | Lint { |
5249 | label: "clippy::collapsible_else_if", | 5276 | label: "clippy::collapsible_else_if", |
5250 | description: r##"Checks for collapsible `else { if ... }` expressions\nthat can be collapsed to `else if ...`."##, | 5277 | description: r##"Checks for collapsible `else { if ... }` expressions |
5278 | that can be collapsed to `else if ...`."##, | ||
5251 | }, | 5279 | }, |
5252 | Lint { | 5280 | Lint { |
5253 | label: "clippy::collapsible_if", | 5281 | label: "clippy::collapsible_if", |
5254 | description: r##"Checks for nested `if` statements which can be collapsed\nby `&&`-combining their conditions."##, | 5282 | description: r##"Checks for nested `if` statements which can be collapsed |
5283 | by `&&`-combining their conditions."##, | ||
5255 | }, | 5284 | }, |
5256 | Lint { | 5285 | Lint { |
5257 | label: "clippy::collapsible_match", | 5286 | label: "clippy::collapsible_match", |
5258 | description: r##"Finds nested `match` or `if let` expressions where the patterns may be \"collapsed\" together\nwithout adding any branches.\n\nNote that this lint is not intended to find _all_ cases where nested match patterns can be merged, but only\ncases where merging would most likely make the code more readable."##, | 5287 | description: r##"Finds nested `match` or `if let` expressions where the patterns may be collapsed together |
5288 | without adding any branches. | ||
5289 | |||
5290 | Note that this lint is not intended to find _all_ cases where nested match patterns can be merged, but only | ||
5291 | cases where merging would most likely make the code more readable."##, | ||
5259 | }, | 5292 | }, |
5260 | Lint { | 5293 | Lint { |
5261 | label: "clippy::comparison_chain", | 5294 | label: "clippy::comparison_chain", |
5262 | description: r##"Checks comparison chains written with `if` that can be\nrewritten with `match` and `cmp`."##, | 5295 | description: r##"Checks comparison chains written with `if` that can be |
5296 | rewritten with `match` and `cmp`."##, | ||
5263 | }, | 5297 | }, |
5264 | Lint { | 5298 | Lint { |
5265 | label: "clippy::comparison_to_empty", | 5299 | label: "clippy::comparison_to_empty", |
5266 | description: r##"Checks for comparing to an empty slice such as `\"\"` or `[]`,\nand suggests using `.is_empty()` where applicable."##, | 5300 | description: r##"Checks for comparing to an empty slice such as `` or `[]`, |
5301 | and suggests using `.is_empty()` where applicable."##, | ||
5267 | }, | 5302 | }, |
5268 | Lint { | 5303 | Lint { |
5269 | label: "clippy::copy_iterator", | 5304 | label: "clippy::copy_iterator", |
5270 | description: r##"Checks for types that implement `Copy` as well as\n`Iterator`."##, | 5305 | description: r##"Checks for types that implement `Copy` as well as |
5306 | `Iterator`."##, | ||
5271 | }, | 5307 | }, |
5272 | Lint { | 5308 | Lint { |
5273 | label: "clippy::create_dir", | 5309 | label: "clippy::create_dir", |
@@ -5280,7 +5316,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5280 | Lint { label: "clippy::dbg_macro", description: r##"Checks for usage of dbg!() macro."## }, | 5316 | Lint { label: "clippy::dbg_macro", description: r##"Checks for usage of dbg!() macro."## }, |
5281 | Lint { | 5317 | Lint { |
5282 | label: "clippy::debug_assert_with_mut_call", | 5318 | label: "clippy::debug_assert_with_mut_call", |
5283 | description: r##"Checks for function/method calls with a mutable\nparameter in `debug_assert!`, `debug_assert_eq!` and `debug_assert_ne!` macros."##, | 5319 | description: r##"Checks for function/method calls with a mutable |
5320 | parameter in `debug_assert!`, `debug_assert_eq!` and `debug_assert_ne!` macros."##, | ||
5284 | }, | 5321 | }, |
5285 | Lint { | 5322 | Lint { |
5286 | label: "clippy::decimal_literal_representation", | 5323 | label: "clippy::decimal_literal_representation", |
@@ -5288,11 +5325,19 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5288 | }, | 5325 | }, |
5289 | Lint { | 5326 | Lint { |
5290 | label: "clippy::declare_interior_mutable_const", | 5327 | label: "clippy::declare_interior_mutable_const", |
5291 | description: r##"Checks for declaration of `const` items which is interior\nmutable (e.g., contains a `Cell`, `Mutex`, `AtomicXxxx`, etc.)."##, | 5328 | description: r##"Checks for declaration of `const` items which is interior |
5329 | mutable (e.g., contains a `Cell`, `Mutex`, `AtomicXxxx`, etc.)."##, | ||
5292 | }, | 5330 | }, |
5293 | Lint { | 5331 | Lint { |
5294 | label: "clippy::default_numeric_fallback", | 5332 | label: "clippy::default_numeric_fallback", |
5295 | description: r##"Checks for usage of unconstrained numeric literals which may cause default numeric fallback in type\ninference.\n\nDefault numeric fallback means that if numeric types have not yet been bound to concrete\ntypes at the end of type inference, then integer type is bound to `i32`, and similarly\nfloating type is bound to `f64`.\n\nSee [RFC0212](https://github.com/rust-lang/rfcs/blob/master/text/0212-restore-int-fallback.md) for more information about the fallback."##, | 5333 | description: r##"Checks for usage of unconstrained numeric literals which may cause default numeric fallback in type |
5334 | inference. | ||
5335 | |||
5336 | Default numeric fallback means that if numeric types have not yet been bound to concrete | ||
5337 | types at the end of type inference, then integer type is bound to `i32`, and similarly | ||
5338 | floating type is bound to `f64`. | ||
5339 | |||
5340 | See [RFC0212](https://github.com/rust-lang/rfcs/blob/master/text/0212-restore-int-fallback.md) for more information about the fallback."##, | ||
5296 | }, | 5341 | }, |
5297 | Lint { | 5342 | Lint { |
5298 | label: "clippy::default_trait_access", | 5343 | label: "clippy::default_trait_access", |
@@ -5300,11 +5345,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5300 | }, | 5345 | }, |
5301 | Lint { | 5346 | Lint { |
5302 | label: "clippy::deprecated_cfg_attr", | 5347 | label: "clippy::deprecated_cfg_attr", |
5303 | description: r##"Checks for `#[cfg_attr(rustfmt, rustfmt_skip)]` and suggests to replace it\nwith `#[rustfmt::skip]`."##, | 5348 | description: r##"Checks for `#[cfg_attr(rustfmt, rustfmt_skip)]` and suggests to replace it |
5349 | with `#[rustfmt::skip]`."##, | ||
5304 | }, | 5350 | }, |
5305 | Lint { | 5351 | Lint { |
5306 | label: "clippy::deprecated_semver", | 5352 | label: "clippy::deprecated_semver", |
5307 | description: r##"Checks for `#[deprecated]` annotations with a `since`\nfield that is not a valid semantic version."##, | 5353 | description: r##"Checks for `#[deprecated]` annotations with a `since` |
5354 | field that is not a valid semantic version."##, | ||
5308 | }, | 5355 | }, |
5309 | Lint { | 5356 | Lint { |
5310 | label: "clippy::deref_addrof", | 5357 | label: "clippy::deref_addrof", |
@@ -5312,11 +5359,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5312 | }, | 5359 | }, |
5313 | Lint { | 5360 | Lint { |
5314 | label: "clippy::derive_hash_xor_eq", | 5361 | label: "clippy::derive_hash_xor_eq", |
5315 | description: r##"Checks for deriving `Hash` but implementing `PartialEq`\nexplicitly or vice versa."##, | 5362 | description: r##"Checks for deriving `Hash` but implementing `PartialEq` |
5363 | explicitly or vice versa."##, | ||
5316 | }, | 5364 | }, |
5317 | Lint { | 5365 | Lint { |
5318 | label: "clippy::derive_ord_xor_partial_ord", | 5366 | label: "clippy::derive_ord_xor_partial_ord", |
5319 | description: r##"Checks for deriving `Ord` but implementing `PartialOrd`\nexplicitly or vice versa."##, | 5367 | description: r##"Checks for deriving `Ord` but implementing `PartialOrd` |
5368 | explicitly or vice versa."##, | ||
5320 | }, | 5369 | }, |
5321 | Lint { | 5370 | Lint { |
5322 | label: "clippy::disallowed_method", | 5371 | label: "clippy::disallowed_method", |
@@ -5324,11 +5373,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5324 | }, | 5373 | }, |
5325 | Lint { | 5374 | Lint { |
5326 | label: "clippy::diverging_sub_expression", | 5375 | label: "clippy::diverging_sub_expression", |
5327 | description: r##"Checks for diverging calls that are not match arms or\nstatements."##, | 5376 | description: r##"Checks for diverging calls that are not match arms or |
5377 | statements."##, | ||
5328 | }, | 5378 | }, |
5329 | Lint { | 5379 | Lint { |
5330 | label: "clippy::doc_markdown", | 5380 | label: "clippy::doc_markdown", |
5331 | description: r##"Checks for the presence of `_`, `::` or camel-case words\noutside ticks in documentation."##, | 5381 | description: r##"Checks for the presence of `_`, `::` or camel-case words |
5382 | outside ticks in documentation."##, | ||
5332 | }, | 5383 | }, |
5333 | Lint { | 5384 | Lint { |
5334 | label: "clippy::double_comparisons", | 5385 | label: "clippy::double_comparisons", |
@@ -5336,7 +5387,11 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5336 | }, | 5387 | }, |
5337 | Lint { | 5388 | Lint { |
5338 | label: "clippy::double_must_use", | 5389 | label: "clippy::double_must_use", |
5339 | description: r##"Checks for a [`#[must_use]`] attribute without\nfurther information on functions and methods that return a type already\nmarked as `#[must_use]`.\n\n[`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"##, | 5390 | description: r##"Checks for a [`#[must_use]`] attribute without |
5391 | further information on functions and methods that return a type already | ||
5392 | marked as `#[must_use]`. | ||
5393 | |||
5394 | [`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"##, | ||
5340 | }, | 5395 | }, |
5341 | Lint { | 5396 | Lint { |
5342 | label: "clippy::double_neg", | 5397 | label: "clippy::double_neg", |
@@ -5348,27 +5403,36 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5348 | }, | 5403 | }, |
5349 | Lint { | 5404 | Lint { |
5350 | label: "clippy::drop_copy", | 5405 | label: "clippy::drop_copy", |
5351 | description: r##"Checks for calls to `std::mem::drop` with a value\nthat derives the Copy trait"##, | 5406 | description: r##"Checks for calls to `std::mem::drop` with a value |
5407 | that derives the Copy trait"##, | ||
5352 | }, | 5408 | }, |
5353 | Lint { | 5409 | Lint { |
5354 | label: "clippy::drop_ref", | 5410 | label: "clippy::drop_ref", |
5355 | description: r##"Checks for calls to `std::mem::drop` with a reference\ninstead of an owned value."##, | 5411 | description: r##"Checks for calls to `std::mem::drop` with a reference |
5412 | instead of an owned value."##, | ||
5356 | }, | 5413 | }, |
5357 | Lint { | 5414 | Lint { |
5358 | label: "clippy::duplicate_underscore_argument", | 5415 | label: "clippy::duplicate_underscore_argument", |
5359 | description: r##"Checks for function arguments having the similar names\ndiffering by an underscore."##, | 5416 | description: r##"Checks for function arguments having the similar names |
5417 | differing by an underscore."##, | ||
5360 | }, | 5418 | }, |
5361 | Lint { | 5419 | Lint { |
5362 | label: "clippy::duration_subsec", | 5420 | label: "clippy::duration_subsec", |
5363 | description: r##"Checks for calculation of subsecond microseconds or milliseconds\nfrom other `Duration` methods."##, | 5421 | description: r##"Checks for calculation of subsecond microseconds or milliseconds |
5422 | from other `Duration` methods."##, | ||
5364 | }, | 5423 | }, |
5365 | Lint { | 5424 | Lint { |
5366 | label: "clippy::else_if_without_else", | 5425 | label: "clippy::else_if_without_else", |
5367 | description: r##"Checks for usage of if expressions with an `else if` branch,\nbut without a final `else` branch."##, | 5426 | description: r##"Checks for usage of if expressions with an `else if` branch, |
5427 | but without a final `else` branch."##, | ||
5368 | }, | 5428 | }, |
5369 | Lint { | 5429 | Lint { |
5370 | label: "clippy::empty_enum", | 5430 | label: "clippy::empty_enum", |
5371 | description: r##"Checks for `enum`s with no variants.\n\nAs of this writing, the `never_type` is still a\nnightly-only experimental API. Therefore, this lint is only triggered\nif the `never_type` is enabled."##, | 5431 | description: r##"Checks for `enum`s with no variants. |
5432 | |||
5433 | As of this writing, the `never_type` is still a | ||
5434 | nightly-only experimental API. Therefore, this lint is only triggered | ||
5435 | if the `never_type` is enabled."##, | ||
5372 | }, | 5436 | }, |
5373 | Lint { | 5437 | Lint { |
5374 | label: "clippy::empty_line_after_outer_attr", | 5438 | label: "clippy::empty_line_after_outer_attr", |
@@ -5377,16 +5441,20 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5377 | Lint { label: "clippy::empty_loop", description: r##"Checks for empty `loop` expressions."## }, | 5441 | Lint { label: "clippy::empty_loop", description: r##"Checks for empty `loop` expressions."## }, |
5378 | Lint { | 5442 | Lint { |
5379 | label: "clippy::enum_clike_unportable_variant", | 5443 | label: "clippy::enum_clike_unportable_variant", |
5380 | description: r##"Checks for C-like enumerations that are\n`repr(isize/usize)` and have values that don't fit into an `i32`."##, | 5444 | description: r##"Checks for C-like enumerations that are |
5445 | `repr(isize/usize)` and have values that don't fit into an `i32`."##, | ||
5381 | }, | 5446 | }, |
5382 | Lint { label: "clippy::enum_glob_use", description: r##"Checks for `use Enum::*`."## }, | 5447 | Lint { label: "clippy::enum_glob_use", description: r##"Checks for `use Enum::*`."## }, |
5383 | Lint { | 5448 | Lint { |
5384 | label: "clippy::enum_variant_names", | 5449 | label: "clippy::enum_variant_names", |
5385 | description: r##"Detects enumeration variants that are prefixed or suffixed\nby the same characters."##, | 5450 | description: r##"Detects enumeration variants that are prefixed or suffixed |
5451 | by the same characters."##, | ||
5386 | }, | 5452 | }, |
5387 | Lint { | 5453 | Lint { |
5388 | label: "clippy::eq_op", | 5454 | label: "clippy::eq_op", |
5389 | description: r##"Checks for equal operands to comparison, logical and\nbitwise, difference and division binary operators (`==`, `>`, etc., `&&`,\n`||`, `&`, `|`, `^`, `-` and `/`)."##, | 5455 | description: r##"Checks for equal operands to comparison, logical and |
5456 | bitwise, difference and division binary operators (`==`, `>`, etc., `&&`, | ||
5457 | `||`, `&`, `|`, `^`, `-` and `/`)."##, | ||
5390 | }, | 5458 | }, |
5391 | Lint { | 5459 | Lint { |
5392 | label: "clippy::erasing_op", | 5460 | label: "clippy::erasing_op", |
@@ -5394,11 +5462,14 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5394 | }, | 5462 | }, |
5395 | Lint { | 5463 | Lint { |
5396 | label: "clippy::eval_order_dependence", | 5464 | label: "clippy::eval_order_dependence", |
5397 | description: r##"Checks for a read and a write to the same variable where\nwhether the read occurs before or after the write depends on the evaluation\norder of sub-expressions."##, | 5465 | description: r##"Checks for a read and a write to the same variable where |
5466 | whether the read occurs before or after the write depends on the evaluation | ||
5467 | order of sub-expressions."##, | ||
5398 | }, | 5468 | }, |
5399 | Lint { | 5469 | Lint { |
5400 | label: "clippy::excessive_precision", | 5470 | label: "clippy::excessive_precision", |
5401 | description: r##"Checks for float literals with a precision greater\nthan that supported by the underlying type."##, | 5471 | description: r##"Checks for float literals with a precision greater |
5472 | than that supported by the underlying type."##, | ||
5402 | }, | 5473 | }, |
5403 | Lint { | 5474 | Lint { |
5404 | label: "clippy::exhaustive_enums", | 5475 | label: "clippy::exhaustive_enums", |
@@ -5410,11 +5481,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5410 | }, | 5481 | }, |
5411 | Lint { | 5482 | Lint { |
5412 | label: "clippy::exit", | 5483 | label: "clippy::exit", |
5413 | description: r##"`exit()` terminates the program and doesn't provide a\nstack trace."##, | 5484 | description: r##"`exit()` terminates the program and doesn't provide a |
5485 | stack trace."##, | ||
5414 | }, | 5486 | }, |
5415 | Lint { | 5487 | Lint { |
5416 | label: "clippy::expect_fun_call", | 5488 | label: "clippy::expect_fun_call", |
5417 | description: r##"Checks for calls to `.expect(&format!(...))`, `.expect(foo(..))`,\netc., and suggests to use `unwrap_or_else` instead"##, | 5489 | description: r##"Checks for calls to `.expect(&format!(...))`, `.expect(foo(..))`, |
5490 | etc., and suggests to use `unwrap_or_else` instead"##, | ||
5418 | }, | 5491 | }, |
5419 | Lint { | 5492 | Lint { |
5420 | label: "clippy::expect_used", | 5493 | label: "clippy::expect_used", |
@@ -5422,11 +5495,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5422 | }, | 5495 | }, |
5423 | Lint { | 5496 | Lint { |
5424 | label: "clippy::expl_impl_clone_on_copy", | 5497 | label: "clippy::expl_impl_clone_on_copy", |
5425 | description: r##"Checks for explicit `Clone` implementations for `Copy`\ntypes."##, | 5498 | description: r##"Checks for explicit `Clone` implementations for `Copy` |
5499 | types."##, | ||
5426 | }, | 5500 | }, |
5427 | Lint { | 5501 | Lint { |
5428 | label: "clippy::explicit_counter_loop", | 5502 | label: "clippy::explicit_counter_loop", |
5429 | description: r##"Checks `for` loops over slices with an explicit counter\nand suggests the use of `.enumerate()`."##, | 5503 | description: r##"Checks `for` loops over slices with an explicit counter |
5504 | and suggests the use of `.enumerate()`."##, | ||
5430 | }, | 5505 | }, |
5431 | Lint { | 5506 | Lint { |
5432 | label: "clippy::explicit_deref_methods", | 5507 | label: "clippy::explicit_deref_methods", |
@@ -5434,15 +5509,18 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5434 | }, | 5509 | }, |
5435 | Lint { | 5510 | Lint { |
5436 | label: "clippy::explicit_into_iter_loop", | 5511 | label: "clippy::explicit_into_iter_loop", |
5437 | description: r##"Checks for loops on `y.into_iter()` where `y` will do, and\nsuggests the latter."##, | 5512 | description: r##"Checks for loops on `y.into_iter()` where `y` will do, and |
5513 | suggests the latter."##, | ||
5438 | }, | 5514 | }, |
5439 | Lint { | 5515 | Lint { |
5440 | label: "clippy::explicit_iter_loop", | 5516 | label: "clippy::explicit_iter_loop", |
5441 | description: r##"Checks for loops on `x.iter()` where `&x` will do, and\nsuggests the latter."##, | 5517 | description: r##"Checks for loops on `x.iter()` where `&x` will do, and |
5518 | suggests the latter."##, | ||
5442 | }, | 5519 | }, |
5443 | Lint { | 5520 | Lint { |
5444 | label: "clippy::explicit_write", | 5521 | label: "clippy::explicit_write", |
5445 | description: r##"Checks for usage of `write!()` / `writeln()!` which can be\nreplaced with `(e)print!()` / `(e)println!()`"##, | 5522 | description: r##"Checks for usage of `write!()` / `writeln()!` which can be |
5523 | replaced with `(e)print!()` / `(e)println!()`"##, | ||
5446 | }, | 5524 | }, |
5447 | Lint { | 5525 | Lint { |
5448 | label: "clippy::extend_from_slice", | 5526 | label: "clippy::extend_from_slice", |
@@ -5450,7 +5528,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5450 | }, | 5528 | }, |
5451 | Lint { | 5529 | Lint { |
5452 | label: "clippy::extra_unused_lifetimes", | 5530 | label: "clippy::extra_unused_lifetimes", |
5453 | description: r##"Checks for lifetimes in generics that are never used\nanywhere else."##, | 5531 | description: r##"Checks for lifetimes in generics that are never used |
5532 | anywhere else."##, | ||
5454 | }, | 5533 | }, |
5455 | Lint { | 5534 | Lint { |
5456 | label: "clippy::fallible_impl_from", | 5535 | label: "clippy::fallible_impl_from", |
@@ -5458,7 +5537,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5458 | }, | 5537 | }, |
5459 | Lint { | 5538 | Lint { |
5460 | label: "clippy::field_reassign_with_default", | 5539 | label: "clippy::field_reassign_with_default", |
5461 | description: r##"Checks for immediate reassignment of fields initialized\nwith Default::default()."##, | 5540 | description: r##"Checks for immediate reassignment of fields initialized |
5541 | with Default::default()."##, | ||
5462 | }, | 5542 | }, |
5463 | Lint { | 5543 | Lint { |
5464 | label: "clippy::filetype_is_file", | 5544 | label: "clippy::filetype_is_file", |
@@ -5487,20 +5567,26 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5487 | }, | 5567 | }, |
5488 | Lint { | 5568 | Lint { |
5489 | label: "clippy::flat_map_option", | 5569 | label: "clippy::flat_map_option", |
5490 | description: r##"Checks for usages of `Iterator::flat_map()` where `filter_map()` could be\nused instead."##, | 5570 | description: r##"Checks for usages of `Iterator::flat_map()` where `filter_map()` could be |
5571 | used instead."##, | ||
5491 | }, | 5572 | }, |
5492 | Lint { label: "clippy::float_arithmetic", description: r##"Checks for float arithmetic."## }, | 5573 | Lint { label: "clippy::float_arithmetic", description: r##"Checks for float arithmetic."## }, |
5493 | Lint { | 5574 | Lint { |
5494 | label: "clippy::float_cmp", | 5575 | label: "clippy::float_cmp", |
5495 | description: r##"Checks for (in-)equality comparisons on floating-point\nvalues (apart from zero), except in functions called `*eq*` (which probably\nimplement equality for a type involving floats)."##, | 5576 | description: r##"Checks for (in-)equality comparisons on floating-point |
5577 | values (apart from zero), except in functions called `*eq*` (which probably | ||
5578 | implement equality for a type involving floats)."##, | ||
5496 | }, | 5579 | }, |
5497 | Lint { | 5580 | Lint { |
5498 | label: "clippy::float_cmp_const", | 5581 | label: "clippy::float_cmp_const", |
5499 | description: r##"Checks for (in-)equality comparisons on floating-point\nvalue and constant, except in functions called `*eq*` (which probably\nimplement equality for a type involving floats)."##, | 5582 | description: r##"Checks for (in-)equality comparisons on floating-point |
5583 | value and constant, except in functions called `*eq*` (which probably | ||
5584 | implement equality for a type involving floats)."##, | ||
5500 | }, | 5585 | }, |
5501 | Lint { | 5586 | Lint { |
5502 | label: "clippy::float_equality_without_abs", | 5587 | label: "clippy::float_equality_without_abs", |
5503 | description: r##"Checks for statements of the form `(a - b) < f32::EPSILON` or\n`(a - b) < f64::EPSILON`. Notes the missing `.abs()`."##, | 5588 | description: r##"Checks for statements of the form `(a - b) < f32::EPSILON` or |
5589 | `(a - b) < f64::EPSILON`. Notes the missing `.abs()`."##, | ||
5504 | }, | 5590 | }, |
5505 | Lint { | 5591 | Lint { |
5506 | label: "clippy::fn_address_comparisons", | 5592 | label: "clippy::fn_address_comparisons", |
@@ -5508,7 +5594,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5508 | }, | 5594 | }, |
5509 | Lint { | 5595 | Lint { |
5510 | label: "clippy::fn_params_excessive_bools", | 5596 | label: "clippy::fn_params_excessive_bools", |
5511 | description: r##"Checks for excessive use of\nbools in function definitions."##, | 5597 | description: r##"Checks for excessive use of |
5598 | bools in function definitions."##, | ||
5512 | }, | 5599 | }, |
5513 | Lint { | 5600 | Lint { |
5514 | label: "clippy::fn_to_numeric_cast", | 5601 | label: "clippy::fn_to_numeric_cast", |
@@ -5516,11 +5603,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5516 | }, | 5603 | }, |
5517 | Lint { | 5604 | Lint { |
5518 | label: "clippy::fn_to_numeric_cast_with_truncation", | 5605 | label: "clippy::fn_to_numeric_cast_with_truncation", |
5519 | description: r##"Checks for casts of a function pointer to a numeric type not wide enough to\nstore address."##, | 5606 | description: r##"Checks for casts of a function pointer to a numeric type not wide enough to |
5607 | store address."##, | ||
5520 | }, | 5608 | }, |
5521 | Lint { | 5609 | Lint { |
5522 | label: "clippy::for_kv_map", | 5610 | label: "clippy::for_kv_map", |
5523 | description: r##"Checks for iterating a map (`HashMap` or `BTreeMap`) and\nignoring either the keys or values."##, | 5611 | description: r##"Checks for iterating a map (`HashMap` or `BTreeMap`) and |
5612 | ignoring either the keys or values."##, | ||
5524 | }, | 5613 | }, |
5525 | Lint { | 5614 | Lint { |
5526 | label: "clippy::for_loops_over_fallibles", | 5615 | label: "clippy::for_loops_over_fallibles", |
@@ -5528,15 +5617,18 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5528 | }, | 5617 | }, |
5529 | Lint { | 5618 | Lint { |
5530 | label: "clippy::forget_copy", | 5619 | label: "clippy::forget_copy", |
5531 | description: r##"Checks for calls to `std::mem::forget` with a value that\nderives the Copy trait"##, | 5620 | description: r##"Checks for calls to `std::mem::forget` with a value that |
5621 | derives the Copy trait"##, | ||
5532 | }, | 5622 | }, |
5533 | Lint { | 5623 | Lint { |
5534 | label: "clippy::forget_ref", | 5624 | label: "clippy::forget_ref", |
5535 | description: r##"Checks for calls to `std::mem::forget` with a reference\ninstead of an owned value."##, | 5625 | description: r##"Checks for calls to `std::mem::forget` with a reference |
5626 | instead of an owned value."##, | ||
5536 | }, | 5627 | }, |
5537 | Lint { | 5628 | Lint { |
5538 | label: "clippy::from_iter_instead_of_collect", | 5629 | label: "clippy::from_iter_instead_of_collect", |
5539 | description: r##"Checks for `from_iter()` function calls on types that implement the `FromIterator`\ntrait."##, | 5630 | description: r##"Checks for `from_iter()` function calls on types that implement the `FromIterator` |
5631 | trait."##, | ||
5540 | }, | 5632 | }, |
5541 | Lint { | 5633 | Lint { |
5542 | label: "clippy::from_over_into", | 5634 | label: "clippy::from_over_into", |
@@ -5548,15 +5640,20 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5548 | }, | 5640 | }, |
5549 | Lint { | 5641 | Lint { |
5550 | label: "clippy::future_not_send", | 5642 | label: "clippy::future_not_send", |
5551 | description: r##"This lint requires Future implementations returned from\nfunctions and methods to implement the `Send` marker trait. It is mostly\nused by library authors (public and internal) that target an audience where\nmultithreaded executors are likely to be used for running these Futures."##, | 5643 | description: r##"This lint requires Future implementations returned from |
5644 | functions and methods to implement the `Send` marker trait. It is mostly | ||
5645 | used by library authors (public and internal) that target an audience where | ||
5646 | multithreaded executors are likely to be used for running these Futures."##, | ||
5552 | }, | 5647 | }, |
5553 | Lint { | 5648 | Lint { |
5554 | label: "clippy::get_last_with_len", | 5649 | label: "clippy::get_last_with_len", |
5555 | description: r##"Checks for using `x.get(x.len() - 1)` instead of\n`x.last()`."##, | 5650 | description: r##"Checks for using `x.get(x.len() - 1)` instead of |
5651 | `x.last()`."##, | ||
5556 | }, | 5652 | }, |
5557 | Lint { | 5653 | Lint { |
5558 | label: "clippy::get_unwrap", | 5654 | label: "clippy::get_unwrap", |
5559 | description: r##"Checks for use of `.get().unwrap()` (or\n`.get_mut().unwrap`) on a standard library type which implements `Index`"##, | 5655 | description: r##"Checks for use of `.get().unwrap()` (or |
5656 | `.get_mut().unwrap`) on a standard library type which implements `Index`"##, | ||
5560 | }, | 5657 | }, |
5561 | Lint { | 5658 | Lint { |
5562 | label: "clippy::identity_op", | 5659 | label: "clippy::identity_op", |
@@ -5564,7 +5661,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5564 | }, | 5661 | }, |
5565 | Lint { | 5662 | Lint { |
5566 | label: "clippy::if_let_mutex", | 5663 | label: "clippy::if_let_mutex", |
5567 | description: r##"Checks for `Mutex::lock` calls in `if let` expression\nwith lock calls in any of the else blocks."##, | 5664 | description: r##"Checks for `Mutex::lock` calls in `if let` expression |
5665 | with lock calls in any of the else blocks."##, | ||
5568 | }, | 5666 | }, |
5569 | Lint { | 5667 | Lint { |
5570 | label: "clippy::if_let_redundant_pattern_matching", | 5668 | label: "clippy::if_let_redundant_pattern_matching", |
@@ -5576,11 +5674,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5576 | }, | 5674 | }, |
5577 | Lint { | 5675 | Lint { |
5578 | label: "clippy::if_not_else", | 5676 | label: "clippy::if_not_else", |
5579 | description: r##"Checks for usage of `!` or `!=` in an if condition with an\nelse branch."##, | 5677 | description: r##"Checks for usage of `!` or `!=` in an if condition with an |
5678 | else branch."##, | ||
5580 | }, | 5679 | }, |
5581 | Lint { | 5680 | Lint { |
5582 | label: "clippy::if_same_then_else", | 5681 | label: "clippy::if_same_then_else", |
5583 | description: r##"Checks for `if/else` with the same body as the *then* part\nand the *else* part."##, | 5682 | description: r##"Checks for `if/else` with the same body as the *then* part |
5683 | and the *else* part."##, | ||
5584 | }, | 5684 | }, |
5585 | Lint { | 5685 | Lint { |
5586 | label: "clippy::if_then_some_else_none", | 5686 | label: "clippy::if_then_some_else_none", |
@@ -5596,7 +5696,9 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5596 | }, | 5696 | }, |
5597 | Lint { | 5697 | Lint { |
5598 | label: "clippy::implicit_hasher", | 5698 | label: "clippy::implicit_hasher", |
5599 | description: r##"Checks for public `impl` or `fn` missing generalization\nover different hashers and implicitly defaulting to the default hashing\nalgorithm (`SipHash`)."##, | 5699 | description: r##"Checks for public `impl` or `fn` missing generalization |
5700 | over different hashers and implicitly defaulting to the default hashing | ||
5701 | algorithm (`SipHash`)."##, | ||
5600 | }, | 5702 | }, |
5601 | Lint { | 5703 | Lint { |
5602 | label: "clippy::implicit_return", | 5704 | label: "clippy::implicit_return", |
@@ -5608,31 +5710,47 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5608 | }, | 5710 | }, |
5609 | Lint { | 5711 | Lint { |
5610 | label: "clippy::imprecise_flops", | 5712 | label: "clippy::imprecise_flops", |
5611 | description: r##"Looks for floating-point expressions that\ncan be expressed using built-in methods to improve accuracy\nat the cost of performance."##, | 5713 | description: r##"Looks for floating-point expressions that |
5714 | can be expressed using built-in methods to improve accuracy | ||
5715 | at the cost of performance."##, | ||
5612 | }, | 5716 | }, |
5613 | Lint { | 5717 | Lint { |
5614 | label: "clippy::inconsistent_digit_grouping", | 5718 | label: "clippy::inconsistent_digit_grouping", |
5615 | description: r##"Warns if an integral or floating-point constant is\ngrouped inconsistently with underscores."##, | 5719 | description: r##"Warns if an integral or floating-point constant is |
5720 | grouped inconsistently with underscores."##, | ||
5616 | }, | 5721 | }, |
5617 | Lint { | 5722 | Lint { |
5618 | label: "clippy::inconsistent_struct_constructor", | 5723 | label: "clippy::inconsistent_struct_constructor", |
5619 | description: r##"Checks for struct constructors where all fields are shorthand and\nthe order of the field init shorthand in the constructor is inconsistent\nwith the order in the struct definition."##, | 5724 | description: r##"Checks for struct constructors where all fields are shorthand and |
5725 | the order of the field init shorthand in the constructor is inconsistent | ||
5726 | with the order in the struct definition."##, | ||
5620 | }, | 5727 | }, |
5621 | Lint { | 5728 | Lint { |
5622 | label: "clippy::indexing_slicing", | 5729 | label: "clippy::indexing_slicing", |
5623 | description: r##"Checks for usage of indexing or slicing. Arrays are special cases, this lint\ndoes report on arrays if we can tell that slicing operations are in bounds and does not\nlint on constant `usize` indexing on arrays because that is handled by rustc's `const_err` lint."##, | 5730 | description: r##"Checks for usage of indexing or slicing. Arrays are special cases, this lint |
5731 | does report on arrays if we can tell that slicing operations are in bounds and does not | ||
5732 | lint on constant `usize` indexing on arrays because that is handled by rustc's `const_err` lint."##, | ||
5624 | }, | 5733 | }, |
5625 | Lint { | 5734 | Lint { |
5626 | label: "clippy::ineffective_bit_mask", | 5735 | label: "clippy::ineffective_bit_mask", |
5627 | description: r##"Checks for bit masks in comparisons which can be removed\nwithout changing the outcome. The basic structure can be seen in the\nfollowing table:\n\n|Comparison| Bit Op |Example |equals |\n|----------|---------|-----------|-------|\n|`>` / `<=`|`|` / `^`|`x | 2 > 3`|`x > 3`|\n|`<` / `>=`|`|` / `^`|`x ^ 1 < 4`|`x < 4`|"##, | 5736 | description: r##"Checks for bit masks in comparisons which can be removed |
5737 | without changing the outcome. The basic structure can be seen in the | ||
5738 | following table: | ||
5739 | |||
5740 | |Comparison| Bit Op |Example |equals | | ||
5741 | |----------|---------|-----------|-------| | ||
5742 | |`>` / `<=`|`|` / `^`|`x | 2 > 3`|`x > 3`| | ||
5743 | |`<` / `>=`|`|` / `^`|`x ^ 1 < 4`|`x < 4`|"##, | ||
5628 | }, | 5744 | }, |
5629 | Lint { | 5745 | Lint { |
5630 | label: "clippy::inefficient_to_string", | 5746 | label: "clippy::inefficient_to_string", |
5631 | description: r##"Checks for usage of `.to_string()` on an `&&T` where\n`T` implements `ToString` directly (like `&&str` or `&&String`)."##, | 5747 | description: r##"Checks for usage of `.to_string()` on an `&&T` where |
5748 | `T` implements `ToString` directly (like `&&str` or `&&String`)."##, | ||
5632 | }, | 5749 | }, |
5633 | Lint { | 5750 | Lint { |
5634 | label: "clippy::infallible_destructuring_match", | 5751 | label: "clippy::infallible_destructuring_match", |
5635 | description: r##"Checks for matches being used to destructure a single-variant enum\nor tuple struct where a `let` will suffice."##, | 5752 | description: r##"Checks for matches being used to destructure a single-variant enum |
5753 | or tuple struct where a `let` will suffice."##, | ||
5636 | }, | 5754 | }, |
5637 | Lint { | 5755 | Lint { |
5638 | label: "clippy::infinite_iter", | 5756 | label: "clippy::infinite_iter", |
@@ -5648,7 +5766,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5648 | }, | 5766 | }, |
5649 | Lint { | 5767 | Lint { |
5650 | label: "clippy::inline_always", | 5768 | label: "clippy::inline_always", |
5651 | description: r##"Checks for items annotated with `#[inline(always)]`,\nunless the annotated function is empty or simply panics."##, | 5769 | description: r##"Checks for items annotated with `#[inline(always)]`, |
5770 | unless the annotated function is empty or simply panics."##, | ||
5652 | }, | 5771 | }, |
5653 | Lint { | 5772 | Lint { |
5654 | label: "clippy::inline_asm_x86_att_syntax", | 5773 | label: "clippy::inline_asm_x86_att_syntax", |
@@ -5672,16 +5791,25 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5672 | }, | 5791 | }, |
5673 | Lint { | 5792 | Lint { |
5674 | label: "clippy::integer_arithmetic", | 5793 | label: "clippy::integer_arithmetic", |
5675 | description: r##"Checks for integer arithmetic operations which could overflow or panic.\n\nSpecifically, checks for any operators (`+`, `-`, `*`, `<<`, etc) which are capable\nof overflowing according to the [Rust\nReference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow),\nor which can panic (`/`, `%`). No bounds analysis or sophisticated reasoning is\nattempted."##, | 5794 | description: r##"Checks for integer arithmetic operations which could overflow or panic. |
5795 | |||
5796 | Specifically, checks for any operators (`+`, `-`, `*`, `<<`, etc) which are capable | ||
5797 | of overflowing according to the [Rust | ||
5798 | Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow), | ||
5799 | or which can panic (`/`, `%`). No bounds analysis or sophisticated reasoning is | ||
5800 | attempted."##, | ||
5676 | }, | 5801 | }, |
5677 | Lint { label: "clippy::integer_division", description: r##"Checks for division of integers"## }, | 5802 | Lint { label: "clippy::integer_division", description: r##"Checks for division of integers"## }, |
5678 | Lint { | 5803 | Lint { |
5679 | label: "clippy::into_iter_on_ref", | 5804 | label: "clippy::into_iter_on_ref", |
5680 | description: r##"Checks for `into_iter` calls on references which should be replaced by `iter`\nor `iter_mut`."##, | 5805 | description: r##"Checks for `into_iter` calls on references which should be replaced by `iter` |
5806 | or `iter_mut`."##, | ||
5681 | }, | 5807 | }, |
5682 | Lint { | 5808 | Lint { |
5683 | label: "clippy::invalid_atomic_ordering", | 5809 | label: "clippy::invalid_atomic_ordering", |
5684 | description: r##"Checks for usage of invalid atomic\nordering in atomic loads/stores/exchanges/updates and\nmemory fences."##, | 5810 | description: r##"Checks for usage of invalid atomic |
5811 | ordering in atomic loads/stores/exchanges/updates and | ||
5812 | memory fences."##, | ||
5685 | }, | 5813 | }, |
5686 | Lint { | 5814 | Lint { |
5687 | label: "clippy::invalid_null_ptr_usage", | 5815 | label: "clippy::invalid_null_ptr_usage", |
@@ -5689,11 +5817,15 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5689 | }, | 5817 | }, |
5690 | Lint { | 5818 | Lint { |
5691 | label: "clippy::invalid_regex", | 5819 | label: "clippy::invalid_regex", |
5692 | description: r##"Checks [regex](https://crates.io/crates/regex) creation\n(with `Regex::new`, `RegexBuilder::new`, or `RegexSet::new`) for correct\nregex syntax."##, | 5820 | description: r##"Checks [regex](https://crates.io/crates/regex) creation |
5821 | (with `Regex::new`, `RegexBuilder::new`, or `RegexSet::new`) for correct | ||
5822 | regex syntax."##, | ||
5693 | }, | 5823 | }, |
5694 | Lint { | 5824 | Lint { |
5695 | label: "clippy::invalid_upcast_comparisons", | 5825 | label: "clippy::invalid_upcast_comparisons", |
5696 | description: r##"Checks for comparisons where the relation is always either\ntrue or false, but where one side has been upcast so that the comparison is\nnecessary. Only integer types are checked."##, | 5826 | description: r##"Checks for comparisons where the relation is always either |
5827 | true or false, but where one side has been upcast so that the comparison is | ||
5828 | necessary. Only integer types are checked."##, | ||
5697 | }, | 5829 | }, |
5698 | Lint { | 5830 | Lint { |
5699 | label: "clippy::invisible_characters", | 5831 | label: "clippy::invisible_characters", |
@@ -5705,7 +5837,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5705 | }, | 5837 | }, |
5706 | Lint { | 5838 | Lint { |
5707 | label: "clippy::iter_cloned_collect", | 5839 | label: "clippy::iter_cloned_collect", |
5708 | description: r##"Checks for the use of `.cloned().collect()` on slice to\ncreate a `Vec`."##, | 5840 | description: r##"Checks for the use of `.cloned().collect()` on slice to |
5841 | create a `Vec`."##, | ||
5709 | }, | 5842 | }, |
5710 | Lint { | 5843 | Lint { |
5711 | label: "clippy::iter_count", | 5844 | label: "clippy::iter_count", |
@@ -5718,7 +5851,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5718 | }, | 5851 | }, |
5719 | Lint { | 5852 | Lint { |
5720 | label: "clippy::iter_nth", | 5853 | label: "clippy::iter_nth", |
5721 | description: r##"Checks for use of `.iter().nth()` (and the related\n`.iter_mut().nth()`) on standard library types with O(1) element access."##, | 5854 | description: r##"Checks for use of `.iter().nth()` (and the related |
5855 | `.iter_mut().nth()`) on standard library types with O(1) element access."##, | ||
5722 | }, | 5856 | }, |
5723 | Lint { | 5857 | Lint { |
5724 | label: "clippy::iter_nth_zero", | 5858 | label: "clippy::iter_nth_zero", |
@@ -5734,19 +5868,24 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5734 | }, | 5868 | }, |
5735 | Lint { | 5869 | Lint { |
5736 | label: "clippy::just_underscores_and_digits", | 5870 | label: "clippy::just_underscores_and_digits", |
5737 | description: r##"Checks if you have variables whose name consists of just\nunderscores and digits."##, | 5871 | description: r##"Checks if you have variables whose name consists of just |
5872 | underscores and digits."##, | ||
5738 | }, | 5873 | }, |
5739 | Lint { | 5874 | Lint { |
5740 | label: "clippy::large_const_arrays", | 5875 | label: "clippy::large_const_arrays", |
5741 | description: r##"Checks for large `const` arrays that should\nbe defined as `static` instead."##, | 5876 | description: r##"Checks for large `const` arrays that should |
5877 | be defined as `static` instead."##, | ||
5742 | }, | 5878 | }, |
5743 | Lint { | 5879 | Lint { |
5744 | label: "clippy::large_digit_groups", | 5880 | label: "clippy::large_digit_groups", |
5745 | description: r##"Warns if the digits of an integral or floating-point\nconstant are grouped into groups that\nare too large."##, | 5881 | description: r##"Warns if the digits of an integral or floating-point |
5882 | constant are grouped into groups that | ||
5883 | are too large."##, | ||
5746 | }, | 5884 | }, |
5747 | Lint { | 5885 | Lint { |
5748 | label: "clippy::large_enum_variant", | 5886 | label: "clippy::large_enum_variant", |
5749 | description: r##"Checks for large size differences between variants on\n`enum`s."##, | 5887 | description: r##"Checks for large size differences between variants on |
5888 | `enum`s."##, | ||
5750 | }, | 5889 | }, |
5751 | Lint { | 5890 | Lint { |
5752 | label: "clippy::large_stack_arrays", | 5891 | label: "clippy::large_stack_arrays", |
@@ -5754,23 +5893,31 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5754 | }, | 5893 | }, |
5755 | Lint { | 5894 | Lint { |
5756 | label: "clippy::large_types_passed_by_value", | 5895 | label: "clippy::large_types_passed_by_value", |
5757 | description: r##"Checks for functions taking arguments by value, where\nthe argument type is `Copy` and large enough to be worth considering\npassing by reference. Does not trigger if the function is being exported,\nbecause that might induce API breakage, if the parameter is declared as mutable,\nor if the argument is a `self`."##, | 5896 | description: r##"Checks for functions taking arguments by value, where |
5897 | the argument type is `Copy` and large enough to be worth considering | ||
5898 | passing by reference. Does not trigger if the function is being exported, | ||
5899 | because that might induce API breakage, if the parameter is declared as mutable, | ||
5900 | or if the argument is a `self`."##, | ||
5758 | }, | 5901 | }, |
5759 | Lint { | 5902 | Lint { |
5760 | label: "clippy::len_without_is_empty", | 5903 | label: "clippy::len_without_is_empty", |
5761 | description: r##"Checks for items that implement `.len()` but not\n`.is_empty()`."##, | 5904 | description: r##"Checks for items that implement `.len()` but not |
5905 | `.is_empty()`."##, | ||
5762 | }, | 5906 | }, |
5763 | Lint { | 5907 | Lint { |
5764 | label: "clippy::len_zero", | 5908 | label: "clippy::len_zero", |
5765 | description: r##"Checks for getting the length of something via `.len()`\njust to compare to zero, and suggests using `.is_empty()` where applicable."##, | 5909 | description: r##"Checks for getting the length of something via `.len()` |
5910 | just to compare to zero, and suggests using `.is_empty()` where applicable."##, | ||
5766 | }, | 5911 | }, |
5767 | Lint { | 5912 | Lint { |
5768 | label: "clippy::let_and_return", | 5913 | label: "clippy::let_and_return", |
5769 | description: r##"Checks for `let`-bindings, which are subsequently\nreturned."##, | 5914 | description: r##"Checks for `let`-bindings, which are subsequently |
5915 | returned."##, | ||
5770 | }, | 5916 | }, |
5771 | Lint { | 5917 | Lint { |
5772 | label: "clippy::let_underscore_drop", | 5918 | label: "clippy::let_underscore_drop", |
5773 | description: r##"Checks for `let _ = <expr>`\nwhere expr has a type that implements `Drop`"##, | 5919 | description: r##"Checks for `let _ = <expr>` |
5920 | where expr has a type that implements `Drop`"##, | ||
5774 | }, | 5921 | }, |
5775 | Lint { | 5922 | Lint { |
5776 | label: "clippy::let_underscore_lock", | 5923 | label: "clippy::let_underscore_lock", |
@@ -5778,20 +5925,24 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5778 | }, | 5925 | }, |
5779 | Lint { | 5926 | Lint { |
5780 | label: "clippy::let_underscore_must_use", | 5927 | label: "clippy::let_underscore_must_use", |
5781 | description: r##"Checks for `let _ = <expr>`\nwhere expr is #[must_use]"##, | 5928 | description: r##"Checks for `let _ = <expr>` |
5929 | where expr is #[must_use]"##, | ||
5782 | }, | 5930 | }, |
5783 | Lint { label: "clippy::let_unit_value", description: r##"Checks for binding a unit value."## }, | 5931 | Lint { label: "clippy::let_unit_value", description: r##"Checks for binding a unit value."## }, |
5784 | Lint { | 5932 | Lint { |
5785 | label: "clippy::linkedlist", | 5933 | label: "clippy::linkedlist", |
5786 | description: r##"Checks for usage of any `LinkedList`, suggesting to use a\n`Vec` or a `VecDeque` (formerly called `RingBuf`)."##, | 5934 | description: r##"Checks for usage of any `LinkedList`, suggesting to use a |
5935 | `Vec` or a `VecDeque` (formerly called `RingBuf`)."##, | ||
5787 | }, | 5936 | }, |
5788 | Lint { | 5937 | Lint { |
5789 | label: "clippy::logic_bug", | 5938 | label: "clippy::logic_bug", |
5790 | description: r##"Checks for boolean expressions that contain terminals that\ncan be eliminated."##, | 5939 | description: r##"Checks for boolean expressions that contain terminals that |
5940 | can be eliminated."##, | ||
5791 | }, | 5941 | }, |
5792 | Lint { | 5942 | Lint { |
5793 | label: "clippy::lossy_float_literal", | 5943 | label: "clippy::lossy_float_literal", |
5794 | description: r##"Checks for whole number float literals that\ncannot be represented as the underlying type without loss."##, | 5944 | description: r##"Checks for whole number float literals that |
5945 | cannot be represented as the underlying type without loss."##, | ||
5795 | }, | 5946 | }, |
5796 | Lint { | 5947 | Lint { |
5797 | label: "clippy::macro_use_imports", | 5948 | label: "clippy::macro_use_imports", |
@@ -5807,15 +5958,18 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5807 | }, | 5958 | }, |
5808 | Lint { | 5959 | Lint { |
5809 | label: "clippy::manual_filter_map", | 5960 | label: "clippy::manual_filter_map", |
5810 | description: r##"Checks for usage of `_.filter(_).map(_)` that can be written more simply\nas `filter_map(_)`."##, | 5961 | description: r##"Checks for usage of `_.filter(_).map(_)` that can be written more simply |
5962 | as `filter_map(_)`."##, | ||
5811 | }, | 5963 | }, |
5812 | Lint { | 5964 | Lint { |
5813 | label: "clippy::manual_find_map", | 5965 | label: "clippy::manual_find_map", |
5814 | description: r##"Checks for usage of `_.find(_).map(_)` that can be written more simply\nas `find_map(_)`."##, | 5966 | description: r##"Checks for usage of `_.find(_).map(_)` that can be written more simply |
5967 | as `find_map(_)`."##, | ||
5815 | }, | 5968 | }, |
5816 | Lint { | 5969 | Lint { |
5817 | label: "clippy::manual_flatten", | 5970 | label: "clippy::manual_flatten", |
5818 | description: r##"Check for unnecessary `if let` usage in a for loop\nwhere only the `Some` or `Ok` variant of the iterator element is used."##, | 5971 | description: r##"Check for unnecessary `if let` usage in a for loop |
5972 | where only the `Some` or `Ok` variant of the iterator element is used."##, | ||
5819 | }, | 5973 | }, |
5820 | Lint { | 5974 | Lint { |
5821 | label: "clippy::manual_map", | 5975 | label: "clippy::manual_map", |
@@ -5823,7 +5977,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5823 | }, | 5977 | }, |
5824 | Lint { | 5978 | Lint { |
5825 | label: "clippy::manual_memcpy", | 5979 | label: "clippy::manual_memcpy", |
5826 | description: r##"Checks for for-loops that manually copy items between\nslices that could be optimized by having a memcpy."##, | 5980 | description: r##"Checks for for-loops that manually copy items between |
5981 | slices that could be optimized by having a memcpy."##, | ||
5827 | }, | 5982 | }, |
5828 | Lint { | 5983 | Lint { |
5829 | label: "clippy::manual_non_exhaustive", | 5984 | label: "clippy::manual_non_exhaustive", |
@@ -5835,7 +5990,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5835 | }, | 5990 | }, |
5836 | Lint { | 5991 | Lint { |
5837 | label: "clippy::manual_range_contains", | 5992 | label: "clippy::manual_range_contains", |
5838 | description: r##"Checks for expressions like `x >= 3 && x < 8` that could\nbe more readably expressed as `(3..8).contains(x)`."##, | 5993 | description: r##"Checks for expressions like `x >= 3 && x < 8` that could |
5994 | be more readably expressed as `(3..8).contains(x)`."##, | ||
5839 | }, | 5995 | }, |
5840 | Lint { | 5996 | Lint { |
5841 | label: "clippy::manual_saturating_arithmetic", | 5997 | label: "clippy::manual_saturating_arithmetic", |
@@ -5847,7 +6003,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5847 | }, | 6003 | }, |
5848 | Lint { | 6004 | Lint { |
5849 | label: "clippy::manual_strip", | 6005 | label: "clippy::manual_strip", |
5850 | description: r##"Suggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing using\nthe pattern's length."##, | 6006 | description: r##"Suggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing using |
6007 | the pattern's length."##, | ||
5851 | }, | 6008 | }, |
5852 | Lint { label: "clippy::manual_swap", description: r##"Checks for manual swapping."## }, | 6009 | Lint { label: "clippy::manual_swap", description: r##"Checks for manual swapping."## }, |
5853 | Lint { | 6010 | Lint { |
@@ -5856,11 +6013,14 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5856 | }, | 6013 | }, |
5857 | Lint { | 6014 | Lint { |
5858 | label: "clippy::many_single_char_names", | 6015 | label: "clippy::many_single_char_names", |
5859 | description: r##"Checks for too many variables whose name consists of a\nsingle character."##, | 6016 | description: r##"Checks for too many variables whose name consists of a |
6017 | single character."##, | ||
5860 | }, | 6018 | }, |
5861 | Lint { | 6019 | Lint { |
5862 | label: "clippy::map_clone", | 6020 | label: "clippy::map_clone", |
5863 | description: r##"Checks for usage of `map(|x| x.clone())` or\ndereferencing closures for `Copy` types, on `Iterator` or `Option`,\nand suggests `cloned()` or `copied()` instead"##, | 6021 | description: r##"Checks for usage of `map(|x| x.clone())` or |
6022 | dereferencing closures for `Copy` types, on `Iterator` or `Option`, | ||
6023 | and suggests `cloned()` or `copied()` instead"##, | ||
5864 | }, | 6024 | }, |
5865 | Lint { | 6025 | Lint { |
5866 | label: "clippy::map_collect_result_unit", | 6026 | label: "clippy::map_collect_result_unit", |
@@ -5868,7 +6028,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5868 | }, | 6028 | }, |
5869 | Lint { | 6029 | Lint { |
5870 | label: "clippy::map_entry", | 6030 | label: "clippy::map_entry", |
5871 | description: r##"Checks for uses of `contains_key` + `insert` on `HashMap`\nor `BTreeMap`."##, | 6031 | description: r##"Checks for uses of `contains_key` + `insert` on `HashMap` |
6032 | or `BTreeMap`."##, | ||
5872 | }, | 6033 | }, |
5873 | Lint { | 6034 | Lint { |
5874 | label: "clippy::map_err_ignore", | 6035 | label: "clippy::map_err_ignore", |
@@ -5884,19 +6045,23 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5884 | }, | 6045 | }, |
5885 | Lint { | 6046 | Lint { |
5886 | label: "clippy::map_unwrap_or", | 6047 | label: "clippy::map_unwrap_or", |
5887 | description: r##"Checks for usage of `option.map(_).unwrap_or(_)` or `option.map(_).unwrap_or_else(_)` or\n`result.map(_).unwrap_or_else(_)`."##, | 6048 | description: r##"Checks for usage of `option.map(_).unwrap_or(_)` or `option.map(_).unwrap_or_else(_)` or |
6049 | `result.map(_).unwrap_or_else(_)`."##, | ||
5888 | }, | 6050 | }, |
5889 | Lint { | 6051 | Lint { |
5890 | label: "clippy::match_as_ref", | 6052 | label: "clippy::match_as_ref", |
5891 | description: r##"Checks for match which is used to add a reference to an\n`Option` value."##, | 6053 | description: r##"Checks for match which is used to add a reference to an |
6054 | `Option` value."##, | ||
5892 | }, | 6055 | }, |
5893 | Lint { | 6056 | Lint { |
5894 | label: "clippy::match_bool", | 6057 | label: "clippy::match_bool", |
5895 | description: r##"Checks for matches where match expression is a `bool`. It\nsuggests to replace the expression with an `if...else` block."##, | 6058 | description: r##"Checks for matches where match expression is a `bool`. It |
6059 | suggests to replace the expression with an `if...else` block."##, | ||
5896 | }, | 6060 | }, |
5897 | Lint { | 6061 | Lint { |
5898 | label: "clippy::match_like_matches_macro", | 6062 | label: "clippy::match_like_matches_macro", |
5899 | description: r##"Checks for `match` or `if let` expressions producing a\n`bool` that could be written using `matches!`"##, | 6063 | description: r##"Checks for `match` or `if let` expressions producing a |
6064 | `bool` that could be written using `matches!`"##, | ||
5900 | }, | 6065 | }, |
5901 | Lint { | 6066 | Lint { |
5902 | label: "clippy::match_on_vec_items", | 6067 | label: "clippy::match_on_vec_items", |
@@ -5908,7 +6073,9 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5908 | }, | 6073 | }, |
5909 | Lint { | 6074 | Lint { |
5910 | label: "clippy::match_ref_pats", | 6075 | label: "clippy::match_ref_pats", |
5911 | description: r##"Checks for matches where all arms match a reference,\nsuggesting to remove the reference and deref the matched expression\ninstead. It also checks for `if let &foo = bar` blocks."##, | 6076 | description: r##"Checks for matches where all arms match a reference, |
6077 | suggesting to remove the reference and deref the matched expression | ||
6078 | instead. It also checks for `if let &foo = bar` blocks."##, | ||
5912 | }, | 6079 | }, |
5913 | Lint { | 6080 | Lint { |
5914 | label: "clippy::match_same_arms", | 6081 | label: "clippy::match_same_arms", |
@@ -5920,7 +6087,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5920 | }, | 6087 | }, |
5921 | Lint { | 6088 | Lint { |
5922 | label: "clippy::match_wild_err_arm", | 6089 | label: "clippy::match_wild_err_arm", |
5923 | description: r##"Checks for arm which matches all errors with `Err(_)`\nand take drastic actions like `panic!`."##, | 6090 | description: r##"Checks for arm which matches all errors with `Err(_)` |
6091 | and take drastic actions like `panic!`."##, | ||
5924 | }, | 6092 | }, |
5925 | Lint { | 6093 | Lint { |
5926 | label: "clippy::match_wildcard_for_single_variants", | 6094 | label: "clippy::match_wildcard_for_single_variants", |
@@ -5936,23 +6104,28 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5936 | }, | 6104 | }, |
5937 | Lint { | 6105 | Lint { |
5938 | label: "clippy::mem_forget", | 6106 | label: "clippy::mem_forget", |
5939 | description: r##"Checks for usage of `std::mem::forget(t)` where `t` is\n`Drop`."##, | 6107 | description: r##"Checks for usage of `std::mem::forget(t)` where `t` is |
6108 | `Drop`."##, | ||
5940 | }, | 6109 | }, |
5941 | Lint { | 6110 | Lint { |
5942 | label: "clippy::mem_replace_option_with_none", | 6111 | label: "clippy::mem_replace_option_with_none", |
5943 | description: r##"Checks for `mem::replace()` on an `Option` with\n`None`."##, | 6112 | description: r##"Checks for `mem::replace()` on an `Option` with |
6113 | `None`."##, | ||
5944 | }, | 6114 | }, |
5945 | Lint { | 6115 | Lint { |
5946 | label: "clippy::mem_replace_with_default", | 6116 | label: "clippy::mem_replace_with_default", |
5947 | description: r##"Checks for `std::mem::replace` on a value of type\n`T` with `T::default()`."##, | 6117 | description: r##"Checks for `std::mem::replace` on a value of type |
6118 | `T` with `T::default()`."##, | ||
5948 | }, | 6119 | }, |
5949 | Lint { | 6120 | Lint { |
5950 | label: "clippy::mem_replace_with_uninit", | 6121 | label: "clippy::mem_replace_with_uninit", |
5951 | description: r##"Checks for `mem::replace(&mut _, mem::uninitialized())`\nand `mem::replace(&mut _, mem::zeroed())`."##, | 6122 | description: r##"Checks for `mem::replace(&mut _, mem::uninitialized())` |
6123 | and `mem::replace(&mut _, mem::zeroed())`."##, | ||
5952 | }, | 6124 | }, |
5953 | Lint { | 6125 | Lint { |
5954 | label: "clippy::min_max", | 6126 | label: "clippy::min_max", |
5955 | description: r##"Checks for expressions where `std::cmp::min` and `max` are\nused to clamp values, but switched so that the result is constant."##, | 6127 | description: r##"Checks for expressions where `std::cmp::min` and `max` are |
6128 | used to clamp values, but switched so that the result is constant."##, | ||
5956 | }, | 6129 | }, |
5957 | Lint { | 6130 | Lint { |
5958 | label: "clippy::misaligned_transmute", | 6131 | label: "clippy::misaligned_transmute", |
@@ -5972,23 +6145,28 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5972 | }, | 6145 | }, |
5973 | Lint { | 6146 | Lint { |
5974 | label: "clippy::missing_docs_in_private_items", | 6147 | label: "clippy::missing_docs_in_private_items", |
5975 | description: r##"Warns if there is missing doc for any documentable item\n(public or private)."##, | 6148 | description: r##"Warns if there is missing doc for any documentable item |
6149 | (public or private)."##, | ||
5976 | }, | 6150 | }, |
5977 | Lint { | 6151 | Lint { |
5978 | label: "clippy::missing_errors_doc", | 6152 | label: "clippy::missing_errors_doc", |
5979 | description: r##"Checks the doc comments of publicly visible functions that\nreturn a `Result` type and warns if there is no `# Errors` section."##, | 6153 | description: r##"Checks the doc comments of publicly visible functions that |
6154 | return a `Result` type and warns if there is no `# Errors` section."##, | ||
5980 | }, | 6155 | }, |
5981 | Lint { | 6156 | Lint { |
5982 | label: "clippy::missing_inline_in_public_items", | 6157 | label: "clippy::missing_inline_in_public_items", |
5983 | description: r##"it lints if an exported function, method, trait method with default impl,\nor trait method impl is not `#[inline]`."##, | 6158 | description: r##"it lints if an exported function, method, trait method with default impl, |
6159 | or trait method impl is not `#[inline]`."##, | ||
5984 | }, | 6160 | }, |
5985 | Lint { | 6161 | Lint { |
5986 | label: "clippy::missing_panics_doc", | 6162 | label: "clippy::missing_panics_doc", |
5987 | description: r##"Checks the doc comments of publicly visible functions that\nmay panic and warns if there is no `# Panics` section."##, | 6163 | description: r##"Checks the doc comments of publicly visible functions that |
6164 | may panic and warns if there is no `# Panics` section."##, | ||
5988 | }, | 6165 | }, |
5989 | Lint { | 6166 | Lint { |
5990 | label: "clippy::missing_safety_doc", | 6167 | label: "clippy::missing_safety_doc", |
5991 | description: r##"Checks for the doc comments of publicly visible\nunsafe functions and warns if there is no `# Safety` section."##, | 6168 | description: r##"Checks for the doc comments of publicly visible |
6169 | unsafe functions and warns if there is no `# Safety` section."##, | ||
5992 | }, | 6170 | }, |
5993 | Lint { | 6171 | Lint { |
5994 | label: "clippy::mistyped_literal_suffixes", | 6172 | label: "clippy::mistyped_literal_suffixes", |
@@ -5996,24 +6174,29 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
5996 | }, | 6174 | }, |
5997 | Lint { | 6175 | Lint { |
5998 | label: "clippy::mixed_case_hex_literals", | 6176 | label: "clippy::mixed_case_hex_literals", |
5999 | description: r##"Warns on hexadecimal literals with mixed-case letter\ndigits."##, | 6177 | description: r##"Warns on hexadecimal literals with mixed-case letter |
6178 | digits."##, | ||
6000 | }, | 6179 | }, |
6001 | Lint { | 6180 | Lint { |
6002 | label: "clippy::module_inception", | 6181 | label: "clippy::module_inception", |
6003 | description: r##"Checks for modules that have the same name as their\nparent module"##, | 6182 | description: r##"Checks for modules that have the same name as their |
6183 | parent module"##, | ||
6004 | }, | 6184 | }, |
6005 | Lint { | 6185 | Lint { |
6006 | label: "clippy::module_name_repetitions", | 6186 | label: "clippy::module_name_repetitions", |
6007 | description: r##"Detects type names that are prefixed or suffixed by the\ncontaining module's name."##, | 6187 | description: r##"Detects type names that are prefixed or suffixed by the |
6188 | containing module's name."##, | ||
6008 | }, | 6189 | }, |
6009 | Lint { label: "clippy::modulo_arithmetic", description: r##"Checks for modulo arithmetic."## }, | 6190 | Lint { label: "clippy::modulo_arithmetic", description: r##"Checks for modulo arithmetic."## }, |
6010 | Lint { | 6191 | Lint { |
6011 | label: "clippy::modulo_one", | 6192 | label: "clippy::modulo_one", |
6012 | description: r##"Checks for getting the remainder of a division by one or minus\none."##, | 6193 | description: r##"Checks for getting the remainder of a division by one or minus |
6194 | one."##, | ||
6013 | }, | 6195 | }, |
6014 | Lint { | 6196 | Lint { |
6015 | label: "clippy::multiple_crate_versions", | 6197 | label: "clippy::multiple_crate_versions", |
6016 | description: r##"Checks to see if multiple versions of a crate are being\nused."##, | 6198 | description: r##"Checks to see if multiple versions of a crate are being |
6199 | used."##, | ||
6017 | }, | 6200 | }, |
6018 | Lint { | 6201 | Lint { |
6019 | label: "clippy::multiple_inherent_impl", | 6202 | label: "clippy::multiple_inherent_impl", |
@@ -6021,15 +6204,23 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6021 | }, | 6204 | }, |
6022 | Lint { | 6205 | Lint { |
6023 | label: "clippy::must_use_candidate", | 6206 | label: "clippy::must_use_candidate", |
6024 | description: r##"Checks for public functions that have no\n[`#[must_use]`] attribute, but return something not already marked\nmust-use, have no mutable arg and mutate no statics.\n\n[`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"##, | 6207 | description: r##"Checks for public functions that have no |
6208 | [`#[must_use]`] attribute, but return something not already marked | ||
6209 | must-use, have no mutable arg and mutate no statics. | ||
6210 | |||
6211 | [`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"##, | ||
6025 | }, | 6212 | }, |
6026 | Lint { | 6213 | Lint { |
6027 | label: "clippy::must_use_unit", | 6214 | label: "clippy::must_use_unit", |
6028 | description: r##"Checks for a [`#[must_use]`] attribute on\nunit-returning functions and methods.\n\n[`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"##, | 6215 | description: r##"Checks for a [`#[must_use]`] attribute on |
6216 | unit-returning functions and methods. | ||
6217 | |||
6218 | [`#[must_use]`]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"##, | ||
6029 | }, | 6219 | }, |
6030 | Lint { | 6220 | Lint { |
6031 | label: "clippy::mut_from_ref", | 6221 | label: "clippy::mut_from_ref", |
6032 | description: r##"This lint checks for functions that take immutable\nreferences and return mutable ones."##, | 6222 | description: r##"This lint checks for functions that take immutable |
6223 | references and return mutable ones."##, | ||
6033 | }, | 6224 | }, |
6034 | Lint { | 6225 | Lint { |
6035 | label: "clippy::mut_mut", | 6226 | label: "clippy::mut_mut", |
@@ -6053,36 +6244,46 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6053 | }, | 6244 | }, |
6054 | Lint { | 6245 | Lint { |
6055 | label: "clippy::mutex_integer", | 6246 | label: "clippy::mutex_integer", |
6056 | description: r##"Checks for usages of `Mutex<X>` where `X` is an integral\ntype."##, | 6247 | description: r##"Checks for usages of `Mutex<X>` where `X` is an integral |
6248 | type."##, | ||
6057 | }, | 6249 | }, |
6058 | Lint { label: "clippy::naive_bytecount", description: r##"Checks for naive byte counts"## }, | 6250 | Lint { label: "clippy::naive_bytecount", description: r##"Checks for naive byte counts"## }, |
6059 | Lint { | 6251 | Lint { |
6060 | label: "clippy::needless_arbitrary_self_type", | 6252 | label: "clippy::needless_arbitrary_self_type", |
6061 | description: r##"The lint checks for `self` in fn parameters that\nspecify the `Self`-type explicitly"##, | 6253 | description: r##"The lint checks for `self` in fn parameters that |
6254 | specify the `Self`-type explicitly"##, | ||
6062 | }, | 6255 | }, |
6063 | Lint { | 6256 | Lint { |
6064 | label: "clippy::needless_bitwise_bool", | 6257 | label: "clippy::needless_bitwise_bool", |
6065 | description: r##"Checks for uses of bitwise and/or operators between booleans, where performance may be improved by using\na lazy and."##, | 6258 | description: r##"Checks for uses of bitwise and/or operators between booleans, where performance may be improved by using |
6259 | a lazy and."##, | ||
6066 | }, | 6260 | }, |
6067 | Lint { | 6261 | Lint { |
6068 | label: "clippy::needless_bool", | 6262 | label: "clippy::needless_bool", |
6069 | description: r##"Checks for expressions of the form `if c { true } else {\nfalse }` (or vice versa) and suggests using the condition directly."##, | 6263 | description: r##"Checks for expressions of the form `if c { true } else { |
6264 | false }` (or vice versa) and suggests using the condition directly."##, | ||
6070 | }, | 6265 | }, |
6071 | Lint { | 6266 | Lint { |
6072 | label: "clippy::needless_borrow", | 6267 | label: "clippy::needless_borrow", |
6073 | description: r##"Checks for address of operations (`&`) that are going to\nbe dereferenced immediately by the compiler."##, | 6268 | description: r##"Checks for address of operations (`&`) that are going to |
6269 | be dereferenced immediately by the compiler."##, | ||
6074 | }, | 6270 | }, |
6075 | Lint { | 6271 | Lint { |
6076 | label: "clippy::needless_borrowed_reference", | 6272 | label: "clippy::needless_borrowed_reference", |
6077 | description: r##"Checks for bindings that destructure a reference and borrow the inner\nvalue with `&ref`."##, | 6273 | description: r##"Checks for bindings that destructure a reference and borrow the inner |
6274 | value with `&ref`."##, | ||
6078 | }, | 6275 | }, |
6079 | Lint { | 6276 | Lint { |
6080 | label: "clippy::needless_collect", | 6277 | label: "clippy::needless_collect", |
6081 | description: r##"Checks for functions collecting an iterator when collect\nis not needed."##, | 6278 | description: r##"Checks for functions collecting an iterator when collect |
6279 | is not needed."##, | ||
6082 | }, | 6280 | }, |
6083 | Lint { | 6281 | Lint { |
6084 | label: "clippy::needless_continue", | 6282 | label: "clippy::needless_continue", |
6085 | description: r##"The lint checks for `if`-statements appearing in loops\nthat contain a `continue` statement in either their main blocks or their\n`else`-blocks, when omitting the `else`-block possibly with some\nrearrangement of code can make the code easier to understand."##, | 6283 | description: r##"The lint checks for `if`-statements appearing in loops |
6284 | that contain a `continue` statement in either their main blocks or their | ||
6285 | `else`-blocks, when omitting the `else`-block possibly with some | ||
6286 | rearrangement of code can make the code easier to understand."##, | ||
6086 | }, | 6287 | }, |
6087 | Lint { | 6288 | Lint { |
6088 | label: "clippy::needless_doctest_main", | 6289 | label: "clippy::needless_doctest_main", |
@@ -6090,15 +6291,19 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6090 | }, | 6291 | }, |
6091 | Lint { | 6292 | Lint { |
6092 | label: "clippy::needless_for_each", | 6293 | label: "clippy::needless_for_each", |
6093 | description: r##"Checks for usage of `for_each` that would be more simply written as a\n`for` loop."##, | 6294 | description: r##"Checks for usage of `for_each` that would be more simply written as a |
6295 | `for` loop."##, | ||
6094 | }, | 6296 | }, |
6095 | Lint { | 6297 | Lint { |
6096 | label: "clippy::needless_lifetimes", | 6298 | label: "clippy::needless_lifetimes", |
6097 | description: r##"Checks for lifetime annotations which can be removed by\nrelying on lifetime elision."##, | 6299 | description: r##"Checks for lifetime annotations which can be removed by |
6300 | relying on lifetime elision."##, | ||
6098 | }, | 6301 | }, |
6099 | Lint { | 6302 | Lint { |
6100 | label: "clippy::needless_pass_by_value", | 6303 | label: "clippy::needless_pass_by_value", |
6101 | description: r##"Checks for functions taking arguments by value, but not\nconsuming them in its\nbody."##, | 6304 | description: r##"Checks for functions taking arguments by value, but not |
6305 | consuming them in its | ||
6306 | body."##, | ||
6102 | }, | 6307 | }, |
6103 | Lint { | 6308 | Lint { |
6104 | label: "clippy::needless_question_mark", | 6309 | label: "clippy::needless_question_mark", |
@@ -6106,7 +6311,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6106 | }, | 6311 | }, |
6107 | Lint { | 6312 | Lint { |
6108 | label: "clippy::needless_range_loop", | 6313 | label: "clippy::needless_range_loop", |
6109 | description: r##"Checks for looping over the range of `0..len` of some\ncollection just to get the values by index."##, | 6314 | description: r##"Checks for looping over the range of `0..len` of some |
6315 | collection just to get the values by index."##, | ||
6110 | }, | 6316 | }, |
6111 | Lint { | 6317 | Lint { |
6112 | label: "clippy::needless_return", | 6318 | label: "clippy::needless_return", |
@@ -6114,11 +6320,16 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6114 | }, | 6320 | }, |
6115 | Lint { | 6321 | Lint { |
6116 | label: "clippy::needless_update", | 6322 | label: "clippy::needless_update", |
6117 | description: r##"Checks for needlessly including a base struct on update\nwhen all fields are changed anyway.\n\nThis lint is not applied to structs marked with\n[non_exhaustive](https://doc.rust-lang.org/reference/attributes/type_system.html)."##, | 6323 | description: r##"Checks for needlessly including a base struct on update |
6324 | when all fields are changed anyway. | ||
6325 | |||
6326 | This lint is not applied to structs marked with | ||
6327 | [non_exhaustive](https://doc.rust-lang.org/reference/attributes/type_system.html)."##, | ||
6118 | }, | 6328 | }, |
6119 | Lint { | 6329 | Lint { |
6120 | label: "clippy::neg_cmp_op_on_partial_ord", | 6330 | label: "clippy::neg_cmp_op_on_partial_ord", |
6121 | description: r##"Checks for the usage of negated comparison operators on types which only implement\n`PartialOrd` (e.g., `f64`)."##, | 6331 | description: r##"Checks for the usage of negated comparison operators on types which only implement |
6332 | `PartialOrd` (e.g., `f64`)."##, | ||
6122 | }, | 6333 | }, |
6123 | Lint { | 6334 | Lint { |
6124 | label: "clippy::neg_multiply", | 6335 | label: "clippy::neg_multiply", |
@@ -6126,7 +6337,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6126 | }, | 6337 | }, |
6127 | Lint { | 6338 | Lint { |
6128 | label: "clippy::never_loop", | 6339 | label: "clippy::never_loop", |
6129 | description: r##"Checks for loops that will always `break`, `return` or\n`continue` an outer loop."##, | 6340 | description: r##"Checks for loops that will always `break`, `return` or |
6341 | `continue` an outer loop."##, | ||
6130 | }, | 6342 | }, |
6131 | Lint { | 6343 | Lint { |
6132 | label: "clippy::new_ret_no_self", | 6344 | label: "clippy::new_ret_no_self", |
@@ -6134,7 +6346,9 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6134 | }, | 6346 | }, |
6135 | Lint { | 6347 | Lint { |
6136 | label: "clippy::new_without_default", | 6348 | label: "clippy::new_without_default", |
6137 | description: r##"Checks for types with a `fn new() -> Self` method and no\nimplementation of\n[`Default`](https://doc.rust-lang.org/std/default/trait.Default.html)."##, | 6349 | description: r##"Checks for types with a `fn new() -> Self` method and no |
6350 | implementation of | ||
6351 | [`Default`](https://doc.rust-lang.org/std/default/trait.Default.html)."##, | ||
6138 | }, | 6352 | }, |
6139 | Lint { | 6353 | Lint { |
6140 | label: "clippy::no_effect", | 6354 | label: "clippy::no_effect", |
@@ -6150,20 +6364,25 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6150 | }, | 6364 | }, |
6151 | Lint { | 6365 | Lint { |
6152 | label: "clippy::nonminimal_bool", | 6366 | label: "clippy::nonminimal_bool", |
6153 | description: r##"Checks for boolean expressions that can be written more\nconcisely."##, | 6367 | description: r##"Checks for boolean expressions that can be written more |
6368 | concisely."##, | ||
6154 | }, | 6369 | }, |
6155 | Lint { | 6370 | Lint { |
6156 | label: "clippy::nonsensical_open_options", | 6371 | label: "clippy::nonsensical_open_options", |
6157 | description: r##"Checks for duplicate open options as well as combinations\nthat make no sense."##, | 6372 | description: r##"Checks for duplicate open options as well as combinations |
6373 | that make no sense."##, | ||
6158 | }, | 6374 | }, |
6159 | Lint { | 6375 | Lint { |
6160 | label: "clippy::not_unsafe_ptr_arg_deref", | 6376 | label: "clippy::not_unsafe_ptr_arg_deref", |
6161 | description: r##"Checks for public functions that dereference raw pointer\narguments but are not marked `unsafe`."##, | 6377 | description: r##"Checks for public functions that dereference raw pointer |
6378 | arguments but are not marked `unsafe`."##, | ||
6162 | }, | 6379 | }, |
6163 | Lint { label: "clippy::ok_expect", description: r##"Checks for usage of `ok().expect(..)`."## }, | 6380 | Lint { label: "clippy::ok_expect", description: r##"Checks for usage of `ok().expect(..)`."## }, |
6164 | Lint { | 6381 | Lint { |
6165 | label: "clippy::op_ref", | 6382 | label: "clippy::op_ref", |
6166 | description: r##"Checks for arguments to `==` which have their address\ntaken to satisfy a bound\nand suggests to dereference the other argument instead"##, | 6383 | description: r##"Checks for arguments to `==` which have their address |
6384 | taken to satisfy a bound | ||
6385 | and suggests to dereference the other argument instead"##, | ||
6167 | }, | 6386 | }, |
6168 | Lint { | 6387 | Lint { |
6169 | label: "clippy::option_as_ref_deref", | 6388 | label: "clippy::option_as_ref_deref", |
@@ -6171,7 +6390,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6171 | }, | 6390 | }, |
6172 | Lint { | 6391 | Lint { |
6173 | label: "clippy::option_env_unwrap", | 6392 | label: "clippy::option_env_unwrap", |
6174 | description: r##"Checks for usage of `option_env!(...).unwrap()` and\nsuggests usage of the `env!` macro."##, | 6393 | description: r##"Checks for usage of `option_env!(...).unwrap()` and |
6394 | suggests usage of the `env!` macro."##, | ||
6175 | }, | 6395 | }, |
6176 | Lint { | 6396 | Lint { |
6177 | label: "clippy::option_filter_map", | 6397 | label: "clippy::option_filter_map", |
@@ -6179,7 +6399,10 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6179 | }, | 6399 | }, |
6180 | Lint { | 6400 | Lint { |
6181 | label: "clippy::option_if_let_else", | 6401 | label: "clippy::option_if_let_else", |
6182 | description: r##"Lints usage of `if let Some(v) = ... { y } else { x }` which is more\nidiomatically done with `Option::map_or` (if the else bit is a pure\nexpression) or `Option::map_or_else` (if the else bit is an impure\nexpression)."##, | 6402 | description: r##"Lints usage of `if let Some(v) = ... { y } else { x }` which is more |
6403 | idiomatically done with `Option::map_or` (if the else bit is a pure | ||
6404 | expression) or `Option::map_or_else` (if the else bit is an impure | ||
6405 | expression)."##, | ||
6183 | }, | 6406 | }, |
6184 | Lint { | 6407 | Lint { |
6185 | label: "clippy::option_map_or_none", | 6408 | label: "clippy::option_map_or_none", |
@@ -6187,19 +6410,24 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6187 | }, | 6410 | }, |
6188 | Lint { | 6411 | Lint { |
6189 | label: "clippy::option_map_unit_fn", | 6412 | label: "clippy::option_map_unit_fn", |
6190 | description: r##"Checks for usage of `option.map(f)` where f is a function\nor closure that returns the unit type `()`."##, | 6413 | description: r##"Checks for usage of `option.map(f)` where f is a function |
6414 | or closure that returns the unit type `()`."##, | ||
6191 | }, | 6415 | }, |
6192 | Lint { | 6416 | Lint { |
6193 | label: "clippy::option_option", | 6417 | label: "clippy::option_option", |
6194 | description: r##"Checks for use of `Option<Option<_>>` in function signatures and type\ndefinitions"##, | 6418 | description: r##"Checks for use of `Option<Option<_>>` in function signatures and type |
6419 | definitions"##, | ||
6195 | }, | 6420 | }, |
6196 | Lint { | 6421 | Lint { |
6197 | label: "clippy::or_fun_call", | 6422 | label: "clippy::or_fun_call", |
6198 | description: r##"Checks for calls to `.or(foo(..))`, `.unwrap_or(foo(..))`,\netc., and suggests to use `or_else`, `unwrap_or_else`, etc., or\n`unwrap_or_default` instead."##, | 6423 | description: r##"Checks for calls to `.or(foo(..))`, `.unwrap_or(foo(..))`, |
6424 | etc., and suggests to use `or_else`, `unwrap_or_else`, etc., or | ||
6425 | `unwrap_or_default` instead."##, | ||
6199 | }, | 6426 | }, |
6200 | Lint { | 6427 | Lint { |
6201 | label: "clippy::out_of_bounds_indexing", | 6428 | label: "clippy::out_of_bounds_indexing", |
6202 | description: r##"Checks for out of bounds array indexing with a constant\nindex."##, | 6429 | description: r##"Checks for out of bounds array indexing with a constant |
6430 | index."##, | ||
6203 | }, | 6431 | }, |
6204 | Lint { | 6432 | Lint { |
6205 | label: "clippy::overflow_check_conditional", | 6433 | label: "clippy::overflow_check_conditional", |
@@ -6220,19 +6448,44 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6220 | }, | 6448 | }, |
6221 | Lint { | 6449 | Lint { |
6222 | label: "clippy::path_buf_push_overwrite", | 6450 | label: "clippy::path_buf_push_overwrite", |
6223 | description: r##"* Checks for [push](https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.push)\ncalls on `PathBuf` that can cause overwrites."##, | 6451 | description: r##"* Checks for [push](https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.push) |
6452 | calls on `PathBuf` that can cause overwrites."##, | ||
6224 | }, | 6453 | }, |
6225 | Lint { | 6454 | Lint { |
6226 | label: "clippy::pattern_type_mismatch", | 6455 | label: "clippy::pattern_type_mismatch", |
6227 | description: r##"Checks for patterns that aren't exact representations of the types\nthey are applied to.\n\nTo satisfy this lint, you will have to adjust either the expression that is matched\nagainst or the pattern itself, as well as the bindings that are introduced by the\nadjusted patterns. For matching you will have to either dereference the expression\nwith the `*` operator, or amend the patterns to explicitly match against `&<pattern>`\nor `&mut <pattern>` depending on the reference mutability. For the bindings you need\nto use the inverse. You can leave them as plain bindings if you wish for the value\nto be copied, but you must use `ref mut <variable>` or `ref <variable>` to construct\na reference into the matched structure.\n\nIf you are looking for a way to learn about ownership semantics in more detail, it\nis recommended to look at IDE options available to you to highlight types, lifetimes\nand reference semantics in your code. The available tooling would expose these things\nin a general way even outside of the various pattern matching mechanics. Of course\nthis lint can still be used to highlight areas of interest and ensure a good understanding\nof ownership semantics."##, | 6456 | description: r##"Checks for patterns that aren't exact representations of the types |
6457 | they are applied to. | ||
6458 | |||
6459 | To satisfy this lint, you will have to adjust either the expression that is matched | ||
6460 | against or the pattern itself, as well as the bindings that are introduced by the | ||
6461 | adjusted patterns. For matching you will have to either dereference the expression | ||
6462 | with the `*` operator, or amend the patterns to explicitly match against `&<pattern>` | ||
6463 | or `&mut <pattern>` depending on the reference mutability. For the bindings you need | ||
6464 | to use the inverse. You can leave them as plain bindings if you wish for the value | ||
6465 | to be copied, but you must use `ref mut <variable>` or `ref <variable>` to construct | ||
6466 | a reference into the matched structure. | ||
6467 | |||
6468 | If you are looking for a way to learn about ownership semantics in more detail, it | ||
6469 | is recommended to look at IDE options available to you to highlight types, lifetimes | ||
6470 | and reference semantics in your code. The available tooling would expose these things | ||
6471 | in a general way even outside of the various pattern matching mechanics. Of course | ||
6472 | this lint can still be used to highlight areas of interest and ensure a good understanding | ||
6473 | of ownership semantics."##, | ||
6228 | }, | 6474 | }, |
6229 | Lint { | 6475 | Lint { |
6230 | label: "clippy::possible_missing_comma", | 6476 | label: "clippy::possible_missing_comma", |
6231 | description: r##"Checks for possible missing comma in an array. It lints if\nan array element is a binary operator expression and it lies on two lines."##, | 6477 | description: r##"Checks for possible missing comma in an array. It lints if |
6478 | an array element is a binary operator expression and it lies on two lines."##, | ||
6232 | }, | 6479 | }, |
6233 | Lint { | 6480 | Lint { |
6234 | label: "clippy::precedence", | 6481 | label: "clippy::precedence", |
6235 | description: r##"Checks for operations where precedence may be unclear\nand suggests to add parentheses. Currently it catches the following:\n* mixed usage of arithmetic and bit shifting/combining operators without\nparentheses\n* a \"negative\" numeric literal (which is really a unary `-` followed by a\nnumeric literal)\n followed by a method call"##, | 6482 | description: r##"Checks for operations where precedence may be unclear |
6483 | and suggests to add parentheses. Currently it catches the following: | ||
6484 | * mixed usage of arithmetic and bit shifting/combining operators without | ||
6485 | parentheses | ||
6486 | * a negative numeric literal (which is really a unary `-` followed by a | ||
6487 | numeric literal) | ||
6488 | followed by a method call"##, | ||
6236 | }, | 6489 | }, |
6237 | Lint { | 6490 | Lint { |
6238 | label: "clippy::print_literal", | 6491 | label: "clippy::print_literal", |
@@ -6240,32 +6493,41 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6240 | }, | 6493 | }, |
6241 | Lint { | 6494 | Lint { |
6242 | label: "clippy::print_stderr", | 6495 | label: "clippy::print_stderr", |
6243 | description: r##"Checks for printing on *stderr*. The purpose of this lint\nis to catch debugging remnants."##, | 6496 | description: r##"Checks for printing on *stderr*. The purpose of this lint |
6497 | is to catch debugging remnants."##, | ||
6244 | }, | 6498 | }, |
6245 | Lint { | 6499 | Lint { |
6246 | label: "clippy::print_stdout", | 6500 | label: "clippy::print_stdout", |
6247 | description: r##"Checks for printing on *stdout*. The purpose of this lint\nis to catch debugging remnants."##, | 6501 | description: r##"Checks for printing on *stdout*. The purpose of this lint |
6502 | is to catch debugging remnants."##, | ||
6248 | }, | 6503 | }, |
6249 | Lint { | 6504 | Lint { |
6250 | label: "clippy::print_with_newline", | 6505 | label: "clippy::print_with_newline", |
6251 | description: r##"This lint warns when you use `print!()` with a format\nstring that ends in a newline."##, | 6506 | description: r##"This lint warns when you use `print!()` with a format |
6507 | string that ends in a newline."##, | ||
6252 | }, | 6508 | }, |
6253 | Lint { | 6509 | Lint { |
6254 | label: "clippy::println_empty_string", | 6510 | label: "clippy::println_empty_string", |
6255 | description: r##"This lint warns when you use `println!(\"\")` to\nprint a newline."##, | 6511 | description: r##"This lint warns when you use `println!()` to |
6512 | print a newline."##, | ||
6256 | }, | 6513 | }, |
6257 | Lint { | 6514 | Lint { |
6258 | label: "clippy::ptr_arg", | 6515 | label: "clippy::ptr_arg", |
6259 | description: r##"This lint checks for function arguments of type `&String`\nor `&Vec` unless the references are mutable. It will also suggest you\nreplace `.clone()` calls with the appropriate `.to_owned()`/`to_string()`\ncalls."##, | 6516 | description: r##"This lint checks for function arguments of type `&String` |
6517 | or `&Vec` unless the references are mutable. It will also suggest you | ||
6518 | replace `.clone()` calls with the appropriate `.to_owned()`/`to_string()` | ||
6519 | calls."##, | ||
6260 | }, | 6520 | }, |
6261 | Lint { | 6521 | Lint { |
6262 | label: "clippy::ptr_as_ptr", | 6522 | label: "clippy::ptr_as_ptr", |
6263 | description: r##"Checks for `as` casts between raw pointers without changing its mutability,\nnamely `*const T` to `*const U` and `*mut T` to `*mut U`."##, | 6523 | description: r##"Checks for `as` casts between raw pointers without changing its mutability, |
6524 | namely `*const T` to `*const U` and `*mut T` to `*mut U`."##, | ||
6264 | }, | 6525 | }, |
6265 | Lint { label: "clippy::ptr_eq", description: r##"Use `std::ptr::eq` when applicable"## }, | 6526 | Lint { label: "clippy::ptr_eq", description: r##"Use `std::ptr::eq` when applicable"## }, |
6266 | Lint { | 6527 | Lint { |
6267 | label: "clippy::ptr_offset_with_cast", | 6528 | label: "clippy::ptr_offset_with_cast", |
6268 | description: r##"Checks for usage of the `offset` pointer method with a `usize` casted to an\n`isize`."##, | 6529 | description: r##"Checks for usage of the `offset` pointer method with a `usize` casted to an |
6530 | `isize`."##, | ||
6269 | }, | 6531 | }, |
6270 | Lint { | 6532 | Lint { |
6271 | label: "clippy::pub_enum_variant_names", | 6533 | label: "clippy::pub_enum_variant_names", |
@@ -6277,11 +6539,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6277 | }, | 6539 | }, |
6278 | Lint { | 6540 | Lint { |
6279 | label: "clippy::range_minus_one", | 6541 | label: "clippy::range_minus_one", |
6280 | description: r##"Checks for inclusive ranges where 1 is subtracted from\nthe upper bound, e.g., `x..=(y-1)`."##, | 6542 | description: r##"Checks for inclusive ranges where 1 is subtracted from |
6543 | the upper bound, e.g., `x..=(y-1)`."##, | ||
6281 | }, | 6544 | }, |
6282 | Lint { | 6545 | Lint { |
6283 | label: "clippy::range_plus_one", | 6546 | label: "clippy::range_plus_one", |
6284 | description: r##"Checks for exclusive ranges where 1 is added to the\nupper bound, e.g., `x..(y+1)`."##, | 6547 | description: r##"Checks for exclusive ranges where 1 is added to the |
6548 | upper bound, e.g., `x..(y+1)`."##, | ||
6285 | }, | 6549 | }, |
6286 | Lint { | 6550 | Lint { |
6287 | label: "clippy::range_step_by_zero", | 6551 | label: "clippy::range_step_by_zero", |
@@ -6289,7 +6553,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6289 | }, | 6553 | }, |
6290 | Lint { | 6554 | Lint { |
6291 | label: "clippy::range_zip_with_len", | 6555 | label: "clippy::range_zip_with_len", |
6292 | description: r##"Checks for zipping a collection with the range of\n`0.._.len()`."##, | 6556 | description: r##"Checks for zipping a collection with the range of |
6557 | `0.._.len()`."##, | ||
6293 | }, | 6558 | }, |
6294 | Lint { | 6559 | Lint { |
6295 | label: "clippy::rc_buffer", | 6560 | label: "clippy::rc_buffer", |
@@ -6301,19 +6566,24 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6301 | }, | 6566 | }, |
6302 | Lint { | 6567 | Lint { |
6303 | label: "clippy::redundant_clone", | 6568 | label: "clippy::redundant_clone", |
6304 | description: r##"Checks for a redundant `clone()` (and its relatives) which clones an owned\nvalue that is going to be dropped without further use."##, | 6569 | description: r##"Checks for a redundant `clone()` (and its relatives) which clones an owned |
6570 | value that is going to be dropped without further use."##, | ||
6305 | }, | 6571 | }, |
6306 | Lint { | 6572 | Lint { |
6307 | label: "clippy::redundant_closure", | 6573 | label: "clippy::redundant_closure", |
6308 | description: r##"Checks for closures which just call another function where\nthe function can be called directly. `unsafe` functions or calls where types\nget adjusted are ignored."##, | 6574 | description: r##"Checks for closures which just call another function where |
6575 | the function can be called directly. `unsafe` functions or calls where types | ||
6576 | get adjusted are ignored."##, | ||
6309 | }, | 6577 | }, |
6310 | Lint { | 6578 | Lint { |
6311 | label: "clippy::redundant_closure_call", | 6579 | label: "clippy::redundant_closure_call", |
6312 | description: r##"Detects closures called in the same expression where they\nare defined."##, | 6580 | description: r##"Detects closures called in the same expression where they |
6581 | are defined."##, | ||
6313 | }, | 6582 | }, |
6314 | Lint { | 6583 | Lint { |
6315 | label: "clippy::redundant_closure_for_method_calls", | 6584 | label: "clippy::redundant_closure_for_method_calls", |
6316 | description: r##"Checks for closures which only invoke a method on the closure\nargument and can be replaced by referencing the method directly."##, | 6585 | description: r##"Checks for closures which only invoke a method on the closure |
6586 | argument and can be replaced by referencing the method directly."##, | ||
6317 | }, | 6587 | }, |
6318 | Lint { | 6588 | Lint { |
6319 | label: "clippy::redundant_else", | 6589 | label: "clippy::redundant_else", |
@@ -6321,7 +6591,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6321 | }, | 6591 | }, |
6322 | Lint { | 6592 | Lint { |
6323 | label: "clippy::redundant_field_names", | 6593 | label: "clippy::redundant_field_names", |
6324 | description: r##"Checks for fields in struct literals where shorthands\ncould be used."##, | 6594 | description: r##"Checks for fields in struct literals where shorthands |
6595 | could be used."##, | ||
6325 | }, | 6596 | }, |
6326 | Lint { | 6597 | Lint { |
6327 | label: "clippy::redundant_pattern", | 6598 | label: "clippy::redundant_pattern", |
@@ -6329,15 +6600,18 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6329 | }, | 6600 | }, |
6330 | Lint { | 6601 | Lint { |
6331 | label: "clippy::redundant_pattern_matching", | 6602 | label: "clippy::redundant_pattern_matching", |
6332 | description: r##"Lint for redundant pattern matching over `Result`, `Option`,\n`std::task::Poll` or `std::net::IpAddr`"##, | 6603 | description: r##"Lint for redundant pattern matching over `Result`, `Option`, |
6604 | `std::task::Poll` or `std::net::IpAddr`"##, | ||
6333 | }, | 6605 | }, |
6334 | Lint { | 6606 | Lint { |
6335 | label: "clippy::redundant_pub_crate", | 6607 | label: "clippy::redundant_pub_crate", |
6336 | description: r##"Checks for items declared `pub(crate)` that are not crate visible because they\nare inside a private module."##, | 6608 | description: r##"Checks for items declared `pub(crate)` that are not crate visible because they |
6609 | are inside a private module."##, | ||
6337 | }, | 6610 | }, |
6338 | Lint { | 6611 | Lint { |
6339 | label: "clippy::redundant_slicing", | 6612 | label: "clippy::redundant_slicing", |
6340 | description: r##"Checks for redundant slicing expressions which use the full range, and\ndo not change the type."##, | 6613 | description: r##"Checks for redundant slicing expressions which use the full range, and |
6614 | do not change the type."##, | ||
6341 | }, | 6615 | }, |
6342 | Lint { | 6616 | Lint { |
6343 | label: "clippy::redundant_static_lifetimes", | 6617 | label: "clippy::redundant_static_lifetimes", |
@@ -6349,7 +6623,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6349 | }, | 6623 | }, |
6350 | Lint { | 6624 | Lint { |
6351 | label: "clippy::ref_in_deref", | 6625 | label: "clippy::ref_in_deref", |
6352 | description: r##"Checks for references in expressions that use\nauto dereference."##, | 6626 | description: r##"Checks for references in expressions that use |
6627 | auto dereference."##, | ||
6353 | }, | 6628 | }, |
6354 | Lint { | 6629 | Lint { |
6355 | label: "clippy::ref_option_ref", | 6630 | label: "clippy::ref_option_ref", |
@@ -6361,7 +6636,10 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6361 | }, | 6636 | }, |
6362 | Lint { | 6637 | Lint { |
6363 | label: "clippy::repeat_once", | 6638 | label: "clippy::repeat_once", |
6364 | description: r##"Checks for usage of `.repeat(1)` and suggest the following method for each types.\n- `.to_string()` for `str`\n- `.clone()` for `String`\n- `.to_vec()` for `slice`"##, | 6639 | description: r##"Checks for usage of `.repeat(1)` and suggest the following method for each types. |
6640 | - `.to_string()` for `str` | ||
6641 | - `.clone()` for `String` | ||
6642 | - `.to_vec()` for `slice`"##, | ||
6365 | }, | 6643 | }, |
6366 | Lint { | 6644 | Lint { |
6367 | label: "clippy::replace_consts", | 6645 | label: "clippy::replace_consts", |
@@ -6377,15 +6655,19 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6377 | }, | 6655 | }, |
6378 | Lint { | 6656 | Lint { |
6379 | label: "clippy::result_map_unit_fn", | 6657 | label: "clippy::result_map_unit_fn", |
6380 | description: r##"Checks for usage of `result.map(f)` where f is a function\nor closure that returns the unit type `()`."##, | 6658 | description: r##"Checks for usage of `result.map(f)` where f is a function |
6659 | or closure that returns the unit type `()`."##, | ||
6381 | }, | 6660 | }, |
6382 | Lint { | 6661 | Lint { |
6383 | label: "clippy::result_unit_err", | 6662 | label: "clippy::result_unit_err", |
6384 | description: r##"Checks for public functions that return a `Result`\nwith an `Err` type of `()`. It suggests using a custom type that\nimplements `std::error::Error`."##, | 6663 | description: r##"Checks for public functions that return a `Result` |
6664 | with an `Err` type of `()`. It suggests using a custom type that | ||
6665 | implements `std::error::Error`."##, | ||
6385 | }, | 6666 | }, |
6386 | Lint { | 6667 | Lint { |
6387 | label: "clippy::reversed_empty_ranges", | 6668 | label: "clippy::reversed_empty_ranges", |
6388 | description: r##"Checks for range expressions `x..y` where both `x` and `y`\nare constant and `x` is greater or equal to `y`."##, | 6669 | description: r##"Checks for range expressions `x..y` where both `x` and `y` |
6670 | are constant and `x` is greater or equal to `y`."##, | ||
6389 | }, | 6671 | }, |
6390 | Lint { | 6672 | Lint { |
6391 | label: "clippy::same_functions_in_if_condition", | 6673 | label: "clippy::same_functions_in_if_condition", |
@@ -6393,11 +6675,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6393 | }, | 6675 | }, |
6394 | Lint { | 6676 | Lint { |
6395 | label: "clippy::same_item_push", | 6677 | label: "clippy::same_item_push", |
6396 | description: r##"Checks whether a for loop is being used to push a constant\nvalue into a Vec."##, | 6678 | description: r##"Checks whether a for loop is being used to push a constant |
6679 | value into a Vec."##, | ||
6397 | }, | 6680 | }, |
6398 | Lint { | 6681 | Lint { |
6399 | label: "clippy::search_is_some", | 6682 | label: "clippy::search_is_some", |
6400 | description: r##"Checks for an iterator or string search (such as `find()`,\n`position()`, or `rposition()`) followed by a call to `is_some()` or `is_none()`."##, | 6683 | description: r##"Checks for an iterator or string search (such as `find()`, |
6684 | `position()`, or `rposition()`) followed by a call to `is_some()` or `is_none()`."##, | ||
6401 | }, | 6685 | }, |
6402 | Lint { | 6686 | Lint { |
6403 | label: "clippy::self_assignment", | 6687 | label: "clippy::self_assignment", |
@@ -6405,7 +6689,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6405 | }, | 6689 | }, |
6406 | Lint { | 6690 | Lint { |
6407 | label: "clippy::semicolon_if_nothing_returned", | 6691 | label: "clippy::semicolon_if_nothing_returned", |
6408 | description: r##"Looks for blocks of expressions and fires if the last expression returns\n`()` but is not followed by a semicolon."##, | 6692 | description: r##"Looks for blocks of expressions and fires if the last expression returns |
6693 | `()` but is not followed by a semicolon."##, | ||
6409 | }, | 6694 | }, |
6410 | Lint { | 6695 | Lint { |
6411 | label: "clippy::serde_api_misuse", | 6696 | label: "clippy::serde_api_misuse", |
@@ -6413,19 +6698,25 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6413 | }, | 6698 | }, |
6414 | Lint { | 6699 | Lint { |
6415 | label: "clippy::shadow_reuse", | 6700 | label: "clippy::shadow_reuse", |
6416 | description: r##"Checks for bindings that shadow other bindings already in\nscope, while reusing the original value."##, | 6701 | description: r##"Checks for bindings that shadow other bindings already in |
6702 | scope, while reusing the original value."##, | ||
6417 | }, | 6703 | }, |
6418 | Lint { | 6704 | Lint { |
6419 | label: "clippy::shadow_same", | 6705 | label: "clippy::shadow_same", |
6420 | description: r##"Checks for bindings that shadow other bindings already in\nscope, while just changing reference level or mutability."##, | 6706 | description: r##"Checks for bindings that shadow other bindings already in |
6707 | scope, while just changing reference level or mutability."##, | ||
6421 | }, | 6708 | }, |
6422 | Lint { | 6709 | Lint { |
6423 | label: "clippy::shadow_unrelated", | 6710 | label: "clippy::shadow_unrelated", |
6424 | description: r##"Checks for bindings that shadow other bindings already in\nscope, either without a initialization or with one that does not even use\nthe original value."##, | 6711 | description: r##"Checks for bindings that shadow other bindings already in |
6712 | scope, either without a initialization or with one that does not even use | ||
6713 | the original value."##, | ||
6425 | }, | 6714 | }, |
6426 | Lint { | 6715 | Lint { |
6427 | label: "clippy::short_circuit_statement", | 6716 | label: "clippy::short_circuit_statement", |
6428 | description: r##"Checks for the use of short circuit boolean conditions as\na\nstatement."##, | 6717 | description: r##"Checks for the use of short circuit boolean conditions as |
6718 | a | ||
6719 | statement."##, | ||
6429 | }, | 6720 | }, |
6430 | Lint { | 6721 | Lint { |
6431 | label: "clippy::should_assert_eq", | 6722 | label: "clippy::should_assert_eq", |
@@ -6433,7 +6724,10 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6433 | }, | 6724 | }, |
6434 | Lint { | 6725 | Lint { |
6435 | label: "clippy::should_implement_trait", | 6726 | label: "clippy::should_implement_trait", |
6436 | description: r##"Checks for methods that should live in a trait\nimplementation of a `std` trait (see [llogiq's blog\npost](http://llogiq.github.io/2015/07/30/traits.html) for further\ninformation) instead of an inherent implementation."##, | 6727 | description: r##"Checks for methods that should live in a trait |
6728 | implementation of a `std` trait (see [llogiq's blog | ||
6729 | post](http://llogiq.github.io/2015/07/30/traits.html) for further | ||
6730 | information) instead of an inherent implementation."##, | ||
6437 | }, | 6731 | }, |
6438 | Lint { | 6732 | Lint { |
6439 | label: "clippy::similar_names", | 6733 | label: "clippy::similar_names", |
@@ -6441,11 +6735,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6441 | }, | 6735 | }, |
6442 | Lint { | 6736 | Lint { |
6443 | label: "clippy::single_char_add_str", | 6737 | label: "clippy::single_char_add_str", |
6444 | description: r##"Warns when using `push_str`/`insert_str` with a single-character string literal\nwhere `push`/`insert` with a `char` would work fine."##, | 6738 | description: r##"Warns when using `push_str`/`insert_str` with a single-character string literal |
6739 | where `push`/`insert` with a `char` would work fine."##, | ||
6445 | }, | 6740 | }, |
6446 | Lint { | 6741 | Lint { |
6447 | label: "clippy::single_char_pattern", | 6742 | label: "clippy::single_char_pattern", |
6448 | description: r##"Checks for string methods that receive a single-character\n`str` as an argument, e.g., `_.split(\"x\")`."##, | 6743 | description: r##"Checks for string methods that receive a single-character |
6744 | `str` as an argument, e.g., `_.split(x)`."##, | ||
6449 | }, | 6745 | }, |
6450 | Lint { | 6746 | Lint { |
6451 | label: "clippy::single_component_path_imports", | 6747 | label: "clippy::single_component_path_imports", |
@@ -6457,15 +6753,19 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6457 | }, | 6753 | }, |
6458 | Lint { | 6754 | Lint { |
6459 | label: "clippy::single_match", | 6755 | label: "clippy::single_match", |
6460 | description: r##"Checks for matches with a single arm where an `if let`\nwill usually suffice."##, | 6756 | description: r##"Checks for matches with a single arm where an `if let` |
6757 | will usually suffice."##, | ||
6461 | }, | 6758 | }, |
6462 | Lint { | 6759 | Lint { |
6463 | label: "clippy::single_match_else", | 6760 | label: "clippy::single_match_else", |
6464 | description: r##"Checks for matches with two arms where an `if let else` will\nusually suffice."##, | 6761 | description: r##"Checks for matches with two arms where an `if let else` will |
6762 | usually suffice."##, | ||
6465 | }, | 6763 | }, |
6466 | Lint { | 6764 | Lint { |
6467 | label: "clippy::size_of_in_element_count", | 6765 | label: "clippy::size_of_in_element_count", |
6468 | description: r##"Detects expressions where\n`size_of::<T>` or `size_of_val::<T>` is used as a\ncount of elements of type `T`"##, | 6766 | description: r##"Detects expressions where |
6767 | `size_of::<T>` or `size_of_val::<T>` is used as a | ||
6768 | count of elements of type `T`"##, | ||
6469 | }, | 6769 | }, |
6470 | Lint { | 6770 | Lint { |
6471 | label: "clippy::skip_while_next", | 6771 | label: "clippy::skip_while_next", |
@@ -6477,7 +6777,9 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6477 | }, | 6777 | }, |
6478 | Lint { | 6778 | Lint { |
6479 | label: "clippy::stable_sort_primitive", | 6779 | label: "clippy::stable_sort_primitive", |
6480 | description: r##"When sorting primitive values (integers, bools, chars, as well\nas arrays, slices, and tuples of such items), it is better to\nuse an unstable sort than a stable sort."##, | 6780 | description: r##"When sorting primitive values (integers, bools, chars, as well |
6781 | as arrays, slices, and tuples of such items), it is better to | ||
6782 | use an unstable sort than a stable sort."##, | ||
6481 | }, | 6783 | }, |
6482 | Lint { | 6784 | Lint { |
6483 | label: "clippy::str_to_string", | 6785 | label: "clippy::str_to_string", |
@@ -6485,15 +6787,19 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6485 | }, | 6787 | }, |
6486 | Lint { | 6788 | Lint { |
6487 | label: "clippy::string_add", | 6789 | label: "clippy::string_add", |
6488 | description: r##"Checks for all instances of `x + _` where `x` is of type\n`String`, but only if [`string_add_assign`](#string_add_assign) does *not*\nmatch."##, | 6790 | description: r##"Checks for all instances of `x + _` where `x` is of type |
6791 | `String`, but only if [`string_add_assign`](#string_add_assign) does *not* | ||
6792 | match."##, | ||
6489 | }, | 6793 | }, |
6490 | Lint { | 6794 | Lint { |
6491 | label: "clippy::string_add_assign", | 6795 | label: "clippy::string_add_assign", |
6492 | description: r##"Checks for string appends of the form `x = x + y` (without\n`let`!)."##, | 6796 | description: r##"Checks for string appends of the form `x = x + y` (without |
6797 | `let`!)."##, | ||
6493 | }, | 6798 | }, |
6494 | Lint { | 6799 | Lint { |
6495 | label: "clippy::string_extend_chars", | 6800 | label: "clippy::string_extend_chars", |
6496 | description: r##"Checks for the use of `.extend(s.chars())` where s is a\n`&str` or `String`."##, | 6801 | description: r##"Checks for the use of `.extend(s.chars())` where s is a |
6802 | `&str` or `String`."##, | ||
6497 | }, | 6803 | }, |
6498 | Lint { | 6804 | Lint { |
6499 | label: "clippy::string_from_utf8_as_bytes", | 6805 | label: "clippy::string_from_utf8_as_bytes", |
@@ -6501,7 +6807,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6501 | }, | 6807 | }, |
6502 | Lint { | 6808 | Lint { |
6503 | label: "clippy::string_lit_as_bytes", | 6809 | label: "clippy::string_lit_as_bytes", |
6504 | description: r##"Checks for the `as_bytes` method called on string literals\nthat contain only ASCII characters."##, | 6810 | description: r##"Checks for the `as_bytes` method called on string literals |
6811 | that contain only ASCII characters."##, | ||
6505 | }, | 6812 | }, |
6506 | Lint { | 6813 | Lint { |
6507 | label: "clippy::string_to_string", | 6814 | label: "clippy::string_to_string", |
@@ -6509,23 +6816,29 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6509 | }, | 6816 | }, |
6510 | Lint { | 6817 | Lint { |
6511 | label: "clippy::struct_excessive_bools", | 6818 | label: "clippy::struct_excessive_bools", |
6512 | description: r##"Checks for excessive\nuse of bools in structs."##, | 6819 | description: r##"Checks for excessive |
6820 | use of bools in structs."##, | ||
6513 | }, | 6821 | }, |
6514 | Lint { | 6822 | Lint { |
6515 | label: "clippy::suboptimal_flops", | 6823 | label: "clippy::suboptimal_flops", |
6516 | description: r##"Looks for floating-point expressions that\ncan be expressed using built-in methods to improve both\naccuracy and performance."##, | 6824 | description: r##"Looks for floating-point expressions that |
6825 | can be expressed using built-in methods to improve both | ||
6826 | accuracy and performance."##, | ||
6517 | }, | 6827 | }, |
6518 | Lint { | 6828 | Lint { |
6519 | label: "clippy::suspicious_arithmetic_impl", | 6829 | label: "clippy::suspicious_arithmetic_impl", |
6520 | description: r##"Lints for suspicious operations in impls of arithmetic operators, e.g.\nsubtracting elements in an Add impl."##, | 6830 | description: r##"Lints for suspicious operations in impls of arithmetic operators, e.g. |
6831 | subtracting elements in an Add impl."##, | ||
6521 | }, | 6832 | }, |
6522 | Lint { | 6833 | Lint { |
6523 | label: "clippy::suspicious_assignment_formatting", | 6834 | label: "clippy::suspicious_assignment_formatting", |
6524 | description: r##"Checks for use of the non-existent `=*`, `=!` and `=-`\noperators."##, | 6835 | description: r##"Checks for use of the non-existent `=*`, `=!` and `=-` |
6836 | operators."##, | ||
6525 | }, | 6837 | }, |
6526 | Lint { | 6838 | Lint { |
6527 | label: "clippy::suspicious_else_formatting", | 6839 | label: "clippy::suspicious_else_formatting", |
6528 | description: r##"Checks for formatting of `else`. It lints if the `else`\nis followed immediately by a newline or the `else` seems to be missing."##, | 6840 | description: r##"Checks for formatting of `else`. It lints if the `else` |
6841 | is followed immediately by a newline or the `else` seems to be missing."##, | ||
6529 | }, | 6842 | }, |
6530 | Lint { | 6843 | Lint { |
6531 | label: "clippy::suspicious_map", | 6844 | label: "clippy::suspicious_map", |
@@ -6533,19 +6846,26 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6533 | }, | 6846 | }, |
6534 | Lint { | 6847 | Lint { |
6535 | label: "clippy::suspicious_op_assign_impl", | 6848 | label: "clippy::suspicious_op_assign_impl", |
6536 | description: r##"Lints for suspicious operations in impls of OpAssign, e.g.\nsubtracting elements in an AddAssign impl."##, | 6849 | description: r##"Lints for suspicious operations in impls of OpAssign, e.g. |
6850 | subtracting elements in an AddAssign impl."##, | ||
6537 | }, | 6851 | }, |
6538 | Lint { | 6852 | Lint { |
6539 | label: "clippy::suspicious_operation_groupings", | 6853 | label: "clippy::suspicious_operation_groupings", |
6540 | description: r##"Checks for unlikely usages of binary operators that are almost\ncertainly typos and/or copy/paste errors, given the other usages\nof binary operators nearby."##, | 6854 | description: r##"Checks for unlikely usages of binary operators that are almost |
6855 | certainly typos and/or copy/paste errors, given the other usages | ||
6856 | of binary operators nearby."##, | ||
6541 | }, | 6857 | }, |
6542 | Lint { | 6858 | Lint { |
6543 | label: "clippy::suspicious_splitn", | 6859 | label: "clippy::suspicious_splitn", |
6544 | description: r##"Checks for calls to [`splitn`]\n(https://doc.rust-lang.org/std/primitive.str.html#method.splitn) and\nrelated functions with either zero or one splits."##, | 6860 | description: r##"Checks for calls to [`splitn`] |
6861 | (https://doc.rust-lang.org/std/primitive.str.html#method.splitn) and | ||
6862 | related functions with either zero or one splits."##, | ||
6545 | }, | 6863 | }, |
6546 | Lint { | 6864 | Lint { |
6547 | label: "clippy::suspicious_unary_op_formatting", | 6865 | label: "clippy::suspicious_unary_op_formatting", |
6548 | description: r##"Checks the formatting of a unary operator on the right hand side\nof a binary operator. It lints if there is no space between the binary and unary operators,\nbut there is a space between the unary and its operand."##, | 6866 | description: r##"Checks the formatting of a unary operator on the right hand side |
6867 | of a binary operator. It lints if there is no space between the binary and unary operators, | ||
6868 | but there is a space between the unary and its operand."##, | ||
6549 | }, | 6869 | }, |
6550 | Lint { | 6870 | Lint { |
6551 | label: "clippy::tabs_in_doc_comments", | 6871 | label: "clippy::tabs_in_doc_comments", |
@@ -6553,7 +6873,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6553 | }, | 6873 | }, |
6554 | Lint { | 6874 | Lint { |
6555 | label: "clippy::temporary_assignment", | 6875 | label: "clippy::temporary_assignment", |
6556 | description: r##"Checks for construction of a structure or tuple just to\nassign a value in it."##, | 6876 | description: r##"Checks for construction of a structure or tuple just to |
6877 | assign a value in it."##, | ||
6557 | }, | 6878 | }, |
6558 | Lint { | 6879 | Lint { |
6559 | label: "clippy::to_digit_is_some", | 6880 | label: "clippy::to_digit_is_some", |
@@ -6574,11 +6895,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6574 | }, | 6895 | }, |
6575 | Lint { | 6896 | Lint { |
6576 | label: "clippy::toplevel_ref_arg", | 6897 | label: "clippy::toplevel_ref_arg", |
6577 | description: r##"Checks for function arguments and let bindings denoted as\n`ref`."##, | 6898 | description: r##"Checks for function arguments and let bindings denoted as |
6899 | `ref`."##, | ||
6578 | }, | 6900 | }, |
6579 | Lint { | 6901 | Lint { |
6580 | label: "clippy::trait_duplication_in_bounds", | 6902 | label: "clippy::trait_duplication_in_bounds", |
6581 | description: r##"Checks for cases where generics are being used and multiple\nsyntax specifications for trait bounds are used simultaneously."##, | 6903 | description: r##"Checks for cases where generics are being used and multiple |
6904 | syntax specifications for trait bounds are used simultaneously."##, | ||
6582 | }, | 6905 | }, |
6583 | Lint { | 6906 | Lint { |
6584 | label: "clippy::transmute_bytes_to_str", | 6907 | label: "clippy::transmute_bytes_to_str", |
@@ -6602,7 +6925,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6602 | }, | 6925 | }, |
6603 | Lint { | 6926 | Lint { |
6604 | label: "clippy::transmute_ptr_to_ptr", | 6927 | label: "clippy::transmute_ptr_to_ptr", |
6605 | description: r##"Checks for transmutes from a pointer to a pointer, or\nfrom a reference to a reference."##, | 6928 | description: r##"Checks for transmutes from a pointer to a pointer, or |
6929 | from a reference to a reference."##, | ||
6606 | }, | 6930 | }, |
6607 | Lint { | 6931 | Lint { |
6608 | label: "clippy::transmute_ptr_to_ref", | 6932 | label: "clippy::transmute_ptr_to_ref", |
@@ -6618,16 +6942,20 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6618 | }, | 6942 | }, |
6619 | Lint { | 6943 | Lint { |
6620 | label: "clippy::trivial_regex", | 6944 | label: "clippy::trivial_regex", |
6621 | description: r##"Checks for trivial [regex](https://crates.io/crates/regex)\ncreation (with `Regex::new`, `RegexBuilder::new`, or `RegexSet::new`)."##, | 6945 | description: r##"Checks for trivial [regex](https://crates.io/crates/regex) |
6946 | creation (with `Regex::new`, `RegexBuilder::new`, or `RegexSet::new`)."##, | ||
6622 | }, | 6947 | }, |
6623 | Lint { | 6948 | Lint { |
6624 | label: "clippy::trivially_copy_pass_by_ref", | 6949 | label: "clippy::trivially_copy_pass_by_ref", |
6625 | description: r##"Checks for functions taking arguments by reference, where\nthe argument type is `Copy` and small enough to be more efficient to always\npass by value."##, | 6950 | description: r##"Checks for functions taking arguments by reference, where |
6951 | the argument type is `Copy` and small enough to be more efficient to always | ||
6952 | pass by value."##, | ||
6626 | }, | 6953 | }, |
6627 | Lint { label: "clippy::try_err", description: r##"Checks for usages of `Err(x)?`."## }, | 6954 | Lint { label: "clippy::try_err", description: r##"Checks for usages of `Err(x)?`."## }, |
6628 | Lint { | 6955 | Lint { |
6629 | label: "clippy::type_complexity", | 6956 | label: "clippy::type_complexity", |
6630 | description: r##"Checks for types used in structs, parameters and `let`\ndeclarations above a certain complexity threshold."##, | 6957 | description: r##"Checks for types used in structs, parameters and `let` |
6958 | declarations above a certain complexity threshold."##, | ||
6631 | }, | 6959 | }, |
6632 | Lint { | 6960 | Lint { |
6633 | label: "clippy::type_repetition_in_bounds", | 6961 | label: "clippy::type_repetition_in_bounds", |
@@ -6639,7 +6967,9 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6639 | }, | 6967 | }, |
6640 | Lint { | 6968 | Lint { |
6641 | label: "clippy::unicode_not_nfc", | 6969 | label: "clippy::unicode_not_nfc", |
6642 | description: r##"Checks for string literals that contain Unicode in a form\nthat is not equal to its\n[NFC-recomposition](http://www.unicode.org/reports/tr15/#Norm_Forms)."##, | 6970 | description: r##"Checks for string literals that contain Unicode in a form |
6971 | that is not equal to its | ||
6972 | [NFC-recomposition](http://www.unicode.org/reports/tr15/#Norm_Forms)."##, | ||
6643 | }, | 6973 | }, |
6644 | Lint { | 6974 | Lint { |
6645 | label: "clippy::unimplemented", | 6975 | label: "clippy::unimplemented", |
@@ -6651,39 +6981,59 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6651 | }, | 6981 | }, |
6652 | Lint { | 6982 | Lint { |
6653 | label: "clippy::unit_arg", | 6983 | label: "clippy::unit_arg", |
6654 | description: r##"Checks for passing a unit value as an argument to a function without using a\nunit literal (`()`)."##, | 6984 | description: r##"Checks for passing a unit value as an argument to a function without using a |
6985 | unit literal (`()`)."##, | ||
6655 | }, | 6986 | }, |
6656 | Lint { | 6987 | Lint { |
6657 | label: "clippy::unit_cmp", | 6988 | label: "clippy::unit_cmp", |
6658 | description: r##"Checks for comparisons to unit. This includes all binary\ncomparisons (like `==` and `<`) and asserts."##, | 6989 | description: r##"Checks for comparisons to unit. This includes all binary |
6990 | comparisons (like `==` and `<`) and asserts."##, | ||
6659 | }, | 6991 | }, |
6660 | Lint { | 6992 | Lint { |
6661 | label: "clippy::unit_return_expecting_ord", | 6993 | label: "clippy::unit_return_expecting_ord", |
6662 | description: r##"Checks for functions that expect closures of type\nFn(...) -> Ord where the implemented closure returns the unit type.\nThe lint also suggests to remove the semi-colon at the end of the statement if present."##, | 6994 | description: r##"Checks for functions that expect closures of type |
6995 | Fn(...) -> Ord where the implemented closure returns the unit type. | ||
6996 | The lint also suggests to remove the semi-colon at the end of the statement if present."##, | ||
6663 | }, | 6997 | }, |
6664 | Lint { | 6998 | Lint { |
6665 | label: "clippy::unnecessary_cast", | 6999 | label: "clippy::unnecessary_cast", |
6666 | description: r##"Checks for casts to the same type, casts of int literals to integer types\nand casts of float literals to float types."##, | 7000 | description: r##"Checks for casts to the same type, casts of int literals to integer types |
7001 | and casts of float literals to float types."##, | ||
6667 | }, | 7002 | }, |
6668 | Lint { | 7003 | Lint { |
6669 | label: "clippy::unnecessary_filter_map", | 7004 | label: "clippy::unnecessary_filter_map", |
6670 | description: r##"Checks for `filter_map` calls which could be replaced by `filter` or `map`.\nMore specifically it checks if the closure provided is only performing one of the\nfilter or map operations and suggests the appropriate option."##, | 7005 | description: r##"Checks for `filter_map` calls which could be replaced by `filter` or `map`. |
7006 | More specifically it checks if the closure provided is only performing one of the | ||
7007 | filter or map operations and suggests the appropriate option."##, | ||
6671 | }, | 7008 | }, |
6672 | Lint { | 7009 | Lint { |
6673 | label: "clippy::unnecessary_fold", | 7010 | label: "clippy::unnecessary_fold", |
6674 | description: r##"Checks for using `fold` when a more succinct alternative exists.\nSpecifically, this checks for `fold`s which could be replaced by `any`, `all`,\n`sum` or `product`."##, | 7011 | description: r##"Checks for using `fold` when a more succinct alternative exists. |
7012 | Specifically, this checks for `fold`s which could be replaced by `any`, `all`, | ||
7013 | `sum` or `product`."##, | ||
6675 | }, | 7014 | }, |
6676 | Lint { | 7015 | Lint { |
6677 | label: "clippy::unnecessary_lazy_evaluations", | 7016 | label: "clippy::unnecessary_lazy_evaluations", |
6678 | description: r##"As the counterpart to `or_fun_call`, this lint looks for unnecessary\nlazily evaluated closures on `Option` and `Result`.\n\nThis lint suggests changing the following functions, when eager evaluation results in\nsimpler code:\n - `unwrap_or_else` to `unwrap_or`\n - `and_then` to `and`\n - `or_else` to `or`\n - `get_or_insert_with` to `get_or_insert`\n - `ok_or_else` to `ok_or`"##, | 7017 | description: r##"As the counterpart to `or_fun_call`, this lint looks for unnecessary |
7018 | lazily evaluated closures on `Option` and `Result`. | ||
7019 | |||
7020 | This lint suggests changing the following functions, when eager evaluation results in | ||
7021 | simpler code: | ||
7022 | - `unwrap_or_else` to `unwrap_or` | ||
7023 | - `and_then` to `and` | ||
7024 | - `or_else` to `or` | ||
7025 | - `get_or_insert_with` to `get_or_insert` | ||
7026 | - `ok_or_else` to `ok_or`"##, | ||
6679 | }, | 7027 | }, |
6680 | Lint { | 7028 | Lint { |
6681 | label: "clippy::unnecessary_mut_passed", | 7029 | label: "clippy::unnecessary_mut_passed", |
6682 | description: r##"Detects passing a mutable reference to a function that only\nrequires an immutable reference."##, | 7030 | description: r##"Detects passing a mutable reference to a function that only |
7031 | requires an immutable reference."##, | ||
6683 | }, | 7032 | }, |
6684 | Lint { | 7033 | Lint { |
6685 | label: "clippy::unnecessary_operation", | 7034 | label: "clippy::unnecessary_operation", |
6686 | description: r##"Checks for expression statements that can be reduced to a\nsub-expression."##, | 7035 | description: r##"Checks for expression statements that can be reduced to a |
7036 | sub-expression."##, | ||
6687 | }, | 7037 | }, |
6688 | Lint { | 7038 | Lint { |
6689 | label: "clippy::unnecessary_self_imports", | 7039 | label: "clippy::unnecessary_self_imports", |
@@ -6691,7 +7041,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6691 | }, | 7041 | }, |
6692 | Lint { | 7042 | Lint { |
6693 | label: "clippy::unnecessary_sort_by", | 7043 | label: "clippy::unnecessary_sort_by", |
6694 | description: r##"Detects uses of `Vec::sort_by` passing in a closure\nwhich compares the two arguments, either directly or indirectly."##, | 7044 | description: r##"Detects uses of `Vec::sort_by` passing in a closure |
7045 | which compares the two arguments, either directly or indirectly."##, | ||
6695 | }, | 7046 | }, |
6696 | Lint { | 7047 | Lint { |
6697 | label: "clippy::unnecessary_unwrap", | 7048 | label: "clippy::unnecessary_unwrap", |
@@ -6707,24 +7058,37 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6707 | }, | 7058 | }, |
6708 | Lint { | 7059 | Lint { |
6709 | label: "clippy::unneeded_wildcard_pattern", | 7060 | label: "clippy::unneeded_wildcard_pattern", |
6710 | description: r##"Checks for tuple patterns with a wildcard\npattern (`_`) is next to a rest pattern (`..`).\n\n_NOTE_: While `_, ..` means there is at least one element left, `..`\nmeans there are 0 or more elements left. This can make a difference\nwhen refactoring, but shouldn't result in errors in the refactored code,\nsince the wildcard pattern isn't used anyway."##, | 7061 | description: r##"Checks for tuple patterns with a wildcard |
7062 | pattern (`_`) is next to a rest pattern (`..`). | ||
7063 | |||
7064 | _NOTE_: While `_, ..` means there is at least one element left, `..` | ||
7065 | means there are 0 or more elements left. This can make a difference | ||
7066 | when refactoring, but shouldn't result in errors in the refactored code, | ||
7067 | since the wildcard pattern isn't used anyway."##, | ||
6711 | }, | 7068 | }, |
6712 | Lint { | 7069 | Lint { |
6713 | label: "clippy::unnested_or_patterns", | 7070 | label: "clippy::unnested_or_patterns", |
6714 | description: r##"Checks for unnested or-patterns, e.g., `Some(0) | Some(2)` and\nsuggests replacing the pattern with a nested one, `Some(0 | 2)`.\n\nAnother way to think of this is that it rewrites patterns in\n*disjunctive normal form (DNF)* into *conjunctive normal form (CNF)*."##, | 7071 | description: r##"Checks for unnested or-patterns, e.g., `Some(0) | Some(2)` and |
7072 | suggests replacing the pattern with a nested one, `Some(0 | 2)`. | ||
7073 | |||
7074 | Another way to think of this is that it rewrites patterns in | ||
7075 | *disjunctive normal form (DNF)* into *conjunctive normal form (CNF)*."##, | ||
6715 | }, | 7076 | }, |
6716 | Lint { label: "clippy::unreachable", description: r##"Checks for usage of `unreachable!`."## }, | 7077 | Lint { label: "clippy::unreachable", description: r##"Checks for usage of `unreachable!`."## }, |
6717 | Lint { | 7078 | Lint { |
6718 | label: "clippy::unreadable_literal", | 7079 | label: "clippy::unreadable_literal", |
6719 | description: r##"Warns if a long integral or floating-point constant does\nnot contain underscores."##, | 7080 | description: r##"Warns if a long integral or floating-point constant does |
7081 | not contain underscores."##, | ||
6720 | }, | 7082 | }, |
6721 | Lint { | 7083 | Lint { |
6722 | label: "clippy::unsafe_derive_deserialize", | 7084 | label: "clippy::unsafe_derive_deserialize", |
6723 | description: r##"Checks for deriving `serde::Deserialize` on a type that\nhas methods using `unsafe`."##, | 7085 | description: r##"Checks for deriving `serde::Deserialize` on a type that |
7086 | has methods using `unsafe`."##, | ||
6724 | }, | 7087 | }, |
6725 | Lint { | 7088 | Lint { |
6726 | label: "clippy::unsafe_removed_from_name", | 7089 | label: "clippy::unsafe_removed_from_name", |
6727 | description: r##"Checks for imports that remove \"unsafe\" from an item's\nname."##, | 7090 | description: r##"Checks for imports that remove unsafe from an item's |
7091 | name."##, | ||
6728 | }, | 7092 | }, |
6729 | Lint { | 7093 | Lint { |
6730 | label: "clippy::unsafe_vector_initialization", | 7094 | label: "clippy::unsafe_vector_initialization", |
@@ -6732,11 +7096,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6732 | }, | 7096 | }, |
6733 | Lint { | 7097 | Lint { |
6734 | label: "clippy::unseparated_literal_suffix", | 7098 | label: "clippy::unseparated_literal_suffix", |
6735 | description: r##"Warns if literal suffixes are not separated by an\nunderscore."##, | 7099 | description: r##"Warns if literal suffixes are not separated by an |
7100 | underscore."##, | ||
6736 | }, | 7101 | }, |
6737 | Lint { | 7102 | Lint { |
6738 | label: "clippy::unsound_collection_transmute", | 7103 | label: "clippy::unsound_collection_transmute", |
6739 | description: r##"Checks for transmutes between collections whose\ntypes have different ABI, size or alignment."##, | 7104 | description: r##"Checks for transmutes between collections whose |
7105 | types have different ABI, size or alignment."##, | ||
6740 | }, | 7106 | }, |
6741 | Lint { | 7107 | Lint { |
6742 | label: "clippy::unstable_as_mut_slice", | 7108 | label: "clippy::unstable_as_mut_slice", |
@@ -6768,7 +7134,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6768 | }, | 7134 | }, |
6769 | Lint { | 7135 | Lint { |
6770 | label: "clippy::unusual_byte_groupings", | 7136 | label: "clippy::unusual_byte_groupings", |
6771 | description: r##"Warns if hexadecimal or binary literals are not grouped\nby nibble or byte."##, | 7137 | description: r##"Warns if hexadecimal or binary literals are not grouped |
7138 | by nibble or byte."##, | ||
6772 | }, | 7139 | }, |
6773 | Lint { | 7140 | Lint { |
6774 | label: "clippy::unwrap_in_result", | 7141 | label: "clippy::unwrap_in_result", |
@@ -6784,47 +7151,63 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6784 | }, | 7151 | }, |
6785 | Lint { | 7152 | Lint { |
6786 | label: "clippy::use_debug", | 7153 | label: "clippy::use_debug", |
6787 | description: r##"Checks for use of `Debug` formatting. The purpose of this\nlint is to catch debugging remnants."##, | 7154 | description: r##"Checks for use of `Debug` formatting. The purpose of this |
7155 | lint is to catch debugging remnants."##, | ||
6788 | }, | 7156 | }, |
6789 | Lint { | 7157 | Lint { |
6790 | label: "clippy::use_self", | 7158 | label: "clippy::use_self", |
6791 | description: r##"Checks for unnecessary repetition of structure name when a\nreplacement with `Self` is applicable."##, | 7159 | description: r##"Checks for unnecessary repetition of structure name when a |
7160 | replacement with `Self` is applicable."##, | ||
6792 | }, | 7161 | }, |
6793 | Lint { | 7162 | Lint { |
6794 | label: "clippy::used_underscore_binding", | 7163 | label: "clippy::used_underscore_binding", |
6795 | description: r##"Checks for the use of bindings with a single leading\nunderscore."##, | 7164 | description: r##"Checks for the use of bindings with a single leading |
7165 | underscore."##, | ||
6796 | }, | 7166 | }, |
6797 | Lint { | 7167 | Lint { |
6798 | label: "clippy::useless_asref", | 7168 | label: "clippy::useless_asref", |
6799 | description: r##"Checks for usage of `.as_ref()` or `.as_mut()` where the\ntypes before and after the call are the same."##, | 7169 | description: r##"Checks for usage of `.as_ref()` or `.as_mut()` where the |
7170 | types before and after the call are the same."##, | ||
6800 | }, | 7171 | }, |
6801 | Lint { | 7172 | Lint { |
6802 | label: "clippy::useless_attribute", | 7173 | label: "clippy::useless_attribute", |
6803 | description: r##"Checks for `extern crate` and `use` items annotated with\nlint attributes.\n\nThis lint permits `#[allow(unused_imports)]`, `#[allow(deprecated)]`,\n`#[allow(unreachable_pub)]`, `#[allow(clippy::wildcard_imports)]` and\n`#[allow(clippy::enum_glob_use)]` on `use` items and `#[allow(unused_imports)]` on\n`extern crate` items with a `#[macro_use]` attribute."##, | 7174 | description: r##"Checks for `extern crate` and `use` items annotated with |
7175 | lint attributes. | ||
7176 | |||
7177 | This lint permits `#[allow(unused_imports)]`, `#[allow(deprecated)]`, | ||
7178 | `#[allow(unreachable_pub)]`, `#[allow(clippy::wildcard_imports)]` and | ||
7179 | `#[allow(clippy::enum_glob_use)]` on `use` items and `#[allow(unused_imports)]` on | ||
7180 | `extern crate` items with a `#[macro_use]` attribute."##, | ||
6804 | }, | 7181 | }, |
6805 | Lint { | 7182 | Lint { |
6806 | label: "clippy::useless_conversion", | 7183 | label: "clippy::useless_conversion", |
6807 | description: r##"Checks for `Into`, `TryInto`, `From`, `TryFrom`, or `IntoIter` calls\nwhich uselessly convert to the same type."##, | 7184 | description: r##"Checks for `Into`, `TryInto`, `From`, `TryFrom`, or `IntoIter` calls |
7185 | which uselessly convert to the same type."##, | ||
6808 | }, | 7186 | }, |
6809 | Lint { | 7187 | Lint { |
6810 | label: "clippy::useless_format", | 7188 | label: "clippy::useless_format", |
6811 | description: r##"Checks for the use of `format!(\"string literal with no\nargument\")` and `format!(\"{}\", foo)` where `foo` is a string."##, | 7189 | description: r##"Checks for the use of `format!(string literal with no |
7190 | argument)` and `format!({}, foo)` where `foo` is a string."##, | ||
6812 | }, | 7191 | }, |
6813 | Lint { | 7192 | Lint { |
6814 | label: "clippy::useless_let_if_seq", | 7193 | label: "clippy::useless_let_if_seq", |
6815 | description: r##"Checks for variable declarations immediately followed by a\nconditional affectation."##, | 7194 | description: r##"Checks for variable declarations immediately followed by a |
7195 | conditional affectation."##, | ||
6816 | }, | 7196 | }, |
6817 | Lint { | 7197 | Lint { |
6818 | label: "clippy::useless_transmute", | 7198 | label: "clippy::useless_transmute", |
6819 | description: r##"Checks for transmutes to the original type of the object\nand transmutes that could be a cast."##, | 7199 | description: r##"Checks for transmutes to the original type of the object |
7200 | and transmutes that could be a cast."##, | ||
6820 | }, | 7201 | }, |
6821 | Lint { | 7202 | Lint { |
6822 | label: "clippy::useless_vec", | 7203 | label: "clippy::useless_vec", |
6823 | description: r##"Checks for usage of `&vec![..]` when using `&[..]` would\nbe possible."##, | 7204 | description: r##"Checks for usage of `&vec![..]` when using `&[..]` would |
7205 | be possible."##, | ||
6824 | }, | 7206 | }, |
6825 | Lint { | 7207 | Lint { |
6826 | label: "clippy::vec_box", | 7208 | label: "clippy::vec_box", |
6827 | description: r##"Checks for use of `Vec<Box<T>>` where T: Sized anywhere in the code.\nCheck the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information."##, | 7209 | description: r##"Checks for use of `Vec<Box<T>>` where T: Sized anywhere in the code. |
7210 | Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information."##, | ||
6828 | }, | 7211 | }, |
6829 | Lint { | 7212 | Lint { |
6830 | label: "clippy::vec_init_then_push", | 7213 | label: "clippy::vec_init_then_push", |
@@ -6836,7 +7219,8 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6836 | }, | 7219 | }, |
6837 | Lint { | 7220 | Lint { |
6838 | label: "clippy::verbose_bit_mask", | 7221 | label: "clippy::verbose_bit_mask", |
6839 | description: r##"Checks for bit masks that can be replaced by a call\nto `trailing_zeros`"##, | 7222 | description: r##"Checks for bit masks that can be replaced by a call |
7223 | to `trailing_zeros`"##, | ||
6840 | }, | 7224 | }, |
6841 | Lint { | 7225 | Lint { |
6842 | label: "clippy::verbose_file_reads", | 7226 | label: "clippy::verbose_file_reads", |
@@ -6848,11 +7232,13 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6848 | }, | 7232 | }, |
6849 | Lint { | 7233 | Lint { |
6850 | label: "clippy::while_immutable_condition", | 7234 | label: "clippy::while_immutable_condition", |
6851 | description: r##"Checks whether variables used within while loop condition\ncan be (and are) mutated in the body."##, | 7235 | description: r##"Checks whether variables used within while loop condition |
7236 | can be (and are) mutated in the body."##, | ||
6852 | }, | 7237 | }, |
6853 | Lint { | 7238 | Lint { |
6854 | label: "clippy::while_let_loop", | 7239 | label: "clippy::while_let_loop", |
6855 | description: r##"Detects `loop + match` combinations that are easier\nwritten as a `while let` loop."##, | 7240 | description: r##"Detects `loop + match` combinations that are easier |
7241 | written as a `while let` loop."##, | ||
6856 | }, | 7242 | }, |
6857 | Lint { | 7243 | Lint { |
6858 | label: "clippy::while_let_on_iterator", | 7244 | label: "clippy::while_let_on_iterator", |
@@ -6880,11 +7266,14 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6880 | }, | 7266 | }, |
6881 | Lint { | 7267 | Lint { |
6882 | label: "clippy::write_with_newline", | 7268 | label: "clippy::write_with_newline", |
6883 | description: r##"This lint warns when you use `write!()` with a format\nstring that\nends in a newline."##, | 7269 | description: r##"This lint warns when you use `write!()` with a format |
7270 | string that | ||
7271 | ends in a newline."##, | ||
6884 | }, | 7272 | }, |
6885 | Lint { | 7273 | Lint { |
6886 | label: "clippy::writeln_empty_string", | 7274 | label: "clippy::writeln_empty_string", |
6887 | description: r##"This lint warns when you use `writeln!(buf, \"\")` to\nprint a newline."##, | 7275 | description: r##"This lint warns when you use `writeln!(buf, )` to |
7276 | print a newline."##, | ||
6888 | }, | 7277 | }, |
6889 | Lint { | 7278 | Lint { |
6890 | label: "clippy::wrong_pub_self_convention", | 7279 | label: "clippy::wrong_pub_self_convention", |
@@ -6892,11 +7281,33 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6892 | }, | 7281 | }, |
6893 | Lint { | 7282 | Lint { |
6894 | label: "clippy::wrong_self_convention", | 7283 | label: "clippy::wrong_self_convention", |
6895 | description: r##"Checks for methods with certain name prefixes and which\ndoesn't match how self is taken. The actual rules are:\n\n|Prefix |Postfix |`self` taken | `self` type |\n|-------|------------|-----------------------|--------------|\n|`as_` | none |`&self` or `&mut self` | any |\n|`from_`| none | none | any |\n|`into_`| none |`self` | any |\n|`is_` | none |`&self` or none | any |\n|`to_` | `_mut` |`&mut self` | any |\n|`to_` | not `_mut` |`self` | `Copy` |\n|`to_` | not `_mut` |`&self` | not `Copy` |\n\nNote: Clippy doesn't trigger methods with `to_` prefix in:\n- Traits definition.\nClippy can not tell if a type that implements a trait is `Copy` or not.\n- Traits implementation, when `&self` is taken.\nThe method signature is controlled by the trait and often `&self` is required for all types that implement the trait\n(see e.g. the `std::string::ToString` trait).\n\nPlease find more info here:\nhttps://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv"##, | 7284 | description: r##"Checks for methods with certain name prefixes and which |
7285 | doesn't match how self is taken. The actual rules are: | ||
7286 | |||
7287 | |Prefix |Postfix |`self` taken | `self` type | | ||
7288 | |-------|------------|-----------------------|--------------| | ||
7289 | |`as_` | none |`&self` or `&mut self` | any | | ||
7290 | |`from_`| none | none | any | | ||
7291 | |`into_`| none |`self` | any | | ||
7292 | |`is_` | none |`&self` or none | any | | ||
7293 | |`to_` | `_mut` |`&mut self` | any | | ||
7294 | |`to_` | not `_mut` |`self` | `Copy` | | ||
7295 | |`to_` | not `_mut` |`&self` | not `Copy` | | ||
7296 | |||
7297 | Note: Clippy doesn't trigger methods with `to_` prefix in: | ||
7298 | - Traits definition. | ||
7299 | Clippy can not tell if a type that implements a trait is `Copy` or not. | ||
7300 | - Traits implementation, when `&self` is taken. | ||
7301 | The method signature is controlled by the trait and often `&self` is required for all types that implement the trait | ||
7302 | (see e.g. the `std::string::ToString` trait). | ||
7303 | |||
7304 | Please find more info here: | ||
7305 | https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv"##, | ||
6896 | }, | 7306 | }, |
6897 | Lint { | 7307 | Lint { |
6898 | label: "clippy::wrong_transmute", | 7308 | label: "clippy::wrong_transmute", |
6899 | description: r##"Checks for transmutes that can't ever be correct on any\narchitecture."##, | 7309 | description: r##"Checks for transmutes that can't ever be correct on any |
7310 | architecture."##, | ||
6900 | }, | 7311 | }, |
6901 | Lint { label: "clippy::zero_divided_by_zero", description: r##"Checks for `0.0 / 0.0`."## }, | 7312 | Lint { label: "clippy::zero_divided_by_zero", description: r##"Checks for `0.0 / 0.0`."## }, |
6902 | Lint { | 7313 | Lint { |
@@ -6913,6 +7324,7 @@ pub const CLIPPY_LINTS: &[Lint] = &[ | |||
6913 | }, | 7324 | }, |
6914 | Lint { | 7325 | Lint { |
6915 | label: "clippy::zst_offset", | 7326 | label: "clippy::zst_offset", |
6916 | description: r##"Checks for `offset(_)`, `wrapping_`{`add`, `sub`}, etc. on raw pointers to\nzero-sized types"##, | 7327 | description: r##"Checks for `offset(_)`, `wrapping_`{`add`, `sub`}, etc. on raw pointers to |
7328 | zero-sized types"##, | ||
6917 | }, | 7329 | }, |
6918 | ]; | 7330 | ]; |
diff --git a/xtask/src/codegen/gen_lint_completions.rs b/xtask/src/codegen/gen_lint_completions.rs index a28b6cb59..7d78d0d04 100644 --- a/xtask/src/codegen/gen_lint_completions.rs +++ b/xtask/src/codegen/gen_lint_completions.rs | |||
@@ -109,6 +109,10 @@ struct ClippyLint { | |||
109 | id: String, | 109 | id: String, |
110 | } | 110 | } |
111 | 111 | ||
112 | fn unescape(s: &str) -> String { | ||
113 | s.replace(r#"\""#, "").replace(r#"\n"#, "\n").replace(r#"\r"#, "") | ||
114 | } | ||
115 | |||
112 | fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> { | 116 | fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> { |
113 | let file_content = read_file(path)?; | 117 | let file_content = read_file(path)?; |
114 | let mut clippy_lints: Vec<ClippyLint> = vec![]; | 118 | let mut clippy_lints: Vec<ClippyLint> = vec![]; |
@@ -135,6 +139,7 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) -> Result<()> { | |||
135 | .strip_prefix(prefix_to_strip) | 139 | .strip_prefix(prefix_to_strip) |
136 | .expect("should be prefixed by what it does") | 140 | .expect("should be prefixed by what it does") |
137 | .strip_suffix(suffix_to_strip) | 141 | .strip_suffix(suffix_to_strip) |
142 | .map(unescape) | ||
138 | .expect("should be suffixed by comma") | 143 | .expect("should be suffixed by comma") |
139 | .into(); | 144 | .into(); |
140 | } | 145 | } |