mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-13 06:42:46 +00:00
22 lines
333 B
Rust
22 lines
333 B
Rust
|
#![warn(clippy::from_over_into)]
|
||
|
|
||
|
// this should throw an error
|
||
|
struct StringWrapper(String);
|
||
|
|
||
|
impl Into<StringWrapper> for String {
|
||
|
fn into(self) -> StringWrapper {
|
||
|
StringWrapper(self)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// this is fine
|
||
|
struct A(String);
|
||
|
|
||
|
impl From<String> for A {
|
||
|
fn from(s: String) -> A {
|
||
|
A(s)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {}
|