rust/tests/ui/redundant_as_str.fixed
Dev381 1c9f3bef8b Add redundant_as_str lint
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.
2023-09-17 17:50:45 -04:00

7 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();
}