remove assertion that String.UTF8View doesn't underestimate count (#392)

Motivation:

I left an assertion that String.UTF8View's underestimatedCount is equal
to the actual count of UTF-8 code units. It's good to see that it never
failed so far so we can expect it to be really good which is important
for performance.
However, there's no problem if it does actually underestimate maybe for
some special kind of Strings. So the assertion really isn't meaningful.

Modifications:

Remove the assertion.

Result:

Most likely nothing but we will not crash on something that we
shouldn't crash on.
This commit is contained in:
Johannes Weiß authored and Norman Maurer committed 2018-05-06 20:34:28 +02:00
1 parent a7ed5fd4e9
commit 12cae95c64
1 file changed
-1
-1
View File
@@ -386,7 +386,6 @@ public struct ByteBuffer {
var (iterator, idx) = UnsafeMutableBufferPointer(start: base, count: underestimatedByteCount).initialize(from: bytes)
assert(idx == underestimatedByteCount)
while let b = iterator.next() {
assert(S.self != String.UTF8View.self)
base = ensureCapacityAndReturnStorageBase(capacity: idx + 1)
base[idx] = b
idx += 1