Skip to content

Commit

Permalink
Automatic deploy to GitHub Pages: d38fa1a
Browse files Browse the repository at this point in the history
  • Loading branch information
GHA CI committed Sep 29, 2023
1 parent 9bc2d2a commit 79b368f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions master/lints.json
Original file line number Diff line number Diff line change
Expand Up @@ -3577,6 +3577,21 @@
"applicability": "MaybeIncorrect"
}
},
{
"id": "iter_without_into_iter",
"id_span": {
"path": "src/iter_without_into_iter.rs",
"line": 45
},
"group": "pedantic",
"level": "allow",
"docs": "\n### What it does\nLooks for `iter` and `iter_mut` methods without an associated `IntoIterator for (&|&mut) Type` implementation.\n\n### Why is this bad?\nIt's not bad, but having them is idiomatic and allows the type to be used in for loops directly\n(`for val in &iter {}`), without having to first call `iter()` or `iter_mut()`.\n\n### Example\n```rust\nstruct MySlice<'a>(&'a [u8]);\nimpl<'a> MySlice<'a> {\n pub fn iter(&self) -> std::slice::Iter<'a, u8> {\n self.0.iter()\n }\n}\n```\nUse instead:\n```rust\nstruct MySlice<'a>(&'a [u8]);\nimpl<'a> MySlice<'a> {\n pub fn iter(&self) -> std::slice::Iter<'a, u8> {\n self.0.iter()\n }\n}\nimpl<'a> IntoIterator for &MySlice<'a> {\n type Item = &'a u8;\n type IntoIter = std::slice::Iter<'a, u8>;\n fn into_iter(self) -> Self::IntoIter {\n self.iter()\n }\n}\n```",
"version": "1.74.0",
"applicability": {
"is_multi_part_suggestion": false,
"applicability": "Unspecified"
}
},
{
"id": "iterator_step_by_zero",
"id_span": {
Expand Down

0 comments on commit 79b368f

Please sign in to comment.