Skip to content

Commit a240942

Browse files
Nicholas Maccharolimoiseev
authored andcommitted
[stdlib] cleanup UnicodeScalar initializer for UInt16 (#4504)
1 parent 4f9dbbf commit a240942

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

stdlib/public/core/UnicodeScalar.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,7 @@ public struct UnicodeScalar :
127127
/// // Do something else
128128
/// }
129129
public init?(_ v: UInt16) {
130-
if let us = UnicodeScalar(UInt32(v)) {
131-
self = us
132-
} else {
133-
return nil
134-
}
130+
self.init(UInt32(v))
135131
}
136132

137133
/// Creates a Unicode scalar with the specified numeric value.

0 commit comments

Comments
 (0)