summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/from_over_into_unfixable.rs
blob: 3b280b7488ae7c8b1bc79b7215407c9cc8e35492 (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
#![warn(clippy::from_over_into)]

struct InMacro(String);

macro_rules! in_macro {
    ($e:ident) => {
        $e
    };
}

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

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
    }
}

fn main() {}