diff options
| author | bors <bors@rust-lang.org> | 2023-08-30 19:51:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-30 19:51:32 +0000 |
| commit | 3da21b089ffe8337142fc054d3230749a304d832 (patch) | |
| tree | 53258de55f12309a8282967013cf8ed2a779ba09 /clippy_utils | |
| parent | b97eaab558bd37f665b10a79fd5aecea3dde920f (diff) | |
| parent | 33cc140f55e254c7c88e81b059afcc430bba3e5e (diff) | |
Auto merge of #11396 - y21:issue11345, r=Jarcho
new lint: `iter_out_of_bounds` Closes #11345 The original idea in the linked issue seemed to be just about arrays afaict, but I extended this to catch some other iterator sources such as `iter::once` or `iter::empty`. I'm not entirely sure if this name makes a lot of sense now that it's not just about arrays anymore (specifically, not sure if you can call `.take(1)` on an `iter::Empty` to be "out of bounds"?). changelog: [`iter_out_of_bounds`]: new lint
Diffstat (limited to 'clippy_utils')
| -rw-r--r-- | clippy_utils/src/paths.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clippy_utils/src/paths.rs b/clippy_utils/src/paths.rs index a567c5cbdc9..2fb24b5c7ed 100644 --- a/clippy_utils/src/paths.rs +++ b/clippy_utils/src/paths.rs @@ -49,6 +49,7 @@ pub const IDENT: [&str; 3] = ["rustc_span", "symbol", "Ident"]; pub const IDENT_AS_STR: [&str; 4] = ["rustc_span", "symbol", "Ident", "as_str"]; pub const INSERT_STR: [&str; 4] = ["alloc", "string", "String", "insert_str"]; pub const ITER_EMPTY: [&str; 5] = ["core", "iter", "sources", "empty", "Empty"]; +pub const ITER_ONCE: [&str; 5] = ["core", "iter", "sources", "once", "Once"]; pub const ITERTOOLS_NEXT_TUPLE: [&str; 3] = ["itertools", "Itertools", "next_tuple"]; #[cfg(feature = "internal")] pub const KW_MODULE: [&str; 3] = ["rustc_span", "symbol", "kw"]; @@ -163,3 +164,4 @@ pub const DEBUG_STRUCT: [&str; 4] = ["core", "fmt", "builders", "DebugStruct"]; pub const ORD_CMP: [&str; 4] = ["core", "cmp", "Ord", "cmp"]; #[expect(clippy::invalid_paths)] // not sure why it thinks this, it works so pub const BOOL_THEN: [&str; 4] = ["core", "bool", "<impl bool>", "then"]; +pub const ARRAY_INTO_ITER: [&str; 4] = ["core", "array", "iter", "IntoIter"]; |
