3 ms·
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:
by SkiFire13 5mo 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
- 3836293648 5mo agoNot technically. But that's not the issue. The issue is that trait resolution and imports are treated inconsistently and that is a mistake. Compare to [this](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=29066c28ff506af52f5446b4efc76297 https://play.rust-lang.org/?version=stable&mode=debug&editio...)