Skip to content

Commit f9e137c

Browse files
committed
Get rid of a forced unwrap and extra lookup of each key when iterating a sorted dictionary.
1 parent c3bd142 commit f9e137c

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
@@ -590,8 +590,8 @@ public final class ManifestLoader: ManifestLoaderProtocol {
590590
stream <<< packageIdentity
591591
stream <<< manifestContents
592592
stream <<< toolsVersion.description
593-
for key in env.keys.sorted(by: >) {
594-
stream <<< key <<< env[key]! // forced unwrap safe
593+
for (key, value) in env.sorted(by: { $0.key > $1.key }) {
594+
stream <<< key <<< value
595595
}
596596
stream <<< swiftpmVersion
597597
return stream.bytes.sha256Checksum

0 commit comments

Comments
 (0)