Skip to content

Commit d6ddc0d

Browse files
committed
Use cfg!() rather than a static boolean.
1 parent 4b0b08c commit d6ddc0d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

tokenizer.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ macro_rules! is_match(
4343
pub fn next_component_value(parser: &mut Parser) -> Option<(ComponentValue, SourceLocation)> {
4444
consume_comments(parser);
4545
if parser.is_eof() {
46-
if CFG_TEST {
46+
if cfg!(test) {
4747
assert!(parser.line == parser.input.split_iter('\n').len_(),
4848
"The tokenizer is missing a parser.new_line() call somewhere.")
4949
}
@@ -197,13 +197,6 @@ pub fn next_component_value(parser: &mut Parser) -> Option<(ComponentValue, Sour
197197
// *********** End of public API ***********
198198

199199

200-
#[cfg(not(test))]
201-
static CFG_TEST: bool = false;
202-
203-
#[cfg(test)]
204-
static CFG_TEST: bool = true;
205-
206-
207200
#[inline]
208201
fn preprocess(input: &str) -> ~str {
209202
// TODO: Is this faster if done in one pass?
@@ -246,7 +239,7 @@ impl Parser {
246239

247240
#[inline]
248241
fn new_line(&mut self) {
249-
if CFG_TEST {
242+
if cfg!(test) {
250243
assert!(self.input.char_at(self.position - 1) == '\n')
251244
}
252245
self.line += 1;

0 commit comments

Comments
 (0)