|
1 | 1 | #![warn(clippy::redundant_as_str)] |
2 | 2 |
|
3 | 3 | fn main() { |
4 | | - let string = "Hello, world!".to_owned(); |
| 4 | + let string = "Hello, world!".to_owned(); |
5 | 5 |
|
6 | | - // These methods are redundant and the `as_str` can be removed |
| 6 | + // These methods are redundant and the `as_str` can be removed |
7 | 7 | let _redundant = string.as_bytes(); |
8 | 8 | let _redundant = string.is_empty(); |
9 | 9 |
|
10 | 10 | // These methods don't use `as_str` when they are redundant |
11 | 11 | let _no_as_str = string.as_bytes(); |
12 | 12 | let _no_as_str = string.is_empty(); |
13 | 13 |
|
14 | | - // These methods are not redundant, and are equivelant to |
15 | | - // doing dereferencing the string and applying the method |
| 14 | + // These methods are not redundant, and are equivelant to |
| 15 | + // doing dereferencing the string and applying the method |
16 | 16 | let _not_redundant = string.as_str().escape_unicode(); |
17 | 17 | let _not_redundant = string.as_str().trim(); |
18 | 18 | let _not_redundant = string.as_str().split_whitespace(); |
19 | 19 |
|
20 | | - // These methods don't use `as_str` and are applied on a `str` directly |
21 | | - let borrowed_str = "Hello, world!"; |
| 20 | + // These methods don't use `as_str` and are applied on a `str` directly |
| 21 | + let borrowed_str = "Hello, world!"; |
22 | 22 | let _is_str = borrowed_str.as_bytes(); |
23 | 23 | let _is_str = borrowed_str.is_empty(); |
24 | 24 | } |
0 commit comments