Skip to content

Commit 5bb3e85

Browse files
committed
Allow slice_as_bytes on bytes_nth
1 parent 5dd77b2 commit 5bb3e85

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

tests/ui/bytes_nth.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@run-rustfix
22

33
#![allow(clippy::unnecessary_operation)]
4+
#![allow(clippy::slice_as_bytes)]
45
#![warn(clippy::bytes_nth)]
56

67
fn main() {

tests/ui/bytes_nth.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@run-rustfix
22

33
#![allow(clippy::unnecessary_operation)]
4+
#![allow(clippy::slice_as_bytes)]
45
#![warn(clippy::bytes_nth)]
56

67
fn main() {

tests/ui/bytes_nth.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: called `.bytes().nth()` on a `String`
2-
--> $DIR/bytes_nth.rs:8:13
2+
--> $DIR/bytes_nth.rs:9:13
33
|
44
LL | 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

99
error: called `.bytes().nth().unwrap()` on a `String`
10-
--> $DIR/bytes_nth.rs:9:14
10+
--> $DIR/bytes_nth.rs:10:14
1111
|
1212
LL | let _ = &s.bytes().nth(3).unwrap();
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.as_bytes()[3]`
1414

1515
error: called `.bytes().nth()` on a `str`
16-
--> $DIR/bytes_nth.rs:10:13
16+
--> $DIR/bytes_nth.rs:11:13
1717
|
1818
LL | let _ = s[..].bytes().nth(3);
1919
| ^^^^^^^^^^^^^^^^^^^^ help: try: `s[..].as_bytes().get(3).copied()`

0 commit comments

Comments
 (0)