rustc
suggests &None.as_ref()
as well as None
#100605
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9d89810932e63366d4910a3d8cca200e
The current output is:
The error is correct, but I think the diagnostic is wrong. The second recommendation to call
takes_option(None)
is sound, but the first one (&None.as_ref()
) seems like bad advice.This reproduces on
rustc
1.61 (on my workstation), as well as 1.63 (stable channel in playground), 1.64 (beta channel in playground), and 1.65 (nightly channel in playground).The text was updated successfully, but these errors were encountered: