Skip to content

Commit d632135

Browse files
committed
use while let instead of while and if let
1 parent a3d4432 commit d632135

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Source/SocketIO/Parse/SocketParsable.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,11 @@ public extension SocketParsable where Self: SocketManagerSpec & SocketDataBuffer
109109
if type == .error {
110110
reader.advance(by: -1)
111111
} else {
112-
while reader.hasNext {
113-
if let int = Int(reader.read(count: 1)) {
114-
idString += String(int)
115-
} else {
116-
reader.advance(by: -2)
117-
break
118-
}
112+
while let int = Int(reader.read(count: 1)) {
113+
idString += String(int)
119114
}
115+
116+
reader.advance(by: -2)
120117
}
121118

122119
var dataArray = String(message.utf16[message.utf16.index(reader.currentIndex, offsetBy: 1)...])!

0 commit comments

Comments
 (0)