-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suggestion-diagnostics: as_ref improve snippet #57451
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
94fe935
to
b244e51
Compare
src/librustc_typeck/check/demand.rs
Outdated
@@ -191,7 +192,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { | |||
/// ``` | |||
/// opt.map(|arg| { takes_ref(arg) }); | |||
/// ``` | |||
fn can_use_as_ref(&self, expr: &hir::Expr) -> Option<(Span, &'static str, String)> { | |||
fn can_use_as_ref(&self, expr: &hir::Expr, cm: &SourceMap) | |||
-> Option<(Span, &'static str, String)> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting:
fn can_use_as_ref(
&self,
expr: &hir::Expr,
cm: &SourceMap,
) -> Option<(Span, &'static str, String)> {
Ping from triage @dlrobertson: Some changes have been requested to your PR. |
r? @estebank |
👍 thanks for the ping. I'll look at this tonight. |
8015e91
to
47f16e9
Compare
@estebank updated |
Improve the code snippet suggested in suggestion-diagnostics when suggesting the use of as_ref.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me once the nitpick is addressed :)
47f16e9
to
285d4a7
Compare
@bors r=estebank |
@dlrobertson: 🔑 Insufficient privileges: Not in reviewers |
@estebank looks like you'll need to |
@bors r+ |
📌 Commit 285d4a7 has been approved by |
…stebank suggestion-diagnostics: as_ref improve snippet Improve the code snippet suggested in suggestion-diagnostics when suggesting the use of as_ref. Given: ```rust fn test(x: &usize) {} fn main() { Some(42).map(|x| test(x)); } ``` Suggest ``` help: consider using `as_ref` instead: `as_ref().map` ``` Instead of ``` help: consider using `as_ref` instead: `as_ref().` ```
…stebank suggestion-diagnostics: as_ref improve snippet Improve the code snippet suggested in suggestion-diagnostics when suggesting the use of as_ref. Given: ```rust fn test(x: &usize) {} fn main() { Some(42).map(|x| test(x)); } ``` Suggest ``` help: consider using `as_ref` instead: `as_ref().map` ``` Instead of ``` help: consider using `as_ref` instead: `as_ref().` ```
Rollup of 8 pull requests Successful merges: - #57451 (suggestion-diagnostics: as_ref improve snippet) - #57856 (Convert old first edition links to current edition one) - #57992 (Update the future/task API) - #58258 (Reduce the size of `hir::Expr`.) - #58267 (Tweak "incompatible match arms" error) - #58296 (Hidden suggestion support) - #58301 (Enable comparing fat pointers) - #58308 (Extract block to insert an intrinsic into its own function) Failed merges: r? @ghost
Improve the code snippet suggested in suggestion-diagnostics when
suggesting the use of as_ref.
Given:
Suggest
Instead of