-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed as not planned
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
fn main() {
let x = 5;
let y = 9;
println!("{}", max(x, y));
}
With rustc (1.48.0-nightly 0d0f6b1 2020-09-03) gives:
error[E0425]: cannot find function `max` in this scope
--> ...\test.rs:4:20
|
4 | println!("{}", max(x, y));
| ^^^ not found in this scope
|
help: consider importing one of these items
|
1 | use core::cmp::max;
|
1 | use std::cmp::max;
|
But it could suggest instead to use:
x.max(y)
joshtriplett
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.