]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/bytes_nth.fixed
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / bytes_nth.fixed
diff --git a/src/tools/clippy/tests/ui/bytes_nth.fixed b/src/tools/clippy/tests/ui/bytes_nth.fixed
new file mode 100644 (file)
index 0000000..bf68a7b
--- /dev/null
@@ -0,0 +1,11 @@
+// run-rustfix
+
+#![allow(clippy::unnecessary_operation)]
+#![warn(clippy::bytes_nth)]
+
+fn main() {
+    let s = String::from("String");
+    s.as_bytes().get(3);
+    &s.as_bytes().get(3);
+    s[..].as_bytes().get(3);
+}