This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 33fn main() {
44 let string = "Hello, world!".to_owned();
55
6- // These methods are redundant and the `as_str` can be removed.
6+ // These methods are redundant and the `as_str` can be removed
77 let _redundant = string.as_bytes();
88 let _redundant = string.is_empty();
99
10- // These methods don't use `as_str` when they are redundant.
10+ // These methods don't use `as_str` when they are redundant
1111 let _no_as_str = string.as_bytes();
1212 let _no_as_str = string.is_empty();
1313
1414 // These methods are not redundant, and are equivelant to
15- // doing dereferencing the string and applying the method.
15+ // doing dereferencing the string and applying the method
1616 let _not_redundant = string.as_str().escape_unicode();
1717 let _not_redundant = string.as_str().trim();
1818 let _not_redundant = string.as_str().split_whitespace();
1919
20- // These methods don't use `as_str` and are applied on a `str` directly.
20+ // These methods don't use `as_str` and are applied on a `str` directly
2121 let borrowed_str = "Hello, world!";
2222 let _is_str = borrowed_str.as_bytes();
2323 let _is_str = borrowed_str.is_empty();
Original file line number Diff line number Diff line change 33fn main ( ) {
44 let string = "Hello, world!" . to_owned ( ) ;
55
6- // These methods are redundant and the `as_str` can be removed.
6+ // These methods are redundant and the `as_str` can be removed
77 let _redundant = string. as_str ( ) . as_bytes ( ) ;
88 let _redundant = string. as_str ( ) . is_empty ( ) ;
99
10- // These methods don't use `as_str` when they are redundant.
10+ // These methods don't use `as_str` when they are redundant
1111 let _no_as_str = string. as_bytes ( ) ;
1212 let _no_as_str = string. is_empty ( ) ;
1313
1414 // These methods are not redundant, and are equivelant to
15- // doing dereferencing the string and applying the method.
15+ // doing dereferencing the string and applying the method
1616 let _not_redundant = string. as_str ( ) . escape_unicode ( ) ;
1717 let _not_redundant = string. as_str ( ) . trim ( ) ;
1818 let _not_redundant = string. as_str ( ) . split_whitespace ( ) ;
1919
20- // These methods don't use `as_str` and are applied on a `str` directly.
20+ // These methods don't use `as_str` and are applied on a `str` directly
2121 let borrowed_str = "Hello, world!" ;
2222 let _is_str = borrowed_str. as_bytes ( ) ;
2323 let _is_str = borrowed_str. is_empty ( ) ;
You can’t perform that action at this time.
0 commit comments