From 5c28af1ac79ef3a1036e1816a2708790624c02dd Mon Sep 17 00:00:00 2001 From: Bastiaan Veelo Date: Thu, 18 Oct 2018 10:59:25 +0200 Subject: [PATCH] Simplify, don't special-case comments. Not much is gained by using `tokenLength` anyway, use the slice length for everything. `len` is now unsigned so the assert is obsolete. --- src/dfmt/formatter.d | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index ef30a25..b5a9a37 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -533,8 +533,7 @@ private: { if (tokens[i].type == tok!"," || tokens[i].type == tok!";") break; - immutable len = tokens[i].type == tok!"comment" ? tokens[i].text.length : tokenLength(tokens[i]); - assert(len >= 0); + immutable len = tokens[i].text.length; lengthOfNextChunk += len; } assert(lengthOfNextChunk > 0);