From 0c4e15a52eb071a454eb34f2d1eacd894b252ec9 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 26 Aug 2020 12:36:30 +0200 Subject: [PATCH] [reader] Replace == None with .is_none() in Parser::token This replaces a full function call with matching on both lhs and rhs with a single cmpb instruction. --- cranelift/reader/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cranelift/reader/src/parser.rs b/cranelift/reader/src/parser.rs index 44a2ea30e3..230d1b83d3 100644 --- a/cranelift/reader/src/parser.rs +++ b/cranelift/reader/src/parser.rs @@ -445,7 +445,7 @@ impl<'a> Parser<'a> { // running. I don't think this is true - self.lookahead is mutated in the loop body - so // maybe this is a clippy bug? Either way, disable clippy for this. #[cfg_attr(feature = "cargo-clippy", allow(clippy::while_immutable_condition))] - while self.lookahead == None { + while self.lookahead.is_none() { match self.lex.next() { Some(Ok(LocatedToken { token, location })) => { match token {