From 429562ca2ff03650f5f2a54e7df24ceb45e32d98 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 2 Apr 2023 18:13:51 +0900 Subject: [PATCH] revset: implement Debug for RevsetImpl and add trait bound accordingly --- lib/src/default_revset_engine.rs | 8 ++++++++ lib/src/revset.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/default_revset_engine.rs b/lib/src/default_revset_engine.rs index cbd59520f..39da2f398 100644 --- a/lib/src/default_revset_engine.rs +++ b/lib/src/default_revset_engine.rs @@ -71,6 +71,14 @@ impl<'index> RevsetImpl<'index> { } } +impl fmt::Debug for RevsetImpl<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RevsetImpl") + .field("inner", &self.inner) + .finish_non_exhaustive() + } +} + impl<'index> Revset<'index> for RevsetImpl<'index> { fn iter(&self) -> Box + '_> { Box::new(self.inner.iter().map(|index_entry| index_entry.commit_id())) diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 8b32027f4..677f74cf4 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -1654,7 +1654,7 @@ pub fn resolve_symbols( ) } -pub trait Revset<'index> { +pub trait Revset<'index>: fmt::Debug { /// Iterate in topological order with children before parents. fn iter(&self) -> Box + '_>;