Skip to content

Commit 4ff72d0

Browse files
committed
chore(unixfs): remove unnecessary uint64 conversions
Link.Size is already uint64, so the explicit conversions are redundant and flagged by golangci-lint unconvert check.
1 parent d28c8e5 commit 4ff72d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ipld/unixfs/io/directory.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,12 @@ func (d *BasicDirectory) needsToSwitchByBlockSize(name string, nodeToAdd ipld.No
581581
}
582582

583583
// Calculate size delta for this operation
584-
newLinkSize := linkSerializedSize(name, link.Cid, uint64(link.Size))
584+
newLinkSize := linkSerializedSize(name, link.Cid, link.Size)
585585
oldLinkSize := 0
586586
var entryToRemove *ipld.Link
587587
if oldLink, err := d.node.GetNodeLink(name); err == nil {
588588
entryToRemove = oldLink
589-
oldLinkSize = linkSerializedSize(name, oldLink.Cid, uint64(oldLink.Size))
589+
oldLinkSize = linkSerializedSize(name, oldLink.Cid, oldLink.Size)
590590
}
591591

592592
estimatedNewSize := d.cachedBlockSize - oldLinkSize + newLinkSize
@@ -631,10 +631,10 @@ func (d *BasicDirectory) updateCachedBlockSize(oldLink, newLink *ipld.Link, name
631631
return
632632
}
633633
if oldLink != nil {
634-
d.cachedBlockSize -= linkSerializedSize(name, oldLink.Cid, uint64(oldLink.Size))
634+
d.cachedBlockSize -= linkSerializedSize(name, oldLink.Cid, oldLink.Size)
635635
}
636636
if newLink != nil {
637-
d.cachedBlockSize += linkSerializedSize(name, newLink.Cid, uint64(newLink.Size))
637+
d.cachedBlockSize += linkSerializedSize(name, newLink.Cid, newLink.Size)
638638
}
639639
}
640640

@@ -1006,7 +1006,7 @@ func (d *HAMTDirectory) needsToSwitchToBasicDir(ctx context.Context, name string
10061006
func (d *HAMTDirectory) linkSizeFor(link *ipld.Link) int {
10071007
switch d.GetSizeEstimationMode() {
10081008
case SizeEstimationBlock:
1009-
return linkSerializedSize(link.Name, link.Cid, uint64(link.Size))
1009+
return linkSerializedSize(link.Name, link.Cid, link.Size)
10101010
default:
10111011
return linksize.LinkSizeFunction(link.Name, link.Cid)
10121012
}

0 commit comments

Comments
 (0)