Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
style: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
aripiprazole committed Nov 23, 2023
1 parent 0c6718d commit 40d317b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use std::fmt::Display;

pub mod semantic;
pub mod parser;
pub mod eval;
pub mod parser;
pub mod semantic;

/// Term is a recursive data structure that represents a list of terms, an atom, an identifier,
/// or an integer.
Expand Down Expand Up @@ -56,7 +56,7 @@ impl Term {
width += t.width();
}
width
},
}
Term::Atom(s) => s.len(),
Term::Identifier(s) => s.len(),
Term::Int(n) => n.to_string().len(),
Expand All @@ -66,7 +66,7 @@ impl Term {
}
}

fn pretty_print(&self, f: &mut std::fmt::Formatter<'_>, indent: usize)-> std::fmt::Result {
fn pretty_print(&self, f: &mut std::fmt::Formatter<'_>, indent: usize) -> std::fmt::Result {
match self {
Term::List(s) | Term::Vec(s) => {
if self.width() + indent > 80 {
Expand All @@ -80,7 +80,7 @@ impl Term {
}

Ok(())
},
}
Term::Atom(s) => write!(f, ":{}", s),
Term::Identifier(s) => write!(f, "{}", s),
Term::Int(s) => write!(f, "{}", s),
Expand Down Expand Up @@ -152,4 +152,4 @@ impl SrcPos {
pub fn reset(&mut self) {
self.byte.start = self.byte.end;
}
}
}
3 changes: 0 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


pub mod repl;

use clap::Parser;
Expand All @@ -19,7 +17,6 @@ struct Args {
}

fn main() -> miette::Result<()> {

// Install the panic handler.
bupropion::install(bupropion::BupropionHandlerOpts::new).into_diagnostic()?;

Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{iter::Peekable, str::Chars};

use crate::{Term, SrcPos};
use crate::{SrcPos, Term};

pub fn is_identifier_char(c: char) -> bool {
c != ' ' && c != '\n' && c != '\t' && c != '(' && c != ')' && c != '"' && c != ';'
Expand Down
8 changes: 4 additions & 4 deletions src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn repl() {
if rl.load_history(&path).is_err() {
println!("No previous history.");
}
}
}

loop {
let readline = rl.readline("> ");
Expand All @@ -53,10 +53,10 @@ pub fn repl() {
println!("Error: {err:?}");
break;
}
}
}
}

if let Some(path) = path {
let _ =rl.append_history(&path);
let _ = rl.append_history(&path);
}
}
}
1 change: 0 additions & 1 deletion src/semantic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ pub mod recur {
}
}


/// Define expression construct, it's a definition of a value.
pub mod def {
pub use super::*;
Expand Down

0 comments on commit 40d317b

Please sign in to comment.