File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 11//@run-rustfix
22
33#![allow(clippy::unnecessary_operation)]
4+ #![allow(clippy::slice_as_bytes)]
45#![warn(clippy::bytes_nth)]
56
67fn main() {
Original file line number Diff line number Diff line change 11//@run-rustfix
22
33#![ allow( clippy:: unnecessary_operation) ]
4+ #![ allow( clippy:: slice_as_bytes) ]
45#![ warn( clippy:: bytes_nth) ]
56
67fn main ( ) {
Original file line number Diff line number Diff line change 11error: called `.bytes().nth()` on a `String`
2- --> $DIR/bytes_nth.rs:8 :13
2+ --> $DIR/bytes_nth.rs:9 :13
33 |
44LL | let _ = s.bytes().nth(3);
55 | ^^^^^^^^^^^^^^^^ help: try: `s.as_bytes().get(3).copied()`
66 |
77 = note: `-D clippy::bytes-nth` implied by `-D warnings`
88
99error: called `.bytes().nth().unwrap()` on a `String`
10- --> $DIR/bytes_nth.rs:9 :14
10+ --> $DIR/bytes_nth.rs:10 :14
1111 |
1212LL | let _ = &s.bytes().nth(3).unwrap();
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.as_bytes()[3]`
1414
1515error: called `.bytes().nth()` on a `str`
16- --> $DIR/bytes_nth.rs:10 :13
16+ --> $DIR/bytes_nth.rs:11 :13
1717 |
1818LL | let _ = s[..].bytes().nth(3);
1919 | ^^^^^^^^^^^^^^^^^^^^ help: try: `s[..].as_bytes().get(3).copied()`
You can’t perform that action at this time.
0 commit comments