I would like to nominate `Option::as_deref` for the worst named method in Rust
First preference: `Deref` was just structured in a way it could be implemented by `Option<impl Deref>`. Second preference: Inherent method called `deref` Third+ preference: Something that implies it's *calling* deref on its member, e.g. `derefed`.
-
-
how would the first preference work? how do you handle None?
-
It'd return `None`. This would require GATs so that it was `fn deref(&self) -> Self::Target<'_>`, letting you return an option of a reference for example.
- 5 more replies
New conversation -
-
-
The current name implies to me that the return type is `Option<Box<dyn Deref>>` (yes I know you'd need to specify a concrete type for target)
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.