Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7cb028a

Browse files
committedApr 23, 2024·
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?
1 parent c96d5c8 commit 7cb028a

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed
 

‎src/human_encoding/parse/ast.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! Parsing
44
55
use std::mem;
6-
use std::str::FromStr;
76
use std::sync::Arc;
87

98
use crate::human_encoding::{Error, ErrorSet, Position, WitnessOrHole};
@@ -61,7 +60,7 @@ pub enum ExprInner<J> {
6160
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
6261
pub enum AstCmr<J> {
6362
Expr(Arc<Expression<J>>),
64-
Literal(Cmr),
63+
Literal,
6564
}
6665

6766
/// A type, as represented in the AST
@@ -395,9 +394,7 @@ impl<J: Jet> Ast<J> {
395394
assert_eq!(lexemes.len(), 1);
396395
assert_eq!(lexemes[0].raw.len(), 65);
397396

398-
Ast::Cmr(AstCmr::Literal(
399-
Cmr::from_str(&lexemes[0].raw[1..]).unwrap(),
400-
))
397+
Ast::Cmr(AstCmr::Literal)
401398
}
402399

403400
fn expect_arrow(&mut self) -> (Option<Type>, Option<Type>) {

‎src/human_encoding/parse/mod.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::dag::{Dag, DagLike, InternalSharing};
88
use crate::jet::Jet;
99
use crate::node;
1010
use crate::types::Type;
11-
use crate::Cmr;
1211
use std::collections::HashMap;
1312
use std::mem;
1413
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -139,7 +138,7 @@ struct ResolvedExpression<J: Jet> {
139138

140139
enum ResolvedCmr<J: Jet> {
141140
Expr(Arc<ResolvedExpression<J>>),
142-
Literal(Cmr),
141+
Literal,
143142
}
144143

145144
enum ResolvedInner<J: Jet> {
@@ -312,7 +311,7 @@ pub fn parse<J: Jet + 'static>(
312311
right.in_degree.fetch_add(1, Ordering::SeqCst);
313312
ResolvedCmr::Expr(right)
314313
}
315-
ast::AstCmr::Literal(cmr) => ResolvedCmr::Literal(*cmr),
314+
ast::AstCmr::Literal => ResolvedCmr::Literal,
316315
};
317316
ResolvedInner::AssertL(left, right)
318317
}
@@ -323,7 +322,7 @@ pub fn parse<J: Jet + 'static>(
323322
left.in_degree.fetch_add(1, Ordering::SeqCst);
324323
ResolvedCmr::Expr(left)
325324
}
326-
ast::AstCmr::Literal(cmr) => ResolvedCmr::Literal(*cmr),
325+
ast::AstCmr::Literal => ResolvedCmr::Literal,
327326
};
328327

329328
let right = inline_stack.pop().unwrap();
@@ -413,8 +412,8 @@ pub fn parse<J: Jet + 'static>(
413412
| ResolvedInner::AssertR(ResolvedCmr::Expr(ref left), ref right) => {
414413
Dag::Binary(left, right)
415414
}
416-
ResolvedInner::AssertL(ref child, ResolvedCmr::Literal(..))
417-
| ResolvedInner::AssertR(ResolvedCmr::Literal(..), ref child) => Dag::Unary(child),
415+
ResolvedInner::AssertL(ref child, ResolvedCmr::Literal)
416+
| ResolvedInner::AssertR(ResolvedCmr::Literal, ref child) => Dag::Unary(child),
418417
ResolvedInner::Inline(ref inner) => inner.as_dag().map(|node| node),
419418
}
420419
}

0 commit comments

Comments
 (0)
Please sign in to comment.