index: implement AsCompositeIndex for CompositeIndex, not for &CompositeIndex

Just a minor code cleanup. We still need Index for &CompositeIndex because the
type is unsized, and unsized type cannot be converted to another dyn reference.
This commit is contained in:
Yuya Nishihara 2024-03-10 21:48:47 +09:00
parent 243675b793
commit 3d0952b316

View file

@ -399,12 +399,13 @@ impl CompositeIndex {
}
}
impl AsCompositeIndex for &CompositeIndex {
impl AsCompositeIndex for CompositeIndex {
fn as_composite(&self) -> &CompositeIndex {
self
}
}
// In revset engine, we need to convert &CompositeIndex to &dyn Index.
impl Index for &CompositeIndex {
/// Suppose the given `commit_id` exists, returns the minimum prefix length
/// to disambiguate it. The length to be returned is a number of hexadecimal