about summary refs log tree commit diff
diff options
context:
space:
mode:
authory21 <30553356+y21@users.noreply.github.com>2024-12-03 04:24:56 +0100
committery21 <30553356+y21@users.noreply.github.com>2025-03-30 13:39:01 +0200
commit32cf88450bd1d97a1ec1cfcb67c04173ea92db3c (patch)
tree360fdd8dd090835c74962a71a6dbb0000e596b11
parentfb32aaf9ac75b503e0f344dc32ad2bf0f50f6952 (diff)
downloadrust-32cf88450bd1d97a1ec1cfcb67c04173ea92db3c.tar.gz
rust-32cf88450bd1d97a1ec1cfcb67c04173ea92db3c.zip
add a note for `str::bytes`
-rw-r--r--clippy_lints/src/loops/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/clippy_lints/src/loops/mod.rs b/clippy_lints/src/loops/mod.rs
index 10ba739909f..9a3fd147fb5 100644
--- a/clippy_lints/src/loops/mod.rs
+++ b/clippy_lints/src/loops/mod.rs
@@ -758,7 +758,8 @@ declare_clippy_lint! {
     /// Instead of `.chars().enumerate()`, the correct iterator to use is `.char_indices()`, which yields byte indices.
     ///
     /// This pattern is technically fine if the strings are known to only use the ASCII subset,
-    /// but there is also no downside to just using `.char_indices()` directly.
+    /// though in those cases it would be better to use `bytes()` directly to make the intent clearer,
+    /// but there is also no downside to just using `.char_indices()` directly and supporting non-ASCII strings.
     ///
     /// You may also want to read the [chapter on strings in the Rust Book](https://doc.rust-lang.org/book/ch08-02-strings.html)
     /// which goes into this in more detail.