blob: 0770bcc42c2704e2a6e0335fd71dd4f5330dd798 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
### What it does
Searches for implementations of the `Into<..>` trait and suggests to implement `From<..>` instead.
### Why is this bad?
According the std docs implementing `From<..>` is preferred since it gives you `Into<..>` for free where the reverse isn't true.
### Example
```
struct StringWrapper(String);
impl Into<StringWrapper> for String {
fn into(self) -> StringWrapper {
StringWrapper(self)
}
}
```
Use instead:
```
struct StringWrapper(String);
impl From<String> for StringWrapper {
fn from(s: String) -> StringWrapper {
StringWrapper(s)
}
}
```
|