2022-10-14 17:50:23 -05:00
|
|
|
#![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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-01 09:02:42 -05: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 17:50:23 -05:00
|
|
|
fn main() {}
|