diff options
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/tests/ui/bytes_nth.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/bytes_nth.rs b/src/tools/clippy/tests/ui/bytes_nth.rs new file mode 100644 index 000000000..034c54e6a --- /dev/null +++ b/src/tools/clippy/tests/ui/bytes_nth.rs @@ -0,0 +1,11 @@ +// run-rustfix + +#![allow(clippy::unnecessary_operation)] +#![warn(clippy::bytes_nth)] + +fn main() { + let s = String::from("String"); + let _ = s.bytes().nth(3); + let _ = &s.bytes().nth(3); + let _ = s[..].bytes().nth(3); +} |