Skip to content

Commit 55eaf52

Browse files
committed
minor refactor
1 parent 29e3bbf commit 55eaf52

File tree

1 file changed

+8
-10
lines changed
  • gix-traverse/src/commit/topo

1 file changed

+8
-10
lines changed

gix-traverse/src/commit/topo/init.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ where
2828
tips: impl IntoIterator<Item = impl Into<ObjectId>>,
2929
ends: Option<impl IntoIterator<Item = impl Into<ObjectId>>>,
3030
) -> Self {
31-
let mut builder = Self::new(find).with_tips(tips);
32-
if let Some(ends) = ends {
33-
builder = builder.with_ends(ends);
34-
};
35-
builder
31+
Self::new(find).with_tips(tips).with_ends(ends.into_iter().flatten())
3632
}
3733

3834
/// Create a new `Builder` for a [`Topo`] that reads commits from a
@@ -49,16 +45,18 @@ where
4945
}
5046
}
5147

52-
/// Add commits to start reading from. The behavior is similar to specifying
53-
/// additional `ends` in `git rev-list --topo-order ^ends tips`.
48+
/// Add commits to start reading from.
49+
///
50+
/// The behavior is similar to specifying additional `ends` in `git rev-list --topo-order ^ends tips`.
5451
pub fn with_tips(mut self, tips: impl IntoIterator<Item = impl Into<ObjectId>>) -> Self {
5552
self.tips.extend(tips.into_iter().map(Into::into));
5653
self
5754
}
5855

59-
/// Add commits ending the traversal. These commits themselves will not be
60-
/// read, i.e. the behavior is similar to specifying additional `ends` in
61-
/// `git rev-list --topo-order ^ends tips`.
56+
/// Add commits ending the traversal.
57+
///
58+
/// These commits themselves will not be read, i.e. the behavior is similar to specifying additional
59+
/// `ends` in `git rev-list --topo-order ^ends tips`.
6260
pub fn with_ends(mut self, ends: impl IntoIterator<Item = impl Into<ObjectId>>) -> Self {
6361
self.ends.extend(ends.into_iter().map(Into::into));
6462
self

0 commit comments

Comments
 (0)