Readme and clippy cleanups

This commit is contained in:
Ava Apples Affine 2023-05-28 23:22:49 +00:00
parent cbd52de91b
commit 8cc0202a7b
13 changed files with 159 additions and 197 deletions

View file

@ -20,11 +20,7 @@ use crate::error::{Traceback, start_trace};
use std::rc::Rc;
fn isnumeric(arg: &Ctr) -> bool {
match arg {
Ctr::Integer(_) => true,
Ctr::Float(_) => true,
_ => false,
}
matches!(arg, Ctr::Integer(_) | Ctr::Float(_))
}
const ADD_DOCSTRING: &str =
@ -175,7 +171,7 @@ fn floatcast_callback(ast: &Seg, _: &mut SymTable) -> Result<Ctr, Traceback> {
if let Ctr::Integer(i) = *ast.car {
Ok(Ctr::Float(i as f64))
} else if let Ctr::String(ref s) = *ast.car {
let flt = str::parse::<f64>(&s);
let flt = str::parse::<f64>(s);
if flt.is_err() {
Err(start_trace(
("float", flt.err().unwrap().to_string())
@ -452,7 +448,7 @@ fn inc_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
let sym_ret = syms
.remove(&var_name);
if let None = sym_ret {
if sym_ret.is_none() {
return Err(start_trace(
("inc", format!("input ({var_name}) is not defined"))
.into()))
@ -499,7 +495,7 @@ fn dec_callback(ast: &Seg, syms: &mut SymTable) -> Result<Ctr, Traceback> {
let sym_ret = syms
.remove(&var_name);
if let None = sym_ret {
if sym_ret.is_none() {
return Err(start_trace(
("dec", format!("input ({var_name}) is not defined"))
.into()))