File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -671,13 +671,12 @@ extension Set: SetAlgebra {
671
671
@inlinable
672
672
public init < Source: Sequence > ( _ sequence: __owned Source)
673
673
where Source. Element == Element {
674
- self . init ( minimumCapacity: sequence. underestimatedCount)
675
674
if let s = sequence as? Set < Element > {
676
- // If this sequence is actually a native `Set`, then we can quickly
677
- // adopt its native buffer and let COW handle uniquing only
678
- // if necessary.
679
- self . _variant = s. _variant
675
+ // If this sequence is actually a `Set`, then we can quickly
676
+ // adopt its storage and let COW handle uniquing only if necessary.
677
+ self = s
680
678
} else {
679
+ self . init ( minimumCapacity: sequence. underestimatedCount)
681
680
for item in sequence {
682
681
insert ( item)
683
682
}
You can’t perform that action at this time.
0 commit comments