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
There was a problem hiding this comment.
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.
estebank
left a comment
There was a problem hiding this comment.
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