mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 09:27:25 +00:00
eee3112dc3
from_over_into: Show suggestions for non-Self expanded paths changelog: [`from_over_into`]: Show suggestions when the body contains macros not expanding to `Self` Currently any path in a macro expansion causes the suggestion to be hidden, meaning most macro calls cause it to be hidden Now it's only hidden if the expansion contains `Self`
45 lines
686 B
Rust
45 lines
686 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
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
|
|
fn main() {}
|