authorgravatar for 81112205+RohanVashisht1234@users.noreply.github.comRohan Vashisht <81112205+RohanVashisht1234@users.noreply.github.com> 2024-11-30 01:56:23+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-11-29 12:26:23-08:00
log88d57917b7df1f0c59d27a923bd564f5d21f7846
treeb5ac0fd5e5f995ffbd720fa15a71181a3dee8b44
parent07cd488d4216742b2a29af95e330728a0f83627f
signaturebadge-check Signed by PGP key B5690EEEBB952194

Updated ascii.zig's isWhitespace function to use switch instead of for loop. (#22094)


1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/ascii.zig+4-4
......@@ -135,10 +135,10 @@ pub fn isPrint(c: u8) bool {
135135
136136/// Returns whether this character is included in `whitespace`.
137137pub fn isWhitespace(c: u8) bool {
138 return for (whitespace) |other| {
139 if (c == other)
140 break true;
141 } else false;
138 return switch (c) {
139 ' ', '\t'...'\r' => true,
140 else => false,
141 };
142142}
143143
144144/// Whitespace for general use.