mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-04 18:40:18 +00:00
29 lines
1.2 KiB
Text
29 lines
1.2 KiB
Text
error: needless call to `as_bytes()`
|
|
--> tests/ui/needless_as_bytes.rs:13:8
|
|
|
|
|
LL | if "some string".as_bytes().is_empty() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `is_empty()` can be called directly on strings: `"some string".is_empty()`
|
|
|
|
|
= note: `-D clippy::needless-as-bytes` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::needless_as_bytes)]`
|
|
|
|
error: needless call to `as_bytes()`
|
|
--> tests/ui/needless_as_bytes.rs:15:30
|
|
|
|
|
LL | println!("len = {}", "some string".as_bytes().len());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: `len()` can be called directly on strings: `"some string".len()`
|
|
|
|
error: needless call to `as_bytes()`
|
|
--> tests/ui/needless_as_bytes.rs:20:8
|
|
|
|
|
LL | if s.as_bytes().is_empty() {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: `is_empty()` can be called directly on strings: `s.is_empty()`
|
|
|
|
error: needless call to `as_bytes()`
|
|
--> tests/ui/needless_as_bytes.rs:22:30
|
|
|
|
|
LL | println!("len = {}", s.as_bytes().len());
|
|
| ^^^^^^^^^^^^^^^^^^ help: `len()` can be called directly on strings: `s.len()`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|