Closed
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.