]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/bytes_nth.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / tools / clippy / tests / ui / bytes_nth.rs
diff --git a/src/tools/clippy/tests/ui/bytes_nth.rs b/src/tools/clippy/tests/ui/bytes_nth.rs
new file mode 100644 (file)
index 0000000..629812c
--- /dev/null
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#![allow(clippy::unnecessary_operation)]
+#![warn(clippy::bytes_nth)]
+
+fn main() {
+    let s = String::from("String");
+    s.bytes().nth(3);
+    &s.bytes().nth(3);
+    s[..].bytes().nth(3);
+}