-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
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.P-lowLow priorityLow priorityT-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
Given
fn make_lipographic(banned: char, line: &str) -> String {
line.as_str().chars().filter(|&c| c != banned).collect()
}
fn main() {
let passage = String::from("If Youth, throughout all history, had had a champion to stand up for it");
assert_eq!(make_lipographic('e', &passage), passage);
}
error[E0599]: no method named `as_str` found for type `&str` in the current scope
--> src/main.rs:2:10
|
2 | line.as_str().chars().filter(|&c| c != banned).collect()
| ^^^^^^ help: there is a method with a similar name: `as_ptr`
This is a possible simple WIP mistake when changing some binding from String
to &str
that we could preempt and avoid a pretty bad suggestion.
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.P-lowLow priorityLow priorityT-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.