Skip to content

Commit 5bcfee5

Browse files
committed
Fix clippy errors
1 parent 006394e commit 5bcfee5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

calculator/src/compiler/interpreter.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::only_used_in_recursion)]
12
use crate::{Compile, Node, Operator, Result};
23

34
// ANCHOR: interpreter

calculator/src/parser.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::upper_case_acronyms)]
1+
#![allow(clippy::upper_case_acronyms, clippy::result_large_err)]
22

33
use pest::{self, Parser};
44

@@ -37,14 +37,13 @@ fn build_ast_from_expr(pair: pest::iterators::Pair<Rule>) -> Node {
3737
let mut pair = pair.into_inner();
3838
let lhspair = pair.next().unwrap();
3939
let mut lhs = build_ast_from_term(lhspair);
40-
let mut op = pair.next().unwrap();
40+
let op = pair.next().unwrap();
4141
let rhspair = pair.next().unwrap();
4242
let mut rhs = build_ast_from_term(rhspair);
4343
let mut retval = parse_binary_expr(op, lhs, rhs);
4444
loop {
4545
let pair_buf = pair.next();
46-
if pair_buf != None {
47-
op = pair_buf.unwrap();
46+
if let Some(op) = pair_buf {
4847
lhs = retval;
4948
rhs = build_ast_from_term(pair.next().unwrap());
5049
retval = parse_binary_expr(op, lhs, rhs);

0 commit comments

Comments
 (0)