Skip to content

Commit

Permalink
Automatic cargo fix --edition + format
Browse files Browse the repository at this point in the history
  • Loading branch information
teofr committed Jan 21, 2020
1 parent 8ead8a8 commit bd44c04
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 39 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ authors = ["Nicl team"]
license = "MIT OR Apache-2.0"
readme = "README.md"
description = "Programmable configuration files."
edition = "2018"

[build-dependencies] # <-- We added this and everything after!
lalrpop = "0.16.2"
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs ? import (builtins.fetchTarball "channel:nixos-19.03") {} }:
{ pkgs ? import (builtins.fetchTarball "channel:nixos-19.09") {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
rust.cargo
Expand Down
16 changes: 8 additions & 8 deletions src/eval.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use identifier::Ident;
use label::Label;
use operation::{continuate_operation, OperationCont};
use stack::Stack;
use crate::identifier::Ident;
use crate::label::Label;
use crate::operation::{continuate_operation, OperationCont};
use crate::stack::Stack;
use crate::term::{RichTerm, Term};
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::{Rc, Weak};
use term::{RichTerm, Term};

pub type Enviroment = HashMap<Ident, (Rc<RefCell<Closure>>, IdentKind)>;
pub type CallStack = Vec<StackElem>;
Expand Down Expand Up @@ -153,7 +153,7 @@ pub fn eval(t0: RichTerm) -> Result<Term, EvalError> {
}
}
} else {
let mut cont_result = continuate_operation(clos, &mut stack, &mut call_stack);
let cont_result = continuate_operation(clos, &mut stack, &mut call_stack);

if let Err(EvalError::BlameError(l, _)) = cont_result {
return Err(EvalError::BlameError(l, Some(call_stack)));
Expand Down Expand Up @@ -192,8 +192,8 @@ pub fn eval(t0: RichTerm) -> Result<Term, EvalError> {
#[cfg(test)]
mod tests {
use super::*;
use label::TyPath;
use term::UnaryOp;
use crate::label::TyPath;
use crate::term::UnaryOp;

#[test]
fn identity_over_values() {
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod term;
mod typecheck;
mod types;

use program::Program;
use crate::program::Program;

#[cfg(test)]
#[macro_use]
Expand Down
12 changes: 6 additions & 6 deletions src/operation.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use eval::{CallStack, Closure, EvalError};
use identifier::Ident;
use label::TyPath;
use stack::Stack;
use term::{BinaryOp, RichTerm, Term, UnaryOp};
use crate::eval::{CallStack, Closure, EvalError};
use crate::identifier::Ident;
use crate::label::TyPath;
use crate::stack::Stack;
use crate::term::{BinaryOp, RichTerm, Term, UnaryOp};

#[derive(Debug, PartialEq)]
pub enum OperationCont {
Expand Down Expand Up @@ -240,7 +240,7 @@ fn process_binary_operation(
#[cfg(test)]
mod tests {
use super::*;
use eval::{CallStack, Enviroment};
use crate::eval::{CallStack, Enviroment};
use std::collections::HashMap;

fn some_env() -> Enviroment {
Expand Down
6 changes: 3 additions & 3 deletions src/parser/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use identifier::Ident;
use term::Term::*;
use term::{BinaryOp, RichTerm, UnaryOp};
use crate::identifier::Ident;
use crate::term::Term::*;
use crate::term::{BinaryOp, RichTerm, UnaryOp};

fn parse_without_pos(s: &str) -> RichTerm {
let parser = super::grammar::TermParser::new();
Expand Down
12 changes: 6 additions & 6 deletions src/program.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use eval::{eval, CallStack, EvalError, IdentKind, StackElem};
use identifier::Ident;
use label::{Label, TyPath};
use parser;
use crate::eval::{eval, CallStack, EvalError, IdentKind, StackElem};
use crate::identifier::Ident;
use crate::label::{Label, TyPath};
use crate::parser;
use crate::term::{RichTerm, Term};
use crate::typecheck::type_check;
use std::fs;
use std::io::{self, Read};
use std::path::Path;
use std::result::Result;
use term::{RichTerm, Term};
use typecheck::type_check;

pub struct Program<T: Read> {
src: T,
Expand Down
6 changes: 3 additions & 3 deletions src/stack.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use eval::Closure;
use operation::OperationCont;
use crate::eval::Closure;
use crate::operation::OperationCont;
use std::cell::RefCell;
use std::rc::Weak;

Expand Down Expand Up @@ -130,8 +130,8 @@ impl Stack {
#[cfg(test)]
mod tests {
use super::*;
use crate::term::{Term, UnaryOp};
use std::rc::Rc;
use term::{Term, UnaryOp};

fn some_closure() -> Closure {
Closure::atomic_closure(Term::Bool(true).into())
Expand Down
6 changes: 3 additions & 3 deletions src/term.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use identifier::Ident;
use label::Label;
use types::Types;
use crate::identifier::Ident;
use crate::label::Label;
use crate::types::Types;

#[derive(Debug, PartialEq, Clone)]
pub enum Term {
Expand Down
12 changes: 6 additions & 6 deletions src/typecheck.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use identifier::Ident;
use crate::identifier::Ident;
use crate::term::{BinaryOp, Term, UnaryOp};
use crate::types::{AbsType, Types};
use std::collections::HashMap;
use term::{BinaryOp, Term, UnaryOp};
use types::{AbsType, Types};

// Type checking
pub fn type_check(t: &Term) -> Result<(), String> {
Expand Down Expand Up @@ -362,10 +362,10 @@ pub fn get_root(s: &GTypes, x: usize) -> Result<TypeWrapper, String> {
#[cfg(test)]
mod tests {
use super::*;
use label::{Label, TyPath};
use term::RichTerm;
use crate::label::{Label, TyPath};
use crate::term::RichTerm;

use parser;
use crate::parser;

fn parse_and_typecheck(s: &str) -> Result<(), String> {
if let Ok(p) = parser::grammar::TermParser::new().parse(s) {
Expand Down
4 changes: 2 additions & 2 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use identifier::Ident;
use crate::identifier::Ident;
use crate::term::{RichTerm, Term};
use std::collections::HashMap;
use term::{RichTerm, Term};

#[derive(Clone, PartialEq, Debug)]
pub enum AbsType<Ty> {
Expand Down

0 comments on commit bd44c04

Please sign in to comment.