Hi,
I've got following code:
#[derive(Eq, PartialEq)]
pub struct Foo;
impl Foo {
fn new() -> Self { Foo }
}
fn main() {
if None == Foo::new() {
// ^^^^^^^^^^
// |
// expected enum `std::option::Option`, found struct `Foo`
// help: try using a variant of the expected type: `Some(<Foo>::new())`
}
}
(playground link)
The suggested <Foo>::new() syntax is valid, but - quite frankly - spooky (and it seems to be this way from the very beginning of this feature). Could it suggest just Foo::new()?
I'd like to tackle this myself, but I'd need at least a hint where to look :-)
Hi,
I've got following code:
(playground link)
The suggested
<Foo>::new()syntax is valid, but - quite frankly - spooky (and it seems to be this way from the very beginning of this feature). Could it suggest justFoo::new()?I'd like to tackle this myself, but I'd need at least a hint where to look :-)