From 04bde8da293557c29ea24181708cecdce922e9bc Mon Sep 17 00:00:00 2001 From: bptato Date: Fri, 6 Jan 2023 22:24:40 +0100 Subject: utils/twtstr: simplify mnormalize Use the isAscii function for early return. --- src/utils/twtstr.nim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/utils') diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index 5a5d5819..582d68d4 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -555,10 +555,7 @@ proc mnormalize*(rs: var seq[Rune], form = UNICODE_NFC) = {.cast(noSideEffect).} #TODO maybe a utf8 normalization procedure? proc mnormalize*(s: var string) = - block do_nothing: - for c in s: - if c notin Ascii: - break do_nothing + if s.isAscii(): return # no need to normalize ascii var rs = s.toRunes() rs.mnormalize() -- cgit 1.4.1-2-gfad0