aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWagner Riffel <wgrriffel@gmail.com>2019-09-03 16:34:07 -0300
committerDrew DeVault <sir@cmpwn.com>2019-09-04 16:30:57 -1000
commit6338194c4eeb4670ffc5421281d3a28319eee9a1 (patch)
tree2518c5fbc6d48d8222192cda721b8ae9a7f5561d /lib
parentbdb5e3e6581169bdb1d912c158336f409151b491 (diff)
widgets: remove redundant key check, delete is no-op if key is empty
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 77f0fe5..bbdfa57 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -105,9 +105,7 @@ func (store *MessageStore) FetchFull(uids []uint32, cb func(io.Reader)) {
switch msg.(type) {
case *types.Error:
for _, uid := range toFetch {
- if _, ok := store.bodyCallbacks[uid]; ok {
- delete(store.bodyCallbacks, uid)
- }
+ delete(store.bodyCallbacks, uid)
}
}
})
@@ -209,9 +207,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
for _, uid := range msg.Uids {
toDelete[uid] = nil
delete(store.Messages, uid)
- if _, ok := store.Deleted[uid]; ok {
- delete(store.Deleted, uid)
- }
+ delete(store.Deleted, uid)
}
uids := make([]uint32, len(store.uids)-len(msg.Uids))
j := 0