Skip to content

Commit

Permalink
Cleaner dictionary lookup and insertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoathaydes committed Jan 20, 2024
1 parent b8c072f commit 1ee3d85
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/d/src/dencoder.d
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,7 @@ string[][Key] loadDictionary(string path) @trusted
{
auto word = line.idup;
auto n = word.wordToNumber;
auto words = n in result;
if (words is null)
{
result[n] = [word];
}
else
{
*words ~= word;
}
result.require(n, []) ~= word;
}
return result;
}
Expand Down

0 comments on commit 1ee3d85

Please sign in to comment.