Closed
Description
Consider the following code snippet:
struct Foo {
inner: u32,
}
impl From<u32> for Foo {
fn from(inner: u32) -> Self {
Self {
inner
}
}
}
This will trigger a 'struct is never constructed' warning, even though the struct is clearly constructed in the implementation of From<u32>
.
The problem seems to be caused by using Self
as the constructor. If I replace Self
with the name of the struct, as in the following code snippet, the warning goes away:
struct Foo {
inner: u32,
}
impl From<u32> for Foo {
fn from(inner: u32) -> Self {
Foo {
inner
}
}
}