mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 01:28:18 +03:00
0c592df5a5
I first implemented the naive version, which just talks about, and suggests using, `Option::as_ref`. But the resulting error message sounded a bit misleading -- after all, the manual implementation was factually that of `Option::as_mut`, and we only suggest `as_ref` as a means of downcasting. So then I added another help message to mention the need for reference downcasting, which.. still looks awkward. Honestly it might be the easiest to hide the reference downcasting into the `.map` after all, so that it encapsulates _all_ the casting needed following the switch to `as_ref`/`as_mut`. changelog: [`match_as_ref`]: suggest `as_ref` when the reference needs to be cast r? @samueltardieu