From 2909fc5ffd15cd3d13ce0978361dfa947a88ba01 Mon Sep 17 00:00:00 2001 From: mehbark Date: Thu, 6 Jul 2023 14:31:00 -0400 Subject: [PATCH] gonna show this --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 09fd997..bf3ef5e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,7 @@ pub fn main() { } } +#[must_use] pub fn do_it() -> Option { let buf = if let Some(buf) = env::args().nth(1) { buf @@ -48,6 +49,7 @@ pub enum Sexp { } impl Sexp { + #[must_use] pub fn nil() -> Self { Self::List(Vec::new()) } @@ -80,7 +82,7 @@ impl Sexp { pub fn list(&self) -> Option<&[Sexp]> { match self { Sexp::Atom(_) => None, - Sexp::List(xs) => Some(&xs), + Sexp::List(xs) => Some(xs), } } @@ -204,6 +206,7 @@ pub enum Token<'src> { Atom(&'src str), } +#[must_use] pub fn lex(src: &str) -> Vec { // maybe a bad idea? let mut out = Vec::with_capacity(src.len()); @@ -323,14 +326,17 @@ pub enum Rule { } impl Rule { + #[must_use] pub fn forall(vars: Vec, lhs: Sexp, rhs: Sexp) -> Rule { Rule::Forall { vars, lhs, rhs } } + #[must_use] pub fn concrete(lhs: Sexp, rhs: Sexp) -> Rule { Rule::Concrete { lhs, rhs } } + #[must_use] pub fn concrify(&self, sexp: &Sexp) -> Rule { match self { Rule::Forall { vars, lhs, rhs } => { @@ -359,6 +365,7 @@ impl Rule { } } + #[must_use] pub fn concretions(&self, targets: &HashSet<&Sexp>) -> HashSet { if self.is_concrete() { let mut out = HashSet::with_capacity(1); @@ -438,6 +445,7 @@ impl Rule { matches!(self, Self::Concrete { .. }) } + #[must_use] pub fn var_replace(from: Symbol, to: &Sexp) -> Rule { Rule::Concrete { lhs: Sexp::Atom(from), @@ -480,6 +488,7 @@ impl fmt::Display for Rule { } } +#[must_use] pub fn could_match(vars: Option<&[Symbol]>, lhs: &Sexp, expr: &Sexp) -> bool { let is_var = |var: &Symbol| -> bool { match vars {