gitea/services/pull
Eng Zer Jun 13d5d2e711
Remove redundant `len` check around loop (#27464)
This pull request is a minor code cleanup.

From the Go specification (https://go.dev/ref/spec#For_range):

> "1. For a nil slice, the number of iterations is 0."
> "3. If the map is nil, the number of iterations is 0."

`len` returns 0 if the slice or map is nil
(https://pkg.go.dev/builtin#len). Therefore, checking `len(v) > 0`
before a loop is unnecessary.

---

At the time of writing this pull request, there wasn't a lint rule that
catches these issues. The closest I could find is
https://staticcheck.dev/docs/checks/#S103

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-10-06 14:49:37 +08:00
..
check.go More refactoring of `db.DefaultContext` (#27083) 2023-09-15 06:13:19 +00:00
check_test.go Add context parameter to some database functions (#26055) 2023-07-22 22:14:27 +08:00
comment.go Delete `issue_service.CreateComment` (#26298) 2023-08-04 13:34:34 +00:00
commit_status.go Fix pull request check list is limited (#26179) 2023-07-31 02:21:09 +00:00
edits.go
lfs.go
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
merge.go Move notification interface to services layer (#26915) 2023-09-05 18:37:47 +00:00
merge_merge.go
merge_prepare.go
merge_rebase.go
merge_squash.go
merge_test.go
patch.go Add transaction when creating pull request created dirty data (#26259) 2023-08-10 02:39:21 +00:00
patch_unmerged.go
pull.go Remove redundant `len` check around loop (#27464) 2023-10-06 14:49:37 +08:00
pull_test.go
review.go Even more `db.DefaultContext` refactor (#27352) 2023-10-03 10:30:41 +00:00
temp_repo.go
update.go
update_rebase.go