@@ -2,27 +2,62 @@ error: this `to_owned` call clones the Cow<'_, str> itself and does not cause th
2
2
--> $DIR/suspicious_to_owned.rs:16:13
3
3
|
4
4
LL | let _ = cow.to_owned();
5
- | ^^^^^^^^^^^^^^ help: consider using, depending on intent: `cow.clone()` or `cow.into_owned()`
5
+ | ^^^^^^^^^^^^^^
6
6
|
7
7
= note: `-D clippy::suspicious-to-owned` implied by `-D warnings`
8
+ help: depending on intent, either make the Cow an Owned variant
9
+ |
10
+ LL | let _ = cow.into_owned();
11
+ | ~~~~~~~~~~~~~~~~
12
+ help: or clone the Cow itself
13
+ |
14
+ LL | let _ = cow.clone();
15
+ | ~~~~~~~~~~~
8
16
9
17
error: this `to_owned` call clones the Cow<'_, [char; 3]> itself and does not cause the Cow<'_, [char; 3]> contents to become owned
10
18
--> $DIR/suspicious_to_owned.rs:26:13
11
19
|
12
20
LL | let _ = cow.to_owned();
13
- | ^^^^^^^^^^^^^^ help: consider using, depending on intent: `cow.clone()` or `cow.into_owned()`
21
+ | ^^^^^^^^^^^^^^
22
+ |
23
+ help: depending on intent, either make the Cow an Owned variant
24
+ |
25
+ LL | let _ = cow.into_owned();
26
+ | ~~~~~~~~~~~~~~~~
27
+ help: or clone the Cow itself
28
+ |
29
+ LL | let _ = cow.clone();
30
+ | ~~~~~~~~~~~
14
31
15
32
error: this `to_owned` call clones the Cow<'_, Vec<char>> itself and does not cause the Cow<'_, Vec<char>> contents to become owned
16
33
--> $DIR/suspicious_to_owned.rs:36:13
17
34
|
18
35
LL | let _ = cow.to_owned();
19
- | ^^^^^^^^^^^^^^ help: consider using, depending on intent: `cow.clone()` or `cow.into_owned()`
36
+ | ^^^^^^^^^^^^^^
37
+ |
38
+ help: depending on intent, either make the Cow an Owned variant
39
+ |
40
+ LL | let _ = cow.into_owned();
41
+ | ~~~~~~~~~~~~~~~~
42
+ help: or clone the Cow itself
43
+ |
44
+ LL | let _ = cow.clone();
45
+ | ~~~~~~~~~~~
20
46
21
47
error: this `to_owned` call clones the Cow<'_, str> itself and does not cause the Cow<'_, str> contents to become owned
22
48
--> $DIR/suspicious_to_owned.rs:46:13
23
49
|
24
50
LL | let _ = cow.to_owned();
25
- | ^^^^^^^^^^^^^^ help: consider using, depending on intent: `cow.clone()` or `cow.into_owned()`
51
+ | ^^^^^^^^^^^^^^
52
+ |
53
+ help: depending on intent, either make the Cow an Owned variant
54
+ |
55
+ LL | let _ = cow.into_owned();
56
+ | ~~~~~~~~~~~~~~~~
57
+ help: or clone the Cow itself
58
+ |
59
+ LL | let _ = cow.clone();
60
+ | ~~~~~~~~~~~
26
61
27
62
error: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
28
63
--> $DIR/suspicious_to_owned.rs:60:13
0 commit comments