File tree 2 files changed +15
-5
lines changed 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
1
#![ warn( clippy:: str_to_string) ]
2
2
3
3
fn main ( ) {
4
- let _ = "hello world" . to_string ( ) ;
4
+ let hello = "hello world" . to_string ( ) ;
5
+ let msg = & hello[ ..] ;
6
+ msg. to_string ( ) ;
5
7
}
Original file line number Diff line number Diff line change 1
1
error: `to_string()` does a multitude of things to just clone a `&str`
2
- --> $DIR/str_to_string.rs:4:13
2
+ --> $DIR/str_to_string.rs:4:17
3
3
|
4
- LL | let _ = "hello world".to_string();
5
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
4
+ LL | let hello = "hello world".to_string();
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
|
7
7
= note: `-D clippy::str-to-string` implied by `-D warnings`
8
8
= help: consider using `.to_owned()`
9
9
10
- error: aborting due to previous error
10
+ error: `to_string()` does a multitude of things to just clone a `&str`
11
+ --> $DIR/str_to_string.rs:6:5
12
+ |
13
+ LL | msg.to_string();
14
+ | ^^^^^^^^^^^^^^^
15
+ |
16
+ = help: consider using `.to_owned()`
17
+
18
+ error: aborting due to 2 previous errors
11
19
You can’t perform that action at this time.
0 commit comments