clippy lints

This commit is contained in:
nora 2021-09-19 14:26:34 +02:00
parent 3f159f644d
commit 8a32cbf057
2 changed files with 4 additions and 4 deletions

View file

@ -90,11 +90,11 @@ pub fn start(program_path: Option<String>) {
} }
} }
fn read_and_run<'a>(path: &str) { fn read_and_run(path: &str) {
let path = Path::new(path); let path = Path::new(path);
match std::fs::read_to_string(path) { match std::fs::read_to_string(path) {
Ok(content) => match stmt::parse(&content, filename(&path)) { Ok(content) => match stmt::parse(&content, filename(path)) {
Ok(stmts) => run(stmts), Ok(stmts) => run(stmts),
Err(why) => eprintln!("error while parsing: {}.", why), Err(why) => eprintln!("error while parsing: {}.", why),
}, },

View file

@ -223,8 +223,8 @@ fn parse_line(line: &str) -> Result<IrStmt, String> {
} }
"STOP" => IrStmt::Stop, "STOP" => IrStmt::Stop,
stmt => { stmt => {
if stmt.starts_with('.') { if let Some(stripped) = stmt.strip_prefix('.') {
IrStmt::Label(&stmt[1..]) IrStmt::Label(stripped)
} else if stmt.starts_with('#') { } else if stmt.starts_with('#') {
IrStmt::None IrStmt::None
} else { } else {