Closed expenses closed 6 years ago
Thanks for the PR and the notice.
The trait was never intented to be used as an object, it's just there to extend [T]
. The regular sort methods are all just methods on [T]
without a trait, too after all. But, as it's going to break in the future anyway, no point in just allowing the warning.
I think it's best to reduce the implementors to just [T]
. Any type that coerces via Deref
or UnsizedCoercions
like the usual suspects, arrays and vecs, will continue to work. Types that are only AsRef<T>
or AsMut<T>
will have to convert explicitly.
The (temporary) branch object_safety
has the trait changes. I just need to adapt the tests so that they call the sort methods directly on the source types and not the slices that as_ref()
or as_mut()
gives.
Oh ok, cool thanks.
The situation here is kinda shitty. See also issue #4. The lint is a false positive, that I can't deactivate and that I can't work around without a breaking change. For now, I'm going to keep the status quo.
This gets rid of a bunch of warnings such as:
The linked issue is https://github.com/rust-lang/rust/issues/51443. Unfortunately, the best solution I've been able to come up with so far is to split up
OrdSubsetSliceExt
into two traits,OrdSubsetSliceExt
, andOrdSubsetSliceExtMut
which requiresAsMut<[T]>
.