From 7cb028ac78963351ea850869ff06ea031680619d Mon Sep 17 00:00:00 2001 From: Christian Lewe Date: Tue, 23 Apr 2024 15:40:16 +0200 Subject: [PATCH] Clippy: Simplify Literal variant The CMR value of this variant is never used. Maybe the design of the humanb encoding changed and the Literal variant became useless? --- src/human_encoding/parse/ast.rs | 7 ++----- src/human_encoding/parse/mod.rs | 11 +++++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/human_encoding/parse/ast.rs b/src/human_encoding/parse/ast.rs index c25dd95e..241b606b 100644 --- a/src/human_encoding/parse/ast.rs +++ b/src/human_encoding/parse/ast.rs @@ -3,7 +3,6 @@ //! Parsing use std::mem; -use std::str::FromStr; use std::sync::Arc; use crate::human_encoding::{Error, ErrorSet, Position, WitnessOrHole}; @@ -61,7 +60,7 @@ pub enum ExprInner { #[derive(Debug, PartialEq, Eq, Clone, Hash)] pub enum AstCmr { Expr(Arc>), - Literal(Cmr), + Literal, } /// A type, as represented in the AST @@ -395,9 +394,7 @@ impl Ast { assert_eq!(lexemes.len(), 1); assert_eq!(lexemes[0].raw.len(), 65); - Ast::Cmr(AstCmr::Literal( - Cmr::from_str(&lexemes[0].raw[1..]).unwrap(), - )) + Ast::Cmr(AstCmr::Literal) } fn expect_arrow(&mut self) -> (Option, Option) { diff --git a/src/human_encoding/parse/mod.rs b/src/human_encoding/parse/mod.rs index 10adc728..17a60cf4 100644 --- a/src/human_encoding/parse/mod.rs +++ b/src/human_encoding/parse/mod.rs @@ -8,7 +8,6 @@ use crate::dag::{Dag, DagLike, InternalSharing}; use crate::jet::Jet; use crate::node; use crate::types::Type; -use crate::Cmr; use std::collections::HashMap; use std::mem; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -139,7 +138,7 @@ struct ResolvedExpression { enum ResolvedCmr { Expr(Arc>), - Literal(Cmr), + Literal, } enum ResolvedInner { @@ -312,7 +311,7 @@ pub fn parse( right.in_degree.fetch_add(1, Ordering::SeqCst); ResolvedCmr::Expr(right) } - ast::AstCmr::Literal(cmr) => ResolvedCmr::Literal(*cmr), + ast::AstCmr::Literal => ResolvedCmr::Literal, }; ResolvedInner::AssertL(left, right) } @@ -323,7 +322,7 @@ pub fn parse( left.in_degree.fetch_add(1, Ordering::SeqCst); ResolvedCmr::Expr(left) } - ast::AstCmr::Literal(cmr) => ResolvedCmr::Literal(*cmr), + ast::AstCmr::Literal => ResolvedCmr::Literal, }; let right = inline_stack.pop().unwrap(); @@ -413,8 +412,8 @@ pub fn parse( | ResolvedInner::AssertR(ResolvedCmr::Expr(ref left), ref right) => { Dag::Binary(left, right) } - ResolvedInner::AssertL(ref child, ResolvedCmr::Literal(..)) - | ResolvedInner::AssertR(ResolvedCmr::Literal(..), ref child) => Dag::Unary(child), + ResolvedInner::AssertL(ref child, ResolvedCmr::Literal) + | ResolvedInner::AssertR(ResolvedCmr::Literal, ref child) => Dag::Unary(child), ResolvedInner::Inline(ref inner) => inner.as_dag().map(|node| node), } }