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 1
1
//@run-rustfix
2
2
3
3
#![allow(clippy::unnecessary_operation)]
4
+ #![allow(clippy::slice_as_bytes)]
4
5
#![warn(clippy::bytes_nth)]
5
6
6
7
fn main() {
Original file line number Diff line number Diff line change 1
1
//@run-rustfix
2
2
3
3
#![ allow( clippy:: unnecessary_operation) ]
4
+ #![ allow( clippy:: slice_as_bytes) ]
4
5
#![ warn( clippy:: bytes_nth) ]
5
6
6
7
fn main ( ) {
Original file line number Diff line number Diff line change 1
1
error: called `.bytes().nth()` on a `String`
2
- --> $DIR/bytes_nth.rs:8 :13
2
+ --> $DIR/bytes_nth.rs:9 :13
3
3
|
4
4
LL | let _ = s.bytes().nth(3);
5
5
| ^^^^^^^^^^^^^^^^ help: try: `s.as_bytes().get(3).copied()`
6
6
|
7
7
= note: `-D clippy::bytes-nth` implied by `-D warnings`
8
8
9
9
error: called `.bytes().nth().unwrap()` on a `String`
10
- --> $DIR/bytes_nth.rs:9 :14
10
+ --> $DIR/bytes_nth.rs:10 :14
11
11
|
12
12
LL | let _ = &s.bytes().nth(3).unwrap();
13
13
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.as_bytes()[3]`
14
14
15
15
error: called `.bytes().nth()` on a `str`
16
- --> $DIR/bytes_nth.rs:10 :13
16
+ --> $DIR/bytes_nth.rs:11 :13
17
17
|
18
18
LL | let _ = s[..].bytes().nth(3);
19
19
| ^^^^^^^^^^^^^^^^^^^^ help: try: `s[..].as_bytes().get(3).copied()`
You can’t perform that action at this time.
0 commit comments