Remove unnecessary guard around delete

This commit is contained in:
deepsource-autofix[bot]
2021-05-03 19:40:36 +00:00
committed by GitHub
parent 22c17f2a5c
commit 99fa7301cb
2 changed files with 2 additions and 6 deletions

View File

@@ -80,9 +80,7 @@ func (c *Cache) Piece(m metainfo.Piece) storage.PieceImpl {
func (c *Cache) Close() error {
log.TLogln("Close cache for:", c.hash)
if _, ok := c.storage.caches[c.hash]; ok {
delete(c.storage.caches, c.hash)
}
delete(c.storage.caches, c.hash)
c.pieces = nil
c.muReaders.Lock()