mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
35 lines
537 B
Rust
35 lines
537 B
Rust
#![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
|
|
}
|
|
}
|
|
|
|
fn main() {}
|