From d3c45dc2f0898d5a5bd48860eb74005faa6c8ec5 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 21 Jul 2019 05:52:00 +0200 Subject: plumbing/object: simplify code - Use append instead of ranged for loop - Simpler bool comparison Signed-off-by: Christian Muehlhaeuser (cherry picked from commit 3918d0e1b73f5e59a8c93e2b5ae99295cef26cf9) --- plumbing/object/commit_walker_bfs_filtered_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plumbing/object/commit_walker_bfs_filtered_test.go b/plumbing/object/commit_walker_bfs_filtered_test.go index d31bdf0..6984b60 100644 --- a/plumbing/object/commit_walker_bfs_filtered_test.go +++ b/plumbing/object/commit_walker_bfs_filtered_test.go @@ -29,9 +29,7 @@ func commitsFromIter(iter CommitIter) ([]*Commit, error) { func assertHashes(c *C, commits []*Commit, hashes []string) { if len(commits) != len(hashes) { var expected []string - for _, c := range hashes { - expected = append(expected, c) - } + expected = append(expected, hashes...) fmt.Println("expected:", strings.Join(expected, ", ")) var got []string for _, c := range commits { @@ -48,11 +46,7 @@ func assertHashes(c *C, commits []*Commit, hashes []string) { func validIfCommit(ignored plumbing.Hash) CommitFilter { return func(c *Commit) bool { - if c.Hash == ignored { - return true - } - - return false + return c.Hash == ignored } } -- cgit