mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-23 02:27:39 +03:00
18 lines
855 B
Plaintext
18 lines
855 B
Plaintext
error: calling a slice of `as_bytes()` with `from_utf8` should be not necessary
|
|
--> tests/ui/string_from_utf8_as_bytes.rs:10:13
|
|
|
|
|
LL | let _ = std::str::from_utf8(&"Hello World!".as_bytes()[6..11]);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(&"Hello World!"[6..11])`
|
|
|
|
|
= note: `-D clippy::string-from-utf8-as-bytes` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::string_from_utf8_as_bytes)]`
|
|
|
|
error: calling a slice of `as_bytes()` with `from_utf8` should be not necessary
|
|
--> tests/ui/string_from_utf8_as_bytes.rs:14:13
|
|
|
|
|
LL | let _ = std::str::from_utf8(&s.as_bytes()[test_range!(6, 11)]);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(&s[test_range!(6, 11)])`
|
|
|
|
error: aborting due to 2 previous errors
|
|
|