From 13de54cebb142bb491e7a8986bf7dfff75223dae Mon Sep 17 00:00:00 2001 From: GHA CI Date: Thu, 19 Oct 2023 12:05:32 +0000 Subject: [PATCH] Automatic deploy to GitHub Pages: 9574d28cb63c08f825865637a4cbf08597ccf5c9 --- master/lints.json | 92 +++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/master/lints.json b/master/lints.json index d202579ec5ae..8f1e81a979cf 100644 --- a/master/lints.json +++ b/master/lints.json @@ -82,7 +82,7 @@ }, "group": "suspicious", "level": "warn", - "docs": "\n### What it does\nChecks for ranges which almost include the entire range of letters from 'a' to 'z'\nor digits from '0' to '9', but don't because they're a half open range.\n\n### Why is this bad?\nThis (`'a'..'z'`) is almost certainly a typo meant to include all letters.\n\n### Example\n```rust\nlet _ = 'a'..'z';\n```\nUse instead:\n```rust\nlet _ = 'a'..='z';\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n\n### Past names\n\n* `almost_complete_letter_range`\n\n", + "docs": "\n### What it does\nChecks for ranges which almost include the entire range of letters from 'a' to 'z'\nor digits from '0' to '9', but don't because they're a half open range.\n\n### Why is this bad?\nThis (`'a'..'z'`) is almost certainly a typo meant to include all letters.\n\n### Example\n```rust\nlet _ = 'a'..'z';\n```\nUse instead:\n```rust\nlet _ = 'a'..='z';\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n\n### Past names\n\n* `almost_complete_letter_range`\n\n", "version": "1.68.0", "applicability": { "is_multi_part_suggestion": false, @@ -115,7 +115,7 @@ }, "group": "correctness", "level": "deny", - "docs": "\n### What it does\nChecks 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.\n\n### Why is this bad?\nUsually, the definition in the standard library is more\nprecise than what people come up with. If you find that your definition is\nactually more precise, please [file a Rust\nissue](https://github.com/rust-lang/rust/issues).\n\n### Example\n```rust\nlet x = 3.14;\nlet y = 1_f64 / x;\n```\nUse instead:\n```rust\nlet x = std::f32::consts::PI;\nlet y = std::f64::consts::FRAC_1_PI;\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks 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.\n\n### Why is this bad?\nUsually, the definition in the standard library is more\nprecise than what people come up with. If you find that your definition is\nactually more precise, please [file a Rust\nissue](https://github.com/rust-lang/rust/issues).\n\n### Example\n```rust\nlet x = 3.14;\nlet y = 1_f64 / x;\n```\nUse instead:\n```rust\nlet x = std::f32::consts::PI;\nlet y = std::f64::consts::FRAC_1_PI;\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "pre 1.29.0", "applicability": { "is_multi_part_suggestion": false, @@ -455,7 +455,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nChecks for the usage of `&expr as *const T` or\n`&mut expr as *mut T`, and suggest using `ptr::addr_of` or\n`ptr::addr_of_mut` instead.\n\n### Why is this bad?\nThis would improve readability and avoid creating a reference\nthat points to an uninitialized value or unaligned place.\nRead the `ptr::addr_of` docs for more information.\n\n### Example\n```rust\nlet val = 1;\nlet p = &val as *const i32;\n\nlet mut val_mut = 1;\nlet p_mut = &mut val_mut as *mut i32;\n```\nUse instead:\n```rust\nlet val = 1;\nlet p = std::ptr::addr_of!(val);\n\nlet mut val_mut = 1;\nlet p_mut = std::ptr::addr_of_mut!(val_mut);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for the usage of `&expr as *const T` or\n`&mut expr as *mut T`, and suggest using `ptr::addr_of` or\n`ptr::addr_of_mut` instead.\n\n### Why is this bad?\nThis would improve readability and avoid creating a reference\nthat points to an uninitialized value or unaligned place.\nRead the `ptr::addr_of` docs for more information.\n\n### Example\n```rust\nlet val = 1;\nlet p = &val as *const i32;\n\nlet mut val_mut = 1;\nlet p_mut = &mut val_mut as *mut i32;\n```\nUse instead:\n```rust\nlet val = 1;\nlet p = std::ptr::addr_of!(val);\n\nlet mut val_mut = 1;\nlet p_mut = std::ptr::addr_of_mut!(val_mut);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.60.0", "applicability": { "is_multi_part_suggestion": false, @@ -653,7 +653,7 @@ }, "group": "suspicious", "level": "warn", - "docs": "\n### What it does\nChecks for usage of the `abs()` method that cast the result to unsigned.\n\n### Why is this bad?\nThe `unsigned_abs()` method avoids panic when called on the MIN value.\n\n### Example\n```rust\nlet x: i32 = -42;\nlet y: u32 = x.abs() as u32;\n```\nUse instead:\n```rust\nlet x: i32 = -42;\nlet y: u32 = x.unsigned_abs();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of the `abs()` method that cast the result to unsigned.\n\n### Why is this bad?\nThe `unsigned_abs()` method avoids panic when called on the MIN value.\n\n### Example\n```rust\nlet x: i32 = -42;\nlet y: u32 = x.abs() as u32;\n```\nUse instead:\n```rust\nlet x: i32 = -42;\nlet y: u32 = x.unsigned_abs();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.62.0", "applicability": { "is_multi_part_suggestion": false, @@ -878,7 +878,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nChecks for explicit bounds checking when casting.\n\n### Why is this bad?\nReduces the readability of statements & is error prone.\n\n### Example\n```rust\nfoo <= i32::MAX as u32;\n```\n\nUse instead:\n```rust\ni32::try_from(foo).is_ok();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for explicit bounds checking when casting.\n\n### Why is this bad?\nReduces the readability of statements & is error prone.\n\n### Example\n```rust\nfoo <= i32::MAX as u32;\n```\n\nUse instead:\n```rust\ni32::try_from(foo).is_ok();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.37.0", "applicability": { "is_multi_part_suggestion": false, @@ -938,7 +938,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nChecks for usage of `cloned()` on an `Iterator` or `Option` where\n`copied()` could be used instead.\n\n### Why is this bad?\n`copied()` is better because it guarantees that the type being cloned\nimplements `Copy`.\n\n### Example\n```rust\n[1, 2, 3].iter().cloned();\n```\nUse instead:\n```rust\n[1, 2, 3].iter().copied();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of `cloned()` on an `Iterator` or `Option` where\n`copied()` could be used instead.\n\n### Why is this bad?\n`copied()` is better because it guarantees that the type being cloned\nimplements `Copy`.\n\n### Example\n```rust\n[1, 2, 3].iter().cloned();\n```\nUse instead:\n```rust\n[1, 2, 3].iter().copied();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.53.0", "applicability": { "is_multi_part_suggestion": false, @@ -1046,7 +1046,7 @@ }, "group": "perf", "level": "warn", - "docs": "\n### What it does\nChecks for consecutive calls to `str::replace` (2 or more)\nthat can be collapsed into a single call.\n\n### Why is this bad?\nConsecutive `str::replace` calls scan the string multiple times\nwith repetitive code.\n\n### Example\n```rust\nlet hello = \"hesuo worpd\"\n .replace('s', \"l\")\n .replace(\"u\", \"l\")\n .replace('p', \"l\");\n```\nUse instead:\n```rust\nlet hello = \"hesuo worpd\".replace(['s', 'u', 'p'], \"l\");\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for consecutive calls to `str::replace` (2 or more)\nthat can be collapsed into a single call.\n\n### Why is this bad?\nConsecutive `str::replace` calls scan the string multiple times\nwith repetitive code.\n\n### Example\n```rust\nlet hello = \"hesuo worpd\"\n .replace('s', \"l\")\n .replace(\"u\", \"l\")\n .replace('p', \"l\");\n```\nUse instead:\n```rust\nlet hello = \"hesuo worpd\".replace(['s', 'u', 'p'], \"l\");\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.65.0", "applicability": { "is_multi_part_suggestion": false, @@ -1301,7 +1301,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nChecks for `#[cfg_attr(rustfmt, rustfmt_skip)]` and suggests to replace it\nwith `#[rustfmt::skip]`.\n\n### Why is this bad?\nSince tool_attributes ([rust-lang/rust#44690](https://github.com/rust-lang/rust/issues/44690))\nare stable now, they should be used instead of the old `cfg_attr(rustfmt)` attributes.\n\n### Known problems\nThis lint doesn't detect crate level inner attributes, because they get\nprocessed before the PreExpansionPass lints get executed. See\n[#3123](https://github.com/rust-lang/rust-clippy/pull/3123#issuecomment-422321765)\n\n### Example\n```rust\n#[cfg_attr(rustfmt, rustfmt_skip)]\nfn main() { }\n```\n\nUse instead:\n```rust\n#[rustfmt::skip]\nfn main() { }\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for `#[cfg_attr(rustfmt, rustfmt_skip)]` and suggests to replace it\nwith `#[rustfmt::skip]`.\n\n### Why is this bad?\nSince tool_attributes ([rust-lang/rust#44690](https://github.com/rust-lang/rust/issues/44690))\nare stable now, they should be used instead of the old `cfg_attr(rustfmt)` attributes.\n\n### Known problems\nThis lint doesn't detect crate level inner attributes, because they get\nprocessed before the PreExpansionPass lints get executed. See\n[#3123](https://github.com/rust-lang/rust-clippy/pull/3123#issuecomment-422321765)\n\n### Example\n```rust\n#[cfg_attr(rustfmt, rustfmt_skip)]\nfn main() { }\n```\n\nUse instead:\n```rust\n#[rustfmt::skip]\nfn main() { }\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.32.0", "applicability": { "is_multi_part_suggestion": false, @@ -1361,7 +1361,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nDetects manual `std::default::Default` implementations that are identical to a derived implementation.\n\n### Why is this bad?\nIt is less concise.\n\n### Example\n```rust\nstruct Foo {\n bar: bool\n}\n\nimpl Default for Foo {\n fn default() -> Self {\n Self {\n bar: false\n }\n }\n}\n```\n\nUse instead:\n```rust\n#[derive(Default)]\nstruct Foo {\n bar: bool\n}\n```\n\n### Known problems\nDerive macros [sometimes use incorrect bounds](https://github.com/rust-lang/rust/issues/26925)\nin generic types and the user defined `impl` may be more generalized or\nspecialized than what derive will produce. This lint can't detect the manual `impl`\nhas exactly equal bounds, and therefore this lint is disabled for types with\ngeneric parameters.\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nDetects manual `std::default::Default` implementations that are identical to a derived implementation.\n\n### Why is this bad?\nIt is less concise.\n\n### Example\n```rust\nstruct Foo {\n bar: bool\n}\n\nimpl Default for Foo {\n fn default() -> Self {\n Self {\n bar: false\n }\n }\n}\n```\n\nUse instead:\n```rust\n#[derive(Default)]\nstruct Foo {\n bar: bool\n}\n```\n\n### Known problems\nDerive macros [sometimes use incorrect bounds](https://github.com/rust-lang/rust/issues/26925)\nin generic types and the user defined `impl` may be more generalized or\nspecialized than what derive will produce. This lint can't detect the manual `impl`\nhas exactly equal bounds, and therefore this lint is disabled for types with\ngeneric parameters.\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.57.0", "applicability": { "is_multi_part_suggestion": false, @@ -1883,7 +1883,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for `.err().expect()` calls on the `Result` type.\n\n### Why is this bad?\n`.expect_err()` can be called directly to avoid the extra type conversion from `err()`.\n\n### Example\n```rust\nlet x: Result = Ok(10);\nx.err().expect(\"Testing err().expect()\");\n```\nUse instead:\n```rust\nlet x: Result = Ok(10);\nx.expect_err(\"Testing expect_err\");\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for `.err().expect()` calls on the `Result` type.\n\n### Why is this bad?\n`.expect_err()` can be called directly to avoid the extra type conversion from `err()`.\n\n### Example\n```rust\nlet x: Result = Ok(10);\nx.err().expect(\"Testing err().expect()\");\n```\nUse instead:\n```rust\nlet x: Result = Ok(10);\nx.expect_err(\"Testing expect_err\");\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.62.0", "applicability": { "is_multi_part_suggestion": false, @@ -2277,7 +2277,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nChecks for usage of `_.filter_map(_).next()`.\n\n### Why is this bad?\nReadability, this can be written more concisely as\n`_.find_map(_)`.\n\n### Example\n```rust\n (0..3).filter_map(|x| if x == 2 { Some(x) } else { None }).next();\n```\nCan be written as\n\n```rust\n (0..3).find_map(|x| if x == 2 { Some(x) } else { None });\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of `_.filter_map(_).next()`.\n\n### Why is this bad?\nReadability, this can be written more concisely as\n`_.find_map(_)`.\n\n### Example\n```rust\n (0..3).filter_map(|x| if x == 2 { Some(x) } else { None }).next();\n```\nCan be written as\n\n```rust\n (0..3).find_map(|x| if x == 2 { Some(x) } else { None });\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.36.0", "applicability": { "is_multi_part_suggestion": false, @@ -2592,7 +2592,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nSearches for implementations of the `Into<..>` trait and suggests to implement `From<..>` instead.\n\n### Why is this bad?\nAccording the std docs implementing `From<..>` is preferred since it gives you `Into<..>` for free where the reverse isn't true.\n\n### Example\n```rust\nstruct StringWrapper(String);\n\nimpl Into for String {\n fn into(self) -> StringWrapper {\n StringWrapper(self)\n }\n}\n```\nUse instead:\n```rust\nstruct StringWrapper(String);\n\nimpl From for StringWrapper {\n fn from(s: String) -> StringWrapper {\n StringWrapper(s)\n }\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nSearches for implementations of the `Into<..>` trait and suggests to implement `From<..>` instead.\n\n### Why is this bad?\nAccording the std docs implementing `From<..>` is preferred since it gives you `Into<..>` for free where the reverse isn't true.\n\n### Example\n```rust\nstruct StringWrapper(String);\n\nimpl Into for String {\n fn into(self) -> StringWrapper {\n StringWrapper(self)\n }\n}\n```\nUse instead:\n```rust\nstruct StringWrapper(String);\n\nimpl From for StringWrapper {\n fn from(s: String) -> StringWrapper {\n StringWrapper(s)\n }\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.51.0", "applicability": { "is_multi_part_suggestion": false, @@ -2787,7 +2787,7 @@ }, "group": "restriction", "level": "allow", - "docs": "\n### What it does\nChecks for if-else that could be written using either `bool::then` or `bool::then_some`.\n\n### Why is this bad?\nLooks a little redundant. Using `bool::then` is more concise and incurs no loss of clarity.\nFor simple calculations and known values, use `bool::then_some`, which is eagerly evaluated\nin comparison to `bool::then`.\n\n### Example\n```rust\nlet a = if v.is_empty() {\n println!(\"true!\");\n Some(42)\n} else {\n None\n};\n```\n\nCould be written:\n\n```rust\nlet a = v.is_empty().then(|| {\n println!(\"true!\");\n 42\n});\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for if-else that could be written using either `bool::then` or `bool::then_some`.\n\n### Why is this bad?\nLooks a little redundant. Using `bool::then` is more concise and incurs no loss of clarity.\nFor simple calculations and known values, use `bool::then_some`, which is eagerly evaluated\nin comparison to `bool::then`.\n\n### Example\n```rust\nlet a = if v.is_empty() {\n println!(\"true!\");\n Some(42)\n} else {\n None\n};\n```\n\nCould be written:\n\n```rust\nlet a = v.is_empty().then(|| {\n println!(\"true!\");\n 42\n});\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.53.0", "applicability": { "is_multi_part_suggestion": false, @@ -2997,7 +2997,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nThe lint checks for slice bindings in patterns that are only used to\naccess individual slice values.\n\n### Why is this bad?\nAccessing slice values using indices can lead to panics. Using refutable\npatterns can avoid these. Binding to individual values also improves the\nreadability as they can be named.\n\n### Limitations\nThis lint currently only checks for immutable access inside `if let`\npatterns.\n\n### Example\n```rust\nlet slice: Option<&[u32]> = Some(&[1, 2, 3]);\n\nif let Some(slice) = slice {\n println!(\"{}\", slice[0]);\n}\n```\nUse instead:\n```rust\nlet slice: Option<&[u32]> = Some(&[1, 2, 3]);\n\nif let Some(&[first, ..]) = slice {\n println!(\"{}\", first);\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n* `max-suggested-slice-pattern-length`: `u64`(defaults to `3`): When Clippy suggests using a slice pattern, this is the maximum number of elements allowed in\n the slice pattern that is suggested. If more elements are necessary, the lint is suppressed.\n For example, `[_, _, _, e, ..]` is a slice pattern with 4 elements.\n", + "docs": "\n### What it does\nThe lint checks for slice bindings in patterns that are only used to\naccess individual slice values.\n\n### Why is this bad?\nAccessing slice values using indices can lead to panics. Using refutable\npatterns can avoid these. Binding to individual values also improves the\nreadability as they can be named.\n\n### Limitations\nThis lint currently only checks for immutable access inside `if let`\npatterns.\n\n### Example\n```rust\nlet slice: Option<&[u32]> = Some(&[1, 2, 3]);\n\nif let Some(slice) = slice {\n println!(\"{}\", slice[0]);\n}\n```\nUse instead:\n```rust\nlet slice: Option<&[u32]> = Some(&[1, 2, 3]);\n\nif let Some(&[first, ..]) = slice {\n println!(\"{}\", first);\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n* `max-suggested-slice-pattern-length`: `u64`(defaults to `3`): When Clippy suggests using a slice pattern, this is the maximum number of elements allowed in\n the slice pattern that is suggested. If more elements are necessary, the lint is suppressed.\n For example, `[_, _, _, e, ..]` is a slice pattern with 4 elements.\n", "version": "1.59.0", "applicability": { "is_multi_part_suggestion": false, @@ -4020,7 +4020,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for usage of `std::mem::size_of::() * 8` when\n`T::BITS` is available.\n\n### Why is this bad?\nCan be written as the shorter `T::BITS`.\n\n### Example\n```rust\nstd::mem::size_of::() * 8;\n```\nUse instead:\n```rust\nusize::BITS as usize;\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of `std::mem::size_of::() * 8` when\n`T::BITS` is available.\n\n### Why is this bad?\nCan be written as the shorter `T::BITS`.\n\n### Example\n```rust\nstd::mem::size_of::() * 8;\n```\nUse instead:\n```rust\nusize::BITS as usize;\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.60.0", "applicability": { "is_multi_part_suggestion": false, @@ -4035,7 +4035,7 @@ }, "group": "nursery", "level": "allow", - "docs": "\n### What it does\nIdentifies good opportunities for a clamp function from std or core, and suggests using it.\n\n### Why is this bad?\nclamp is much shorter, easier to read, and doesn't use any control flow.\n\n### Known issue(s)\nIf the clamped variable is NaN this suggestion will cause the code to propagate NaN\nrather than returning either `max` or `min`.\n\n`clamp` functions will panic if `max < min`, `max.is_nan()`, or `min.is_nan()`.\nSome may consider panicking in these situations to be desirable, but it also may\nintroduce panicking where there wasn't any before.\n\nSee also [the discussion in the\nPR](https://github.com/rust-lang/rust-clippy/pull/9484#issuecomment-1278922613).\n\n### Examples\n```rust\nif input > max {\n max\n} else if input < min {\n min\n} else {\n input\n}\n```\n\n```rust\ninput.max(min).min(max)\n```\n\n```rust\nmatch input {\n x if x > max => max,\n x if x < min => min,\n x => x,\n}\n```\n\n```rust\nlet mut x = input;\nif x < min { x = min; }\nif x > max { x = max; }\n```\nUse instead:\n```rust\ninput.clamp(min, max)\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nIdentifies good opportunities for a clamp function from std or core, and suggests using it.\n\n### Why is this bad?\nclamp is much shorter, easier to read, and doesn't use any control flow.\n\n### Known issue(s)\nIf the clamped variable is NaN this suggestion will cause the code to propagate NaN\nrather than returning either `max` or `min`.\n\n`clamp` functions will panic if `max < min`, `max.is_nan()`, or `min.is_nan()`.\nSome may consider panicking in these situations to be desirable, but it also may\nintroduce panicking where there wasn't any before.\n\nSee also [the discussion in the\nPR](https://github.com/rust-lang/rust-clippy/pull/9484#issuecomment-1278922613).\n\n### Examples\n```rust\nif input > max {\n max\n} else if input < min {\n min\n} else {\n input\n}\n```\n\n```rust\ninput.max(min).min(max)\n```\n\n```rust\nmatch input {\n x if x > max => max,\n x if x < min => min,\n x => x,\n}\n```\n\n```rust\nlet mut x = input;\nif x < min { x = min; }\nif x > max { x = max; }\n```\nUse instead:\n```rust\ninput.clamp(min, max)\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.66.0", "applicability": { "is_multi_part_suggestion": false, @@ -4125,7 +4125,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nChecks for cases where [`BuildHasher::hash_one`] can be used.\n\n[`BuildHasher::hash_one`]: https://doc.rust-lang.org/std/hash/trait.BuildHasher.html#method.hash_one\n\n### Why is this bad?\nIt is more concise to use the `hash_one` method.\n\n### Example\n```rust\nuse std::hash::{BuildHasher, Hash, Hasher};\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet value = vec![1, 2, 3];\n\nlet mut hasher = s.build_hasher();\nvalue.hash(&mut hasher);\nlet hash = hasher.finish();\n```\nUse instead:\n```rust\nuse std::hash::BuildHasher;\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet value = vec![1, 2, 3];\n\nlet hash = s.hash_one(&value);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for cases where [`BuildHasher::hash_one`] can be used.\n\n[`BuildHasher::hash_one`]: https://doc.rust-lang.org/std/hash/trait.BuildHasher.html#method.hash_one\n\n### Why is this bad?\nIt is more concise to use the `hash_one` method.\n\n### Example\n```rust\nuse std::hash::{BuildHasher, Hash, Hasher};\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet value = vec![1, 2, 3];\n\nlet mut hasher = s.build_hasher();\nvalue.hash(&mut hasher);\nlet hash = hasher.finish();\n```\nUse instead:\n```rust\nuse std::hash::BuildHasher;\nuse std::collections::hash_map::RandomState;\n\nlet s = RandomState::new();\nlet value = vec![1, 2, 3];\n\nlet hash = s.hash_one(&value);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.74.0", "applicability": { "is_multi_part_suggestion": false, @@ -4155,7 +4155,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nSuggests to use dedicated built-in methods,\n`is_ascii_(lowercase|uppercase|digit|hexdigit)` for checking on corresponding\nascii range\n\n### Why is this bad?\nUsing the built-in functions is more readable and makes it\nclear that it's not a specific subset of characters, but all\nASCII (lowercase|uppercase|digit|hexdigit) characters.\n### Example\n```rust\nfn main() {\n assert!(matches!('x', 'a'..='z'));\n assert!(matches!(b'X', b'A'..=b'Z'));\n assert!(matches!('2', '0'..='9'));\n assert!(matches!('x', 'A'..='Z' | 'a'..='z'));\n assert!(matches!('C', '0'..='9' | 'a'..='f' | 'A'..='F'));\n\n ('0'..='9').contains(&'0');\n ('a'..='z').contains(&'a');\n ('A'..='Z').contains(&'A');\n}\n```\nUse instead:\n```rust\nfn main() {\n assert!('x'.is_ascii_lowercase());\n assert!(b'X'.is_ascii_uppercase());\n assert!('2'.is_ascii_digit());\n assert!('x'.is_ascii_alphabetic());\n assert!('C'.is_ascii_hexdigit());\n\n '0'.is_ascii_digit();\n 'a'.is_ascii_lowercase();\n 'A'.is_ascii_uppercase();\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nSuggests to use dedicated built-in methods,\n`is_ascii_(lowercase|uppercase|digit|hexdigit)` for checking on corresponding\nascii range\n\n### Why is this bad?\nUsing the built-in functions is more readable and makes it\nclear that it's not a specific subset of characters, but all\nASCII (lowercase|uppercase|digit|hexdigit) characters.\n### Example\n```rust\nfn main() {\n assert!(matches!('x', 'a'..='z'));\n assert!(matches!(b'X', b'A'..=b'Z'));\n assert!(matches!('2', '0'..='9'));\n assert!(matches!('x', 'A'..='Z' | 'a'..='z'));\n assert!(matches!('C', '0'..='9' | 'a'..='f' | 'A'..='F'));\n\n ('0'..='9').contains(&'0');\n ('a'..='z').contains(&'a');\n ('A'..='Z').contains(&'A');\n}\n```\nUse instead:\n```rust\nfn main() {\n assert!('x'.is_ascii_lowercase());\n assert!(b'X'.is_ascii_uppercase());\n assert!('2'.is_ascii_digit());\n assert!('x'.is_ascii_alphabetic());\n assert!('C'.is_ascii_hexdigit());\n\n '0'.is_ascii_digit();\n 'a'.is_ascii_lowercase();\n 'A'.is_ascii_uppercase();\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.67.0", "applicability": { "is_multi_part_suggestion": false, @@ -4200,7 +4200,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\n\nWarn of cases where `let...else` could be used\n\n### Why is this bad?\n\n`let...else` provides a standard construct for this pattern\nthat people can easily recognize. It's also more compact.\n\n### Example\n\n```rust\nlet v = if let Some(v) = w { v } else { return };\n```\n\nCould be written:\n\n```rust\nlet Some(v) = w else { return };\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n* `matches-for-let-else`: `crate::manual_let_else::MatchLintBehaviour`(defaults to `WellKnownTypes`): Whether the matches should be considered by the lint, and whether there should\n be filtering for common types.\n", + "docs": "\n### What it does\n\nWarn of cases where `let...else` could be used\n\n### Why is this bad?\n\n`let...else` provides a standard construct for this pattern\nthat people can easily recognize. It's also more compact.\n\n### Example\n\n```rust\nlet v = if let Some(v) = w { v } else { return };\n```\n\nCould be written:\n\n```rust\nlet Some(v) = w else { return };\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n* `matches-for-let-else`: `crate::manual_let_else::MatchLintBehaviour`(defaults to `WellKnownTypes`): Whether the matches should be considered by the lint, and whether there should\n be filtering for common types.\n", "version": "1.67.0", "applicability": { "is_multi_part_suggestion": false, @@ -4275,7 +4275,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for manual implementations of the non-exhaustive pattern.\n\n### Why is this bad?\nUsing the #[non_exhaustive] attribute expresses better the intent\nand allows possible optimizations when applied to enums.\n\n### Example\n```rust\nstruct S {\n pub a: i32,\n pub b: i32,\n _c: (),\n}\n\nenum E {\n A,\n B,\n #[doc(hidden)]\n _C,\n}\n\nstruct T(pub i32, pub i32, ());\n```\nUse instead:\n```rust\n#[non_exhaustive]\nstruct S {\n pub a: i32,\n pub b: i32,\n}\n\n#[non_exhaustive]\nenum E {\n A,\n B,\n}\n\n#[non_exhaustive]\nstruct T(pub i32, pub i32);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for manual implementations of the non-exhaustive pattern.\n\n### Why is this bad?\nUsing the #[non_exhaustive] attribute expresses better the intent\nand allows possible optimizations when applied to enums.\n\n### Example\n```rust\nstruct S {\n pub a: i32,\n pub b: i32,\n _c: (),\n}\n\nenum E {\n A,\n B,\n #[doc(hidden)]\n _C,\n}\n\nstruct T(pub i32, pub i32, ());\n```\nUse instead:\n```rust\n#[non_exhaustive]\nstruct S {\n pub a: i32,\n pub b: i32,\n}\n\n#[non_exhaustive]\nenum E {\n A,\n B,\n}\n\n#[non_exhaustive]\nstruct T(pub i32, pub i32);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.45.0", "applicability": { "is_multi_part_suggestion": false, @@ -4305,7 +4305,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for expressions like `x >= 3 && x < 8` that could\nbe more readably expressed as `(3..8).contains(x)`.\n\n### Why is this bad?\n`contains` expresses the intent better and has less\nfailure modes (such as fencepost errors or using `||` instead of `&&`).\n\n### Example\n```rust\n// given\nlet x = 6;\n\nassert!(x >= 3 && x < 8);\n```\nUse instead:\n```rust\nassert!((3..8).contains(&x));\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for expressions like `x >= 3 && x < 8` that could\nbe more readably expressed as `(3..8).contains(x)`.\n\n### Why is this bad?\n`contains` expresses the intent better and has less\nfailure modes (such as fencepost errors or using `||` instead of `&&`).\n\n### Example\n```rust\n// given\nlet x = 6;\n\nassert!(x >= 3 && x < 8);\n```\nUse instead:\n```rust\nassert!((3..8).contains(&x));\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.49.0", "applicability": { "is_multi_part_suggestion": false, @@ -4335,7 +4335,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nChecks for an expression like `((x % 4) + 4) % 4` which is a common manual reimplementation\nof `x.rem_euclid(4)`.\n\n### Why is this bad?\nIt's simpler and more readable.\n\n### Example\n```rust\nlet x: i32 = 24;\nlet rem = ((x % 4) + 4) % 4;\n```\nUse instead:\n```rust\nlet x: i32 = 24;\nlet rem = x.rem_euclid(4);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for an expression like `((x % 4) + 4) % 4` which is a common manual reimplementation\nof `x.rem_euclid(4)`.\n\n### Why is this bad?\nIt's simpler and more readable.\n\n### Example\n```rust\nlet x: i32 = 24;\nlet rem = ((x % 4) + 4) % 4;\n```\nUse instead:\n```rust\nlet x: i32 = 24;\nlet rem = x.rem_euclid(4);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.64.0", "applicability": { "is_multi_part_suggestion": false, @@ -4350,7 +4350,7 @@ }, "group": "perf", "level": "warn", - "docs": "\n### What it does\nChecks for code to be replaced by `.retain()`.\n### Why is this bad?\n`.retain()` is simpler and avoids needless allocation.\n### Example\n```rust\nlet mut vec = vec![0, 1, 2];\nvec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();\nvec = vec.into_iter().filter(|x| x % 2 == 0).collect();\n```\nUse instead:\n```rust\nlet mut vec = vec![0, 1, 2];\nvec.retain(|x| x % 2 == 0);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for code to be replaced by `.retain()`.\n### Why is this bad?\n`.retain()` is simpler and avoids needless allocation.\n### Example\n```rust\nlet mut vec = vec![0, 1, 2];\nvec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();\nvec = vec.into_iter().filter(|x| x % 2 == 0).collect();\n```\nUse instead:\n```rust\nlet mut vec = vec![0, 1, 2];\nvec.retain(|x| x % 2 == 0);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.64.0", "applicability": { "is_multi_part_suggestion": false, @@ -4395,7 +4395,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nChecks for usage of `str::splitn(2, _)`\n\n### Why is this bad?\n`split_once` is both clearer in intent and slightly more efficient.\n\n### Example\n```rust\nlet s = \"key=value=add\";\nlet (key, value) = s.splitn(2, '=').next_tuple()?;\nlet value = s.splitn(2, '=').nth(1)?;\n\nlet mut parts = s.splitn(2, '=');\nlet key = parts.next()?;\nlet value = parts.next()?;\n```\n\nUse instead:\n```rust\nlet s = \"key=value=add\";\nlet (key, value) = s.split_once('=')?;\nlet value = s.split_once('=')?.1;\n\nlet (key, value) = s.split_once('=')?;\n```\n\n### Limitations\nThe multiple statement variant currently only detects `iter.next()?`/`iter.next().unwrap()`\nin two separate `let` statements that immediately follow the `splitn()`\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of `str::splitn(2, _)`\n\n### Why is this bad?\n`split_once` is both clearer in intent and slightly more efficient.\n\n### Example\n```rust\nlet s = \"key=value=add\";\nlet (key, value) = s.splitn(2, '=').next_tuple()?;\nlet value = s.splitn(2, '=').nth(1)?;\n\nlet mut parts = s.splitn(2, '=');\nlet key = parts.next()?;\nlet value = parts.next()?;\n```\n\nUse instead:\n```rust\nlet s = \"key=value=add\";\nlet (key, value) = s.split_once('=')?;\nlet value = s.split_once('=')?.1;\n\nlet (key, value) = s.split_once('=')?;\n```\n\n### Limitations\nThe multiple statement variant currently only detects `iter.next()?`/`iter.next().unwrap()`\nin two separate `let` statements that immediately follow the `splitn()`\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.57.0", "applicability": { "is_multi_part_suggestion": false, @@ -4410,7 +4410,7 @@ }, "group": "perf", "level": "warn", - "docs": "\n### What it does\nChecks for manual implementations of `str::repeat`\n\n### Why is this bad?\nThese are both harder to read, as well as less performant.\n\n### Example\n```rust\nlet x: String = std::iter::repeat('x').take(10).collect();\n```\n\nUse instead:\n```rust\nlet x: String = \"x\".repeat(10);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for manual implementations of `str::repeat`\n\n### Why is this bad?\nThese are both harder to read, as well as less performant.\n\n### Example\n```rust\nlet x: String = std::iter::repeat('x').take(10).collect();\n```\n\nUse instead:\n```rust\nlet x: String = \"x\".repeat(10);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.54.0", "applicability": { "is_multi_part_suggestion": false, @@ -4440,7 +4440,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nSuggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing using\nthe pattern's length.\n\n### Why is this bad?\nUsing `str:strip_{prefix,suffix}` is safer and may have better performance as there is no\nslicing which may panic and the compiler does not need to insert this panic code. It is\nalso sometimes more readable as it removes the need for duplicating or storing the pattern\nused by `str::{starts,ends}_with` and in the slicing.\n\n### Example\n```rust\nlet s = \"hello, world!\";\nif s.starts_with(\"hello, \") {\n assert_eq!(s[\"hello, \".len()..].to_uppercase(), \"WORLD!\");\n}\n```\nUse instead:\n```rust\nlet s = \"hello, world!\";\nif let Some(end) = s.strip_prefix(\"hello, \") {\n assert_eq!(end.to_uppercase(), \"WORLD!\");\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nSuggests using `strip_{prefix,suffix}` over `str::{starts,ends}_with` and slicing using\nthe pattern's length.\n\n### Why is this bad?\nUsing `str:strip_{prefix,suffix}` is safer and may have better performance as there is no\nslicing which may panic and the compiler does not need to insert this panic code. It is\nalso sometimes more readable as it removes the need for duplicating or storing the pattern\nused by `str::{starts,ends}_with` and in the slicing.\n\n### Example\n```rust\nlet s = \"hello, world!\";\nif s.starts_with(\"hello, \") {\n assert_eq!(s[\"hello, \".len()..].to_uppercase(), \"WORLD!\");\n}\n```\nUse instead:\n```rust\nlet s = \"hello, world!\";\nif let Some(end) = s.strip_prefix(\"hello, \") {\n assert_eq!(end.to_uppercase(), \"WORLD!\");\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.48.0", "applicability": { "is_multi_part_suggestion": false, @@ -4470,7 +4470,7 @@ }, "group": "perf", "level": "warn", - "docs": "\n### What it does\nChecks for usage of `Iterator::fold` with a type that implements `Try`.\n\n### Why is this bad?\nThe code should use `try_fold` instead, which short-circuits on failure, thus opening the\ndoor for additional optimizations not possible with `fold` as rustc can guarantee the\nfunction is never called on `None`, `Err`, etc., alleviating otherwise necessary checks. It's\nalso slightly more idiomatic.\n\n### Known issues\nThis lint doesn't take into account whether a function does something on the failure case,\ni.e., whether short-circuiting will affect behavior. Refactoring to `try_fold` is not\ndesirable in those cases.\n\n### Example\n```rust\nvec![1, 2, 3].iter().fold(Some(0i32), |sum, i| sum?.checked_add(*i));\n```\nUse instead:\n```rust\nvec![1, 2, 3].iter().try_fold(0i32, |sum, i| sum.checked_add(*i));\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of `Iterator::fold` with a type that implements `Try`.\n\n### Why is this bad?\nThe code should use `try_fold` instead, which short-circuits on failure, thus opening the\ndoor for additional optimizations not possible with `fold` as rustc can guarantee the\nfunction is never called on `None`, `Err`, etc., alleviating otherwise necessary checks. It's\nalso slightly more idiomatic.\n\n### Known issues\nThis lint doesn't take into account whether a function does something on the failure case,\ni.e., whether short-circuiting will affect behavior. Refactoring to `try_fold` is not\ndesirable in those cases.\n\n### Example\n```rust\nvec![1, 2, 3].iter().fold(Some(0i32), |sum, i| sum?.checked_add(*i));\n```\nUse instead:\n```rust\nvec![1, 2, 3].iter().try_fold(0i32, |sum, i| sum.checked_add(*i));\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.72.0", "applicability": { "is_multi_part_suggestion": false, @@ -4530,7 +4530,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for usage of `map(|x| x.clone())` or\ndereferencing closures for `Copy` types, on `Iterator` or `Option`,\nand suggests `cloned()` or `copied()` instead\n\n### Why is this bad?\nReadability, this can be written more concisely\n\n### Example\n```rust\nlet x = vec![42, 43];\nlet y = x.iter();\nlet z = y.map(|i| *i);\n```\n\nThe correct use would be:\n\n```rust\nlet x = vec![42, 43];\nlet y = x.iter();\nlet z = y.cloned();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of `map(|x| x.clone())` or\ndereferencing closures for `Copy` types, on `Iterator` or `Option`,\nand suggests `cloned()` or `copied()` instead\n\n### Why is this bad?\nReadability, this can be written more concisely\n\n### Example\n```rust\nlet x = vec![42, 43];\nlet y = x.iter();\nlet z = y.map(|i| *i);\n```\n\nThe correct use would be:\n\n```rust\nlet x = vec![42, 43];\nlet y = x.iter();\nlet z = y.cloned();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "pre 1.29.0", "applicability": { "is_multi_part_suggestion": false, @@ -4620,7 +4620,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nChecks for usage of `option.map(_).unwrap_or(_)` or `option.map(_).unwrap_or_else(_)` or\n`result.map(_).unwrap_or_else(_)`.\n\n### Why is this bad?\nReadability, these can be written more concisely (resp.) as\n`option.map_or(_, _)`, `option.map_or_else(_, _)` and `result.map_or_else(_, _)`.\n\n### Known problems\nThe order of the arguments is not in execution order\n\n### Examples\n```rust\noption.map(|a| a + 1).unwrap_or(0);\noption.map(|a| a > 10).unwrap_or(false);\nresult.map(|a| a + 1).unwrap_or_else(some_function);\n```\n\nUse instead:\n```rust\noption.map_or(0, |a| a + 1);\noption.is_some_and(|a| a > 10);\nresult.map_or_else(some_function, |a| a + 1);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n\n### Past names\n\n* `option_map_unwrap_or`\n* `option_map_unwrap_or_else`\n* `result_map_unwrap_or_else`\n\n", + "docs": "\n### What it does\nChecks for usage of `option.map(_).unwrap_or(_)` or `option.map(_).unwrap_or_else(_)` or\n`result.map(_).unwrap_or_else(_)`.\n\n### Why is this bad?\nReadability, these can be written more concisely (resp.) as\n`option.map_or(_, _)`, `option.map_or_else(_, _)` and `result.map_or_else(_, _)`.\n\n### Known problems\nThe order of the arguments is not in execution order\n\n### Examples\n```rust\noption.map(|a| a + 1).unwrap_or(0);\noption.map(|a| a > 10).unwrap_or(false);\nresult.map(|a| a + 1).unwrap_or_else(some_function);\n```\n\nUse instead:\n```rust\noption.map_or(0, |a| a + 1);\noption.is_some_and(|a| a > 10);\nresult.map_or_else(some_function, |a| a + 1);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n\n### Past names\n\n* `option_map_unwrap_or`\n* `option_map_unwrap_or_else`\n* `result_map_unwrap_or_else`\n\n", "version": "1.45.0", "applicability": { "is_multi_part_suggestion": false, @@ -4670,7 +4670,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for `match` or `if let` expressions producing a\n`bool` that could be written using `matches!`\n\n### Why is this bad?\nReadability and needless complexity.\n\n### Known problems\nThis lint falsely triggers, if there are arms with\n`cfg` attributes that remove an arm evaluating to `false`.\n\n### Example\n```rust\nlet x = Some(5);\n\nlet a = match x {\n Some(0) => true,\n _ => false,\n};\n\nlet a = if let Some(0) = x {\n true\n} else {\n false\n};\n```\n\nUse instead:\n```rust\nlet x = Some(5);\nlet a = matches!(x, Some(0));\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for `match` or `if let` expressions producing a\n`bool` that could be written using `matches!`\n\n### Why is this bad?\nReadability and needless complexity.\n\n### Known problems\nThis lint falsely triggers, if there are arms with\n`cfg` attributes that remove an arm evaluating to `false`.\n\n### Example\n```rust\nlet x = Some(5);\n\nlet a = match x {\n Some(0) => true,\n _ => false,\n};\n\nlet a = if let Some(0) = x {\n true\n} else {\n false\n};\n```\n\nUse instead:\n```rust\nlet x = Some(5);\nlet a = matches!(x, Some(0));\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.47.0", "applicability": { "is_multi_part_suggestion": false, @@ -4883,7 +4883,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for `std::mem::replace` on a value of type\n`T` with `T::default()`.\n\n### Why is this bad?\n`std::mem` module already has the method `take` to\ntake the current value and replace it with the default value of that type.\n\n### Example\n```rust\nlet mut text = String::from(\"foo\");\nlet replaced = std::mem::replace(&mut text, String::default());\n```\nIs better expressed with:\n```rust\nlet mut text = String::from(\"foo\");\nlet taken = std::mem::take(&mut text);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for `std::mem::replace` on a value of type\n`T` with `T::default()`.\n\n### Why is this bad?\n`std::mem` module already has the method `take` to\ntake the current value and replace it with the default value of that type.\n\n### Example\n```rust\nlet mut text = String::from(\"foo\");\nlet replaced = std::mem::replace(&mut text, String::default());\n```\nIs better expressed with:\n```rust\nlet mut text = String::from(\"foo\");\nlet taken = std::mem::take(&mut text);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.42.0", "applicability": { "is_multi_part_suggestion": false, @@ -5048,7 +5048,7 @@ }, "group": "nursery", "level": "allow", - "docs": "\n### What it does\nSuggests the use of `const` in functions and methods where possible.\n\n### Why is this bad?\nNot having the function const prevents callers of the function from being const as well.\n\n### Known problems\nConst functions are currently still being worked on, with some features only being available\non nightly. This lint does not consider all edge cases currently and the suggestions may be\nincorrect if you are using this lint on stable.\n\nAlso, the lint only runs one pass over the code. Consider these two non-const functions:\n\n```rust\nfn a() -> i32 {\n 0\n}\nfn b() -> i32 {\n a()\n}\n```\n\nWhen running Clippy, the lint will only suggest to make `a` const, because `b` at this time\ncan't be const as it calls a non-const function. Making `a` const and running Clippy again,\nwill suggest to make `b` const, too.\n\nIf you are marking a public function with `const`, removing it again will break API compatibility.\n### Example\n```rust\nfn new() -> Self {\n Self { random_number: 42 }\n}\n```\n\nCould be a const fn:\n\n```rust\nconst fn new() -> Self {\n Self { random_number: 42 }\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nSuggests the use of `const` in functions and methods where possible.\n\n### Why is this bad?\nNot having the function const prevents callers of the function from being const as well.\n\n### Known problems\nConst functions are currently still being worked on, with some features only being available\non nightly. This lint does not consider all edge cases currently and the suggestions may be\nincorrect if you are using this lint on stable.\n\nAlso, the lint only runs one pass over the code. Consider these two non-const functions:\n\n```rust\nfn a() -> i32 {\n 0\n}\nfn b() -> i32 {\n a()\n}\n```\n\nWhen running Clippy, the lint will only suggest to make `a` const, because `b` at this time\ncan't be const as it calls a non-const function. Making `a` const and running Clippy again,\nwill suggest to make `b` const, too.\n\nIf you are marking a public function with `const`, removing it again will break API compatibility.\n### Example\n```rust\nfn new() -> Self {\n Self { random_number: 42 }\n}\n```\n\nCould be a const fn:\n\n```rust\nconst fn new() -> Self {\n Self { random_number: 42 }\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.34.0", "applicability": { "is_multi_part_suggestion": false, @@ -5594,7 +5594,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for address of operations (`&`) that are going to\nbe dereferenced immediately by the compiler.\n\n### Why is this bad?\nSuggests that the receiver of the expression borrows\nthe expression.\n\n### Known problems\nThe lint cannot tell when the implementation of a trait\nfor `&T` and `T` do different things. Removing a borrow\nin such a case can change the semantics of the code.\n\n### Example\n```rust\nfn fun(_a: &i32) {}\n\nlet x: &i32 = &&&&&&5;\nfun(&x);\n```\n\nUse instead:\n```rust\nlet x: &i32 = &5;\nfun(x);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n\n### Past names\n\n* `ref_in_deref`\n\n", + "docs": "\n### What it does\nChecks for address of operations (`&`) that are going to\nbe dereferenced immediately by the compiler.\n\n### Why is this bad?\nSuggests that the receiver of the expression borrows\nthe expression.\n\n### Known problems\nThe lint cannot tell when the implementation of a trait\nfor `&T` and `T` do different things. Removing a borrow\nin such a case can change the semantics of the code.\n\n### Example\n```rust\nfn fun(_a: &i32) {}\n\nlet x: &i32 = &&&&&&5;\nfun(&x);\n```\n\nUse instead:\n```rust\nlet x: &i32 = &5;\nfun(x);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n\n### Past names\n\n* `ref_in_deref`\n\n", "version": "pre 1.29.0", "applicability": { "is_multi_part_suggestion": false, @@ -6371,7 +6371,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nChecks for usage of `_.as_ref().map(Deref::deref)` or its aliases (such as String::as_str).\n\n### Why is this bad?\nReadability, this can be written more concisely as\n`_.as_deref()`.\n\n### Example\n```rust\nopt.as_ref().map(String::as_str)\n```\nCan be written as\n```rust\nopt.as_deref()\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for usage of `_.as_ref().map(Deref::deref)` or its aliases (such as String::as_str).\n\n### Why is this bad?\nReadability, this can be written more concisely as\n`_.as_deref()`.\n\n### Example\n```rust\nopt.as_ref().map(String::as_str)\n```\nCan be written as\n```rust\nopt.as_deref()\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.42.0", "applicability": { "is_multi_part_suggestion": false, @@ -6839,7 +6839,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nChecks for `as` casts between raw pointers without changing its mutability,\nnamely `*const T` to `*const U` and `*mut T` to `*mut U`.\n\n### Why is this bad?\nThough `as` casts between raw pointers are not terrible, `pointer::cast` is safer because\nit cannot accidentally change the pointer's mutability nor cast the pointer to other types like `usize`.\n\n### Example\n```rust\nlet ptr: *const u32 = &42_u32;\nlet mut_ptr: *mut u32 = &mut 42_u32;\nlet _ = ptr as *const i32;\nlet _ = mut_ptr as *mut i32;\n```\nUse instead:\n```rust\nlet ptr: *const u32 = &42_u32;\nlet mut_ptr: *mut u32 = &mut 42_u32;\nlet _ = ptr.cast::();\nlet _ = mut_ptr.cast::();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for `as` casts between raw pointers without changing its mutability,\nnamely `*const T` to `*const U` and `*mut T` to `*mut U`.\n\n### Why is this bad?\nThough `as` casts between raw pointers are not terrible, `pointer::cast` is safer because\nit cannot accidentally change the pointer's mutability nor cast the pointer to other types like `usize`.\n\n### Example\n```rust\nlet ptr: *const u32 = &42_u32;\nlet mut_ptr: *mut u32 = &mut 42_u32;\nlet _ = ptr as *const i32;\nlet _ = mut_ptr as *mut i32;\n```\nUse instead:\n```rust\nlet ptr: *const u32 = &42_u32;\nlet mut_ptr: *mut u32 = &mut 42_u32;\nlet _ = ptr.cast::();\nlet _ = mut_ptr.cast::();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.51.0", "applicability": { "is_multi_part_suggestion": false, @@ -7322,7 +7322,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for fields in struct literals where shorthands\ncould be used.\n\n### Why is this bad?\nIf the field and variable names are the same,\nthe field name is redundant.\n\n### Example\n```rust\nlet bar: u8 = 123;\n\nstruct Foo {\n bar: u8,\n}\n\nlet foo = Foo { bar: bar };\n```\nthe last line can be simplified to\n```rust\nlet foo = Foo { bar };\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for fields in struct literals where shorthands\ncould be used.\n\n### Why is this bad?\nIf the field and variable names are the same,\nthe field name is redundant.\n\n### Example\n```rust\nlet bar: u8 = 123;\n\nstruct Foo {\n bar: u8,\n}\n\nlet foo = Foo { bar: bar };\n```\nthe last line can be simplified to\n```rust\nlet foo = Foo { bar };\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "pre 1.29.0", "applicability": { "is_multi_part_suggestion": false, @@ -7427,7 +7427,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nChecks for constants and statics with an explicit `'static` lifetime.\n\n### Why is this bad?\nAdding `'static` to every reference can create very\ncomplicated types.\n\n### Example\n```rust\nconst FOO: &'static [(&'static str, &'static str, fn(&Bar) -> bool)] =\n&[...]\nstatic FOO: &'static [(&'static str, &'static str, fn(&Bar) -> bool)] =\n&[...]\n```\nThis code can be rewritten as\n```rust\n const FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]\n static FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n\n### Past names\n\n* `const_static_lifetime`\n\n", + "docs": "\n### What it does\nChecks for constants and statics with an explicit `'static` lifetime.\n\n### Why is this bad?\nAdding `'static` to every reference can create very\ncomplicated types.\n\n### Example\n```rust\nconst FOO: &'static [(&'static str, &'static str, fn(&Bar) -> bool)] =\n&[...]\nstatic FOO: &'static [(&'static str, &'static str, fn(&Bar) -> bool)] =\n&[...]\n```\nThis code can be rewritten as\n```rust\n const FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]\n static FOO: &[(&str, &str, fn(&Bar) -> bool)] = &[...]\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n\n### Past names\n\n* `const_static_lifetime`\n\n", "version": "1.37.0", "applicability": { "is_multi_part_suggestion": false, @@ -7730,7 +7730,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\n\nChecks an argument of `seek` method of `Seek` trait\nand if it start seek from `SeekFrom::Current(0)`, suggests `stream_position` instead.\n\n### Why is this bad?\n\nReadability. Use dedicated method.\n\n### Example\n\n```rust\nuse std::fs::File;\nuse std::io::{self, Write, Seek, SeekFrom};\n\nfn main() -> io::Result<()> {\n let mut f = File::create(\"foo.txt\")?;\n f.write_all(b\"Hello\")?;\n eprintln!(\"Written {} bytes\", f.seek(SeekFrom::Current(0))?);\n\n Ok(())\n}\n```\nUse instead:\n```rust\nuse std::fs::File;\nuse std::io::{self, Write, Seek, SeekFrom};\n\nfn main() -> io::Result<()> {\n let mut f = File::create(\"foo.txt\")?;\n f.write_all(b\"Hello\")?;\n eprintln!(\"Written {} bytes\", f.stream_position()?);\n\n Ok(())\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\n\nChecks an argument of `seek` method of `Seek` trait\nand if it start seek from `SeekFrom::Current(0)`, suggests `stream_position` instead.\n\n### Why is this bad?\n\nReadability. Use dedicated method.\n\n### Example\n\n```rust\nuse std::fs::File;\nuse std::io::{self, Write, Seek, SeekFrom};\n\nfn main() -> io::Result<()> {\n let mut f = File::create(\"foo.txt\")?;\n f.write_all(b\"Hello\")?;\n eprintln!(\"Written {} bytes\", f.seek(SeekFrom::Current(0))?);\n\n Ok(())\n}\n```\nUse instead:\n```rust\nuse std::fs::File;\nuse std::io::{self, Write, Seek, SeekFrom};\n\nfn main() -> io::Result<()> {\n let mut f = File::create(\"foo.txt\")?;\n f.write_all(b\"Hello\")?;\n eprintln!(\"Written {} bytes\", f.stream_position()?);\n\n Ok(())\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.67.0", "applicability": { "is_multi_part_suggestion": false, @@ -8963,7 +8963,7 @@ }, "group": "complexity", "level": "warn", - "docs": "\n### What it does\nChecks for transmutes from a pointer to a reference.\n\n### Why is this bad?\nThis can always be rewritten with `&` and `*`.\n\n### Known problems\n- `mem::transmute` in statics and constants is stable from Rust 1.46.0,\nwhile dereferencing raw pointer is not stable yet.\nIf you need to do this in those places,\nyou would have to use `transmute` instead.\n\n### Example\n```rust\nunsafe {\n let _: &T = std::mem::transmute(p); // where p: *const T\n}\n\n// can be written:\nlet _: &T = &*p;\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for transmutes from a pointer to a reference.\n\n### Why is this bad?\nThis can always be rewritten with `&` and `*`.\n\n### Known problems\n- `mem::transmute` in statics and constants is stable from Rust 1.46.0,\nwhile dereferencing raw pointer is not stable yet.\nIf you need to do this in those places,\nyou would have to use `transmute` instead.\n\n### Example\n```rust\nunsafe {\n let _: &T = std::mem::transmute(p); // where p: *const T\n}\n\n// can be written:\nlet _: &T = &*p;\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "pre 1.29.0", "applicability": { "is_multi_part_suggestion": false, @@ -9083,7 +9083,7 @@ }, "group": "nursery", "level": "allow", - "docs": "\n### What it does\nChecks for tuple<=>array conversions that are not done with `.into()`.\n\n### Why is this bad?\nIt may be unnecessary complexity. `.into()` works for converting tuples<=> arrays of up to\n12 elements and conveys the intent more clearly, while also leaving less room for hard to\nspot bugs!\n\n### Known issues\nThe suggested code may hide potential asymmetry in some cases. See\n[#11085](https://github.com/rust-lang/rust-clippy/issues/11085) for more info.\n\n### Example\n```rust\nlet t1 = &[(1, 2), (3, 4)];\nlet v1: Vec<[u32; 2]> = t1.iter().map(|&(a, b)| [a, b]).collect();\n```\nUse instead:\n```rust\nlet t1 = &[(1, 2), (3, 4)];\nlet v1: Vec<[u32; 2]> = t1.iter().map(|&t| t.into()).collect();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for tuple<=>array conversions that are not done with `.into()`.\n\n### Why is this bad?\nIt may be unnecessary complexity. `.into()` works for converting tuples<=> arrays of up to\n12 elements and conveys the intent more clearly, while also leaving less room for hard to\nspot bugs!\n\n### Known issues\nThe suggested code may hide potential asymmetry in some cases. See\n[#11085](https://github.com/rust-lang/rust-clippy/issues/11085) for more info.\n\n### Example\n```rust\nlet t1 = &[(1, 2), (3, 4)];\nlet v1: Vec<[u32; 2]> = t1.iter().map(|&(a, b)| [a, b]).collect();\n```\nUse instead:\n```rust\nlet t1 = &[(1, 2), (3, 4)];\nlet v1: Vec<[u32; 2]> = t1.iter().map(|&t| t.into()).collect();\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.72.0", "applicability": { "is_multi_part_suggestion": false, @@ -9128,7 +9128,7 @@ }, "group": "nursery", "level": "allow", - "docs": "\n### What it does\nThis lint warns about unnecessary type repetitions in trait bounds\n\n### Why is this bad?\nRepeating the type for every bound makes the code\nless readable than combining the bounds\n\n### Example\n```rust\npub fn foo(t: T) where T: Copy, T: Clone {}\n```\n\nUse instead:\n```rust\npub fn foo(t: T) where T: Copy + Clone {}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n* `max-trait-bounds`: `u64`(defaults to `3`): The maximum number of bounds a trait can have to be linted\n", + "docs": "\n### What it does\nThis lint warns about unnecessary type repetitions in trait bounds\n\n### Why is this bad?\nRepeating the type for every bound makes the code\nless readable than combining the bounds\n\n### Example\n```rust\npub fn foo(t: T) where T: Copy, T: Clone {}\n```\n\nUse instead:\n```rust\npub fn foo(t: T) where T: Copy + Clone {}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n* `max-trait-bounds`: `u64`(defaults to `3`): The maximum number of bounds a trait can have to be linted\n", "version": "1.38.0", "applicability": { "is_multi_part_suggestion": false, @@ -9143,7 +9143,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nLints subtraction between an [`Instant`] and a [`Duration`].\n\n### Why is this bad?\nUnchecked subtraction could cause underflow on certain platforms, leading to\nunintentional panics.\n\n### Example\n```rust\nlet time_passed = Instant::now() - Duration::from_secs(5);\n```\n\nUse instead:\n```rust\nlet time_passed = Instant::now().checked_sub(Duration::from_secs(5));\n```\n\n[`Duration`]: std::time::Duration\n[`Instant::now()`]: std::time::Instant::now;\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nLints subtraction between an [`Instant`] and a [`Duration`].\n\n### Why is this bad?\nUnchecked subtraction could cause underflow on certain platforms, leading to\nunintentional panics.\n\n### Example\n```rust\nlet time_passed = Instant::now() - Duration::from_secs(5);\n```\n\nUse instead:\n```rust\nlet time_passed = Instant::now().checked_sub(Duration::from_secs(5));\n```\n\n[`Duration`]: std::time::Duration\n[`Instant::now()`]: std::time::Instant::now;\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.67.0", "applicability": { "is_multi_part_suggestion": false, @@ -9233,7 +9233,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nDetect when a variable is not inlined in a format string,\nand suggests to inline it.\n\n### Why is this bad?\nNon-inlined code is slightly more difficult to read and understand,\nas it requires arguments to be matched against the format string.\nThe inlined syntax, where allowed, is simpler.\n\n### Example\n```rust\nformat!(\"{}\", var);\nformat!(\"{v:?}\", v = var);\nformat!(\"{0} {0}\", var);\nformat!(\"{0:1$}\", var, width);\nformat!(\"{:.*}\", prec, var);\n```\nUse instead:\n```rust\nformat!(\"{var}\");\nformat!(\"{var:?}\");\nformat!(\"{var} {var}\");\nformat!(\"{var:width$}\");\nformat!(\"{var:.prec$}\");\n```\n\nIf allow-mixed-uninlined-format-args is set to false in clippy.toml,\nthe following code will also trigger the lint:\n```rust\nformat!(\"{} {}\", var, 1+2);\n```\nUse instead:\n```rust\nformat!(\"{var} {}\", 1+2);\n```\n\n### Known Problems\n\nIf a format string contains a numbered argument that cannot be inlined\nnothing will be suggested, e.g. `println!(\"{0}={1}\", var, 1+2)`.\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n* `allow-mixed-uninlined-format-args`: `bool`(defaults to `true`): Whether to allow mixed uninlined format args, e.g. `format!(\"{} {}\", a, foo.bar)`\n", + "docs": "\n### What it does\nDetect when a variable is not inlined in a format string,\nand suggests to inline it.\n\n### Why is this bad?\nNon-inlined code is slightly more difficult to read and understand,\nas it requires arguments to be matched against the format string.\nThe inlined syntax, where allowed, is simpler.\n\n### Example\n```rust\nformat!(\"{}\", var);\nformat!(\"{v:?}\", v = var);\nformat!(\"{0} {0}\", var);\nformat!(\"{0:1$}\", var, width);\nformat!(\"{:.*}\", prec, var);\n```\nUse instead:\n```rust\nformat!(\"{var}\");\nformat!(\"{var:?}\");\nformat!(\"{var} {var}\");\nformat!(\"{var:width$}\");\nformat!(\"{var:.prec$}\");\n```\n\nIf allow-mixed-uninlined-format-args is set to false in clippy.toml,\nthe following code will also trigger the lint:\n```rust\nformat!(\"{} {}\", var, 1+2);\n```\nUse instead:\n```rust\nformat!(\"{var} {}\", 1+2);\n```\n\n### Known Problems\n\nIf a format string contains a numbered argument that cannot be inlined\nnothing will be suggested, e.g. `println!(\"{0}={1}\", var, 1+2)`.\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n* `allow-mixed-uninlined-format-args`: `bool`(defaults to `true`): Whether to allow mixed uninlined format args, e.g. `format!(\"{} {}\", a, foo.bar)`\n", "version": "1.66.0", "applicability": { "is_multi_part_suggestion": false, @@ -9398,7 +9398,7 @@ }, "group": "style", "level": "warn", - "docs": "\n### What it does\nAs 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`\n - `then` to `then_some` (for msrv >= 1.62.0)\n\n### Why is this bad?\nUsing eager evaluation is shorter and simpler in some cases.\n\n### Known problems\nIt is possible, but not recommended for `Deref` and `Index` to have\nside effects. Eagerly evaluating them can change the semantics of the program.\n\n### Example\n```rust\n// example code where clippy issues a warning\nlet opt: Option = None;\n\nopt.unwrap_or_else(|| 42);\n```\nUse instead:\n```rust\nlet opt: Option = None;\n\nopt.unwrap_or(42);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nAs 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`\n - `then` to `then_some` (for msrv >= 1.62.0)\n\n### Why is this bad?\nUsing eager evaluation is shorter and simpler in some cases.\n\n### Known problems\nIt is possible, but not recommended for `Deref` and `Index` to have\nside effects. Eagerly evaluating them can change the semantics of the program.\n\n### Example\n```rust\n// example code where clippy issues a warning\nlet opt: Option = None;\n\nopt.unwrap_or_else(|| 42);\n```\nUse instead:\n```rust\nlet opt: Option = None;\n\nopt.unwrap_or(42);\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.48.0", "applicability": { "is_multi_part_suggestion": false, @@ -9638,7 +9638,7 @@ }, "group": "pedantic", "level": "allow", - "docs": "\n### What it does\nChecks 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)*.\n\n### Why is this bad?\nIn the example above, `Some` is repeated, which unnecessarily complicates the pattern.\n\n### Example\n```rust\nfn main() {\n if let Some(0) | Some(2) = Some(0) {}\n}\n```\nUse instead:\n```rust\nfn main() {\n if let Some(0 | 2) = Some(0) {}\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks 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)*.\n\n### Why is this bad?\nIn the example above, `Some` is repeated, which unnecessarily complicates the pattern.\n\n### Example\n```rust\nfn main() {\n if let Some(0) | Some(2) = Some(0) {}\n}\n```\nUse instead:\n```rust\nfn main() {\n if let Some(0 | 2) = Some(0) {}\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "1.46.0", "applicability": { "is_multi_part_suggestion": false, @@ -10005,7 +10005,7 @@ }, "group": "nursery", "level": "allow", - "docs": "\n### What it does\nChecks for unnecessary repetition of structure name when a\nreplacement with `Self` is applicable.\n\n### Why is this bad?\nUnnecessary repetition. Mixed use of `Self` and struct\nname\nfeels inconsistent.\n\n### Known problems\n- Unaddressed false negative in fn bodies of trait implementations\n\n### Example\n```rust\nstruct Foo;\nimpl Foo {\n fn new() -> Foo {\n Foo {}\n }\n}\n```\ncould be\n```rust\nstruct Foo;\nimpl Foo {\n fn new() -> Self {\n Self {}\n }\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `Option`(defaults to `None`): The minimum rust version that the project supports\n", + "docs": "\n### What it does\nChecks for unnecessary repetition of structure name when a\nreplacement with `Self` is applicable.\n\n### Why is this bad?\nUnnecessary repetition. Mixed use of `Self` and struct\nname\nfeels inconsistent.\n\n### Known problems\n- Unaddressed false negative in fn bodies of trait implementations\n\n### Example\n```rust\nstruct Foo;\nimpl Foo {\n fn new() -> Foo {\n Foo {}\n }\n}\n```\ncould be\n```rust\nstruct Foo;\nimpl Foo {\n fn new() -> Self {\n Self {}\n }\n}\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `msrv`: `crate::Msrv`(defaults to `Msrv { stack: [] }`): The minimum rust version that the project supports\n", "version": "pre 1.29.0", "applicability": { "is_multi_part_suggestion": false,