|
|
|
|
|
by SkiFire13
43 days ago
|
|
The reason it works with `String` is because trait methods get priority over applying autoderef (which is needed to go from `&String` to `&str` and select `str::strip_suffix`). If you however already have a `&str` then autoderef won't be needed and the inherent method will win over the trait method. At no point does the prelude come into play |
|
Compare to [this](https://play.rust-lang.org/?version=stable&mode=debug&editio...)