3 ms·
I think for such things it's preferable to just have a `clamp` method as a static method, i.e. you call it with `Ord::clamp(foo, bar)` instead of `foo.clamp(bar
by Manishearth 9y ago
I think for such things it's preferable to just have a `clamp` method as a static method, i.e. you call it with `Ord::clamp(foo, bar)` instead of `foo.clamp(bar)`.
But yes, it could.
Generally the trend seems to be to still try to avoid having actual breakages in the editions unless we _have_ to, and this seems like one of those cases where we don't.
That said, adding Ord::clamp doesn't technically count as a breakage for Rust, Rust's stability guarantee does not include "we added a method to this trait/type and now you have to disambiguate via UFCS" or "we added a thing to this module and now you have to alias your import" because it's not really possible to have that stability guarantee and continue to evolve the stdlib.
That said, given that Ord is in the prelude, the bar for adding stuff to that is much higher. And Rust also cares about the impact of not-technically-breaking changes like these, so we definitely wouldn't just add it as a method.