From c3ed3e3781be42da41958c5772db7484eac748cb Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Thu, 5 Sep 2024 12:22:32 +0900 Subject: [PATCH] evolog: use predecessor_ids() where commit object isn't needed --- cli/src/commands/evolog.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cli/src/commands/evolog.rs b/cli/src/commands/evolog.rs index 320b08ccc..73c5cb8f4 100644 --- a/cli/src/commands/evolog.rs +++ b/cli/src/commands/evolog.rs @@ -142,10 +142,11 @@ pub(crate) fn cmd_evolog( if !args.no_graph { let mut graph = get_graphlog(graph_style, formatter.raw()); for commit in commits { - let mut edges = vec![]; - for predecessor in commit.predecessors() { - edges.push(Edge::Direct(predecessor?.id().clone())); - } + let edges = commit + .predecessor_ids() + .iter() + .map(|id| Edge::Direct(id.clone())) + .collect_vec(); let graph_width = || graph.width(commit.id(), &edges); let mut buffer = vec![]; with_content_format.write_graph_text(