mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +00:00
This lint checks for `as_str` on a `String` immediately followed by `as_bytes` or `is_empty` as those methods are available on `String` too. This could possibly also be extended to `&[u8]` in the future.
6 lines
170 B
Rust
6 lines
170 B
Rust
#![warn(clippy::redundant_as_str)]
|
|
|
|
fn main() {
|
|
let _redundant = "Hello, world!".to_owned().as_bytes();
|
|
let _redundant = "Hello, world!".to_owned().is_empty();
|
|
}
|