]> git.lizzy.rs Git - rust.git/commit
Refactor `cook_lexer_literal`.
authorNicholas Nethercote <n.nethercote@gmail.com>
Thu, 3 Nov 2022 22:19:34 +0000 (09:19 +1100)
committerNicholas Nethercote <n.nethercote@gmail.com>
Fri, 4 Nov 2022 03:24:41 +0000 (14:24 +1100)
commitd963686f5a87b9eaa2ac2bdc29ddb796e0e83f1f
treec3c881e1570fcd5fe9a582c21c6f27dccd833790
parenta21c0458979d786d821c2d75a1b109fe38914da0
Refactor `cook_lexer_literal`.

It deals with eight cases: ints, floats, and the six quoted types
(char/byte/strings). For ints and floats we have an early return, and
the other six types fall through to the code at the end, which makes the
function hard to read.

This commit rearranges things to avoid the early returns.
compiler/rustc_parse/src/lexer/mod.rs