Skip to content

Commit 75f4c58

Browse files
authored
Merge pull request #4551 from Nirma/string_fix
[stdlib] Move empty check for string concatenation to front
2 parents ab59308 + 3fa0946 commit 75f4c58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/String.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,10 @@ extension String {
704704
@effects(readonly)
705705
@_semantics("string.concat")
706706
public static func + (lhs: String, rhs: String) -> String {
707-
var lhs = lhs
708707
if lhs.isEmpty {
709708
return rhs
710709
}
710+
var lhs = lhs
711711
lhs._core.append(rhs._core)
712712
return lhs
713713
}

0 commit comments

Comments
 (0)