]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/bytes_nth.fixed
add some test cases
[rust.git] / tests / ui / bytes_nth.fixed
index 36bf8660a34c0c41ea15231b06f98c42eea0d6b7..bf68a7bbbf1d4e1b398b25216a0ee8009cb7dde0 100644 (file)
@@ -1,9 +1,11 @@
 // run-rustfix
 
+#![allow(clippy::unnecessary_operation)]
 #![warn(clippy::bytes_nth)]
 
 fn main() {
-    let _ = "Hello".as_bytes().get(3);
-
-    let _ = String::from("Hello").as_bytes().get(3);
+    let s = String::from("String");
+    s.as_bytes().get(3);
+    &s.as_bytes().get(3);
+    s[..].as_bytes().get(3);
 }