diff options
| author | wowinter13 <vla-dy@yandex.ru> | 2025-01-15 17:19:21 +0100 |
|---|---|---|
| committer | wowinter13 <vla-dy@yandex.ru> | 2025-01-25 18:42:45 +0100 |
| commit | 9e83183f7ee7b7132f2bd6d857aee7bc2c7e46b3 (patch) | |
| tree | 9b90bd16a714f06484228d2753e9fc8c550bd641 | |
| parent | 43066fea88205824a98d207b0e38a05ce36245f7 (diff) | |
| download | rust-9e83183f7ee7b7132f2bd6d857aee7bc2c7e46b3.tar.gz rust-9e83183f7ee7b7132f2bd6d857aee7bc2c7e46b3.zip | |
uibless for tests
| -rw-r--r-- | tests/ui/slice_as_bytes.fixed | 1 | ||||
| -rw-r--r-- | tests/ui/slice_as_bytes.stderr | 30 |
2 files changed, 16 insertions, 15 deletions
diff --git a/tests/ui/slice_as_bytes.fixed b/tests/ui/slice_as_bytes.fixed index 22e6ba580e2..da627717a52 100644 --- a/tests/ui/slice_as_bytes.fixed +++ b/tests/ui/slice_as_bytes.fixed @@ -1,4 +1,3 @@ -//@run-rustfix #![allow(unused)] #![warn(clippy::slice_as_bytes)] diff --git a/tests/ui/slice_as_bytes.stderr b/tests/ui/slice_as_bytes.stderr index 2a3251b4d9c..9a787b0b917 100644 --- a/tests/ui/slice_as_bytes.stderr +++ b/tests/ui/slice_as_bytes.stderr @@ -1,21 +1,23 @@ -error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking ---> $DIR/slice_as_bytes.rs:29:17 -| +error: calling `as_bytes` after slicing a string + --> tests/ui/slice_as_bytes.rs:28:17 + | LL | let bytes = s[1..5].as_bytes(); -| ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]` -| -= note: `-D clippy::slice-as-bytes` implied by `-D warnings` + | ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]` + | + = note: `-D clippy::slice-as-bytes` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::slice_as_bytes)]` -error: slicing a String before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking ---> $DIR/slice_as_bytes.rs:30:17 -| +error: calling `as_bytes` after slicing a string + --> tests/ui/slice_as_bytes.rs:29:17 + | LL | let bytes = string[1..].as_bytes(); -| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]` + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]` -error: slicing a str before calling `as_bytes` results in needless UTF-8 alignment checks, and has the possiblity of panicking ---> $DIR/slice_as_bytes.rs:31:17 -| +error: calling `as_bytes` after slicing a string + --> tests/ui/slice_as_bytes.rs:30:17 + | LL | let bytes = "consectetur adipiscing"[..=5].as_bytes(); -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]` error: aborting due to 3 previous errors + |
