summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/from_over_into_unfixable.rs
blob: c769e38eb33a0b423560e7934fcafb8a8d1f96b3 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#![warn(clippy::from_over_into)]

struct InMacro(String);

macro_rules! in_macro {
    () => {
        Self::new()
    };
}

impl Into<InMacro> for String {
    fn into(self) -> InMacro {
        InMacro(in_macro!())
    }
}

struct WeirdUpperSelf;

impl Into<WeirdUpperSelf> for &'static [u8] {
    fn into(self) -> WeirdUpperSelf {
        let _ = Self::default();
        WeirdUpperSelf
    }
}

struct ContainsVal;

impl Into<u8> for ContainsVal {
    fn into(self) -> u8 {
        let val = 1;
        val + 1
    }
}

pub struct Lval<T>(T);

pub struct Rval<T>(T);

impl<T> Into<Rval<Self>> for Lval<T> {
    fn into(self) -> Rval<Self> {
        Rval(self)
    }
}

fn main() {}