[meta] Morph a few pub into pub(crate), and remove dead code;

This commit is contained in:
Benjamin Bouvier
2019-09-04 17:50:51 +02:00
parent 8fba449b7b
commit d1d2e790b9
21 changed files with 19 additions and 42 deletions

View File

@@ -11,7 +11,6 @@ use std::fmt;
pub enum Expr {
Var(VarIndex),
Literal(Literal),
Apply(Apply),
}
impl Expr {
@@ -39,7 +38,6 @@ impl Expr {
match self {
Expr::Var(var_index) => var_pool.get(*var_index).to_rust_code(),
Expr::Literal(literal) => literal.to_rust_code(),
Expr::Apply(a) => a.to_rust_code(var_pool),
}
}
}
@@ -81,9 +79,6 @@ impl DefPool {
pub fn get(&self, index: DefIndex) -> &Def {
self.pool.get(index).unwrap()
}
pub fn get_mut(&mut self, index: DefIndex) -> &mut Def {
self.pool.get_mut(index).unwrap()
}
pub fn next_index(&self) -> DefIndex {
self.pool.next_key()
}
@@ -430,16 +425,6 @@ impl Apply {
format!("{}({})", inst_name, args)
}
fn to_rust_code(&self, var_pool: &VarPool) -> String {
let args = self
.args
.iter()
.map(|arg| arg.to_rust_code(var_pool))
.collect::<Vec<_>>()
.join(", ");
format!("{}({})", self.inst.name, args)
}
pub fn inst_predicate(
&self,
format_registry: &FormatRegistry,

View File

@@ -4,7 +4,6 @@ use std::collections::HashMap;
use std::fmt;
use std::ops;
use std::rc::Rc;
use std::slice;
use crate::cdsl::camel_case;
use crate::cdsl::formats::{
@@ -72,10 +71,6 @@ pub struct InstructionGroup {
}
impl InstructionGroup {
pub fn iter(&self) -> slice::Iter<Instruction> {
self.instructions.iter()
}
pub fn by_name(&self, name: &'static str) -> &Instruction {
self.instructions
.iter()

View File

@@ -384,9 +384,6 @@ impl TransformGroups {
pub fn get(&self, id: TransformGroupIndex) -> &TransformGroup {
&self.groups[id]
}
pub fn get_mut(&mut self, id: TransformGroupIndex) -> &mut TransformGroup {
self.groups.get_mut(id).unwrap()
}
fn next_key(&self) -> TransformGroupIndex {
self.groups.next_key()
}