From 3d0952b3162a5132f022c0d7fb6f9a24a6e48578 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 10 Mar 2024 21:48:47 +0900 Subject: [PATCH] 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. --- lib/src/default_index/composite.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/default_index/composite.rs b/lib/src/default_index/composite.rs index a75caf442..a54482917 100644 --- a/lib/src/default_index/composite.rs +++ b/lib/src/default_index/composite.rs @@ -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