From 79b368fda64a4f6f8c4aeec9d8435e96c311844c Mon Sep 17 00:00:00 2001 From: GHA CI Date: Fri, 29 Sep 2023 02:14:21 +0000 Subject: [PATCH] Automatic deploy to GitHub Pages: d38fa1a32dd265793a64c1543de45a7d2fde0d0b --- master/lints.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/master/lints.json b/master/lints.json index 4c45a7fdd92e..9398bc497875 100644 --- a/master/lints.json +++ b/master/lints.json @@ -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": {