2022-10-14 22:50:23 +00:00
|
|
|
#![warn(clippy::from_over_into)]
|
|
|
|
|
|
|
|
struct InMacro(String);
|
|
|
|
|
|
|
|
macro_rules! in_macro {
|
2023-05-28 21:50:08 +00:00
|
|
|
() => {
|
|
|
|
Self::new()
|
2022-10-14 22:50:23 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<InMacro> for String {
|
|
|
|
fn into(self) -> InMacro {
|
2023-05-28 21:50:08 +00:00
|
|
|
InMacro(in_macro!())
|
2022-10-14 22:50:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-01 14:02:42 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-14 22:50:23 +00:00
|
|
|
fn main() {}
|