rust/tests/ui/suggestions/issue-104961.fixed
Benoît du Garreau 772315de7c Remove generic lifetime parameter of trait Pattern
Use a GAT for `Searcher` associated type because this trait is always
implemented for every lifetime anyway.
2024-07-15 12:12:44 +02:00

17 lines
358 B
Rust

//@ run-rustfix
fn foo(x: &str) -> bool {
x.starts_with(&("hi".to_string() + " you"))
//~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277]
}
fn foo2(x: &str) -> bool {
x.starts_with(&"hi".to_string())
//~^ ERROR the trait bound `String: Pattern` is not satisfied [E0277]
}
fn main() {
foo("hi you");
foo2("hi");
}