Skip to content

Commit

Permalink
Less unbound methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dullgiulio committed Apr 9, 2015
1 parent 5f22179 commit 8d00f7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (c *caches) remove(files mailFiles) {
for name := range c.data {
for k := range c.data[name] {
sort.Sort(c.data[name][k])
c.data[name][k] = sliceDiff(c.data[name][k], files)
c.data[name][k] = c.data[name][k].diff(files)
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,20 @@ func (ms mailFiles) writeTo(w io.Writer, c *config) {
}
}

func slicePresent(m mailFile, elements mailFiles) bool {
for _, e := range elements {
func (ms mailFiles) contains(m mailFile) bool {
for _, e := range ms {
if e == m {
return true
}
}
return false
}

func sliceDiff(a, b mailFiles) mailFiles {
func (a mailFiles) diff(b mailFiles) mailFiles {
r := make([]mailFile, 0)

for _, e := range a {
if !slicePresent(e, b) {
if !b.contains(e) {
r = append(r, e)
}
}
Expand Down

0 comments on commit 8d00f7d

Please sign in to comment.