use while let instead of while and if let

This commit is contained in:
Erik Little 2018-08-28 10:46:52 -04:00
parent a3d443268a
commit d632135289
No known key found for this signature in database
GPG Key ID: 62F837E56F4E9320

View File

@ -109,14 +109,11 @@ public extension SocketParsable where Self: SocketManagerSpec & SocketDataBuffer
if type == .error {
reader.advance(by: -1)
} else {
while reader.hasNext {
if let int = Int(reader.read(count: 1)) {
idString += String(int)
} else {
reader.advance(by: -2)
break
}
while let int = Int(reader.read(count: 1)) {
idString += String(int)
}
reader.advance(by: -2)
}
var dataArray = String(message.utf16[message.utf16.index(reader.currentIndex, offsetBy: 1)...])!