Skip to content

Commit

Permalink
chore: fix clappy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
linsyking committed Sep 9, 2023
1 parent 3034f44 commit bbcc2f7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
if fp == "repl" {
repl(&mut Box::new(prog::Context::new()));
} else {
let res = read_file(&fp);
let res = read_file(fp);
let context = &mut Box::new(prog::Context::new());
prog::eval_prog(&res, context);
let trans = prog::translate(&res, context);
Expand All @@ -46,10 +46,9 @@ fn repl(context: &mut Box<prog::Context>) {

let mut rl = rustyline::DefaultEditor::new().unwrap();
loop {
let line: String;
let readline = rl.readline("> ");
match readline {
Ok(l) => line = l.trim().to_string(),
let line = match readline {
Ok(l) => l.trim().to_string(),
Err(ReadlineError::Interrupted) => {
println!("Interrupted");
break;
Expand All @@ -62,11 +61,11 @@ fn repl(context: &mut Box<prog::Context>) {
println!("invalid input");
break;
}
}
};
if &line.as_str()[0..1] == ":" {
// command
let cmds: Vec<&str> = line.as_str()[1..].split(" ").collect();
let cmd = cmds.get(0).unwrap();
let cmds: Vec<&str> = line.as_str()[1..].split(' ').collect();
let cmd = cmds.first().unwrap();
// let remain = cmds.get(1..).unwrap().join(" ");
if cmd == &"quit" {
break;
Expand Down

0 comments on commit bbcc2f7

Please sign in to comment.