Skip to content

Commit

Permalink
index: implement AsCompositeIndex for CompositeIndex, not for &Compos…
Browse files Browse the repository at this point in the history
…iteIndex

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.
  • Loading branch information
yuja committed Mar 11, 2024
1 parent 49f696f commit 6b07aa1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/default_index/composite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b07aa1

Please sign in to comment.