diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-25 09:41:41 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-25 19:01:31 +0200 |
| commit | c04609bcdb7c7952501ddffc82fb97246ae0f6d4 (patch) | |
| tree | ffe56c8be1a218eac78733458b91563829c84f45 /src/ast.rs | |
| parent | adbca5c121caaa7ed041a4b1bd9f2a2ac6981af7 (diff) | |
Implement clippy lint suggestions
Diffstat (limited to 'src/ast.rs')
| -rw-r--r-- | src/ast.rs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -41,7 +41,7 @@ impl Statement { let mut parameters: Vec<Symbol> = vec![]; let mut expression_opt: Option<Rc<Expression>> = None; - while let Some(p) = inner.next() { + for p in inner { match p.as_rule() { Rule::symbol => parameters.push(p.as_span().as_str().to_owned()), Rule::expression => { @@ -61,8 +61,8 @@ impl Statement { Statement::Definition { symbol: symbol.to_owned(), - parameters: parameters, - expression: expression, + parameters, + expression, } } @@ -117,7 +117,7 @@ pub enum Expression { Binary(ExpressionInner, ExpressionInner), } -fn expression_vec_to_tuple(v: &Vec<ExpressionInner>) -> Rc<Expression> { +fn expression_vec_to_tuple(v: &[ExpressionInner]) -> Rc<Expression> { match v.len() { 1 => Rc::new(Expression::Unary(v[0].clone())), 2 => Rc::new(Expression::Binary(v[0].clone(), v[1].clone())), |
