summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/from_over_into.rs
blob: 292d0924fb17a4ca1b32bf0a39fa6a81fdc68e82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#![warn(clippy::from_over_into)]

// this should throw an error
struct StringWrapper(String);

impl Into<StringWrapper> for String {
    fn into(self) -> StringWrapper {
        StringWrapper(self)
    }
}

// this is fine
struct A(String);

impl From<String> for A {
    fn from(s: String) -> A {
        A(s)
    }
}

fn main() {}