I would like to nominate `Option::as_deref` for the worst named method in Rust
Ironically you can almost implement this for `Option`, since null ptr optimization means that `&T == &Option<T>` in terms of layout. Except it's not particularly useful since that'd require `T: Sized`, meaning `Option<String>` couldn't impl `Deref`
-
-
wait is String not Sized
-
String is, `str` isn't
- 1 more reply
New conversation -
-
-
Concrete code to show what I mean https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c3f925a354159bd379aa5abf15939600 …
-
oh right `where T::Target: Sized` is why String doesn't qualify
End of conversation
New conversation -
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.