Skip to content

Commit

Permalink
Clippy: Simplify Literal variant
Browse files Browse the repository at this point in the history
The CMR value of this variant is never used. Maybe the design of the
humanb encoding changed and the Literal variant became useless?
  • Loading branch information
uncomputable committed Apr 23, 2024
1 parent c96d5c8 commit 7cb028a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/human_encoding/parse/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! Parsing
use std::mem;
use std::str::FromStr;
use std::sync::Arc;

use crate::human_encoding::{Error, ErrorSet, Position, WitnessOrHole};
Expand Down Expand Up @@ -61,7 +60,7 @@ pub enum ExprInner<J> {
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub enum AstCmr<J> {
Expr(Arc<Expression<J>>),
Literal(Cmr),
Literal,
}

/// A type, as represented in the AST
Expand Down Expand Up @@ -395,9 +394,7 @@ impl<J: Jet> Ast<J> {
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<Type>, Option<Type>) {
Expand Down
11 changes: 5 additions & 6 deletions src/human_encoding/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -139,7 +138,7 @@ struct ResolvedExpression<J: Jet> {

enum ResolvedCmr<J: Jet> {
Expr(Arc<ResolvedExpression<J>>),
Literal(Cmr),
Literal,
}

enum ResolvedInner<J: Jet> {
Expand Down Expand Up @@ -312,7 +311,7 @@ pub fn parse<J: Jet + 'static>(
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)
}
Expand All @@ -323,7 +322,7 @@ pub fn parse<J: Jet + 'static>(
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();
Expand Down Expand Up @@ -413,8 +412,8 @@ pub fn parse<J: Jet + 'static>(
| 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),
}
}
Expand Down

0 comments on commit 7cb028a

Please sign in to comment.