]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/from_over_into_unfixable.rs
Rollup merge of #105602 - RalfJung:read-convenience, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / from_over_into_unfixable.rs
1 #![warn(clippy::from_over_into)]
2
3 struct InMacro(String);
4
5 macro_rules! in_macro {
6     ($e:ident) => {
7         $e
8     };
9 }
10
11 impl Into<InMacro> for String {
12     fn into(self) -> InMacro {
13         InMacro(in_macro!(self))
14     }
15 }
16
17 struct WeirdUpperSelf;
18
19 impl Into<WeirdUpperSelf> for &'static [u8] {
20     fn into(self) -> WeirdUpperSelf {
21         let _ = Self::default();
22         WeirdUpperSelf
23     }
24 }
25
26 struct ContainsVal;
27
28 impl Into<u8> for ContainsVal {
29     fn into(self) -> u8 {
30         let val = 1;
31         val + 1
32     }
33 }
34
35 fn main() {}