let mystring = format!("the quick brown {}", "fox...");
assert!(mystring.ends_with(mystring));
Error:
the trait `std::ops::FnMut<(char,)>` is not implemented for `std::string::String`
Changing mystring.ends_with(mystring)
to mystring.ends_with(mystring.as_str())
fixes it.
Why is this error so cryptic?
If I create the string without using format, say:
let mystring = String::from_str("The quick brown fox...");
assert!(mystring.ends_with(mystring));
The error is much more understandable:
error[E0599]: no method named `ends_with` found for type
`std::result::Result<std::string::String, std::string::ParseError>`
in the current scope