Skip to content

Commit 417e39d

Browse files
committed
Get rid of a forced unwrap and extra lookup of each key when iterating a sorted dictionary.
1 parent 2226d7e commit 417e39d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/PackageLoading/ManifestLoader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,8 @@ public final class ManifestLoader: ManifestLoaderProtocol {
614614
stream <<< packageIdentity
615615
stream <<< manifestContents
616616
stream <<< toolsVersion.description
617-
for key in env.keys.sorted(by: >) {
618-
stream <<< key <<< env[key]! // forced unwrap safe
617+
for (key, value) in env.sorted(by: { $0.key > $1.key }) {
618+
stream <<< key <<< value
619619
}
620620
stream <<< swiftpmVersion
621621
return stream.bytes.sha256Checksum

0 commit comments

Comments
 (0)