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 3
3
fn main() {
4
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
- // These methods don't use `as_str` when they are redundant.
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
14
// 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
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.
20
+ // These methods don't use `as_str` and are applied on a `str` directly
21
21
let borrowed_str = "Hello, world!";
22
22
let _is_str = borrowed_str.as_bytes();
23
23
let _is_str = borrowed_str.is_empty();
Original file line number Diff line number Diff line change 3
3
fn main ( ) {
4
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_str ( ) . as_bytes ( ) ;
8
8
let _redundant = string. as_str ( ) . is_empty ( ) ;
9
9
10
- // These methods don't use `as_str` when they are redundant.
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
14
// 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
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.
20
+ // These methods don't use `as_str` and are applied on a `str` directly
21
21
let borrowed_str = "Hello, world!" ;
22
22
let _is_str = borrowed_str. as_bytes ( ) ;
23
23
let _is_str = borrowed_str. is_empty ( ) ;
You can’t perform that action at this time.
0 commit comments