Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9e83183

Browse files
committed
uibless for tests
1 parent 43066fe commit 9e83183

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

tests/ui/slice_as_bytes.fixed

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@run-rustfix
21
#![allow(unused)]
32
#![warn(clippy::slice_as_bytes)]
43

tests/ui/slice_as_bytes.stderr

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
2-
--> $DIR/slice_as_bytes.rs:29:17
3-
|
1+
error: calling `as_bytes` after slicing a string
2+
--> tests/ui/slice_as_bytes.rs:28:17
3+
|
44
LL | let bytes = s[1..5].as_bytes();
5-
| ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]`
6-
|
7-
= note: `-D clippy::slice-as-bytes` implied by `-D warnings`
5+
| ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]`
6+
|
7+
= note: `-D clippy::slice-as-bytes` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::slice_as_bytes)]`
89

9-
error: slicing a String before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
10-
--> $DIR/slice_as_bytes.rs:30:17
11-
|
10+
error: calling `as_bytes` after slicing a string
11+
--> tests/ui/slice_as_bytes.rs:29:17
12+
|
1213
LL | let bytes = string[1..].as_bytes();
13-
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]`
14+
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]`
1415

15-
error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking
16-
--> $DIR/slice_as_bytes.rs:31:17
17-
|
16+
error: calling `as_bytes` after slicing a string
17+
--> tests/ui/slice_as_bytes.rs:30:17
18+
|
1819
LL | let bytes = "consectetur adipiscing"[..=5].as_bytes();
19-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]`
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]`
2021

2122
error: aborting due to 3 previous errors
23+

0 commit comments

Comments
 (0)