diff options
| author | Cody <cody@codyq.dev> | 2023-02-27 12:29:02 -0600 |
|---|---|---|
| committer | Cody <cody@codyq.dev> | 2023-02-27 12:29:02 -0600 |
| commit | 0c5616a91d7280341dc6aa522daf04d151108d4e (patch) | |
| tree | 66764fc099073092c0359ddf0d18c12a1f824cd9 /src/main.rs | |
| parent | e4199d2837d2179f17e97b8d50366d96c8babded (diff) | |
| download | sloth-0c5616a91d7280341dc6aa522daf04d151108d4e.tar.gz | |
Cleaned up some code
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/main.rs b/src/main.rs index 4ee455c..91db8c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,20 +6,18 @@ clippy::manual_ok_or, unused_lifetimes )] -#![allow(unused)] pub mod ast; pub mod interpreter; pub mod lexer; -use std::io::{self, BufRead, Read, Write}; -use std::{env, fs}; +use std::io::{BufRead, Write}; +use std::{env, fs, io}; use itertools::Itertools; use rand::Rng; use crate::ast::parser::AstParser; -use crate::ast::AstVisitor; use crate::interpreter::{AstInterpreter, InternalFunction, Value}; use crate::lexer::Lexer; @@ -55,12 +53,12 @@ fn main() { let mut buffer = String::new(); for arg in args { - write!(&mut buffer, "{}", arg); + write!(&mut buffer, "{}", arg).unwrap(); } let mut stdout = io::stdout(); - stdout.lock().write_all(buffer.as_bytes()); - stdout.flush(); + stdout.lock().write_all(buffer.as_bytes()).unwrap(); + stdout.flush().unwrap(); Value::Nil })), @@ -73,13 +71,13 @@ fn main() { let mut buffer = String::new(); for arg in args { - write!(&mut buffer, "{}", arg); + write!(&mut buffer, "{}", arg).unwrap(); } - writeln!(&mut buffer); + writeln!(&mut buffer).unwrap(); let mut stdout = io::stdout(); - stdout.lock().write_all(buffer.as_bytes()); - stdout.flush(); + stdout.lock().write_all(buffer.as_bytes()).unwrap(); + stdout.flush().unwrap(); Value::Nil })), @@ -87,7 +85,7 @@ fn main() { interpreter.callables.insert( "readln".to_owned(), - Box::new(InternalFunction(&|args| { + Box::new(InternalFunction(&|_| { let stdin = io::stdin(); let mut line = String::new(); stdin |
