diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 04f92f5..7cf2fb5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,6 +16,11 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + profile: minimal + components: rustfmt, clippy - name: Build run: cargo build --verbose - name: Run tests diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 31578d3..271800c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "stable" \ No newline at end of file +channel = "nightly" \ No newline at end of file diff --git a/src/foreign_macros/atomic_impl.rs b/src/foreign_macros/atomic_impl.rs index 92a945c..bb6a7c7 100644 --- a/src/foreign_macros/atomic_impl.rs +++ b/src/foreign_macros/atomic_impl.rs @@ -32,25 +32,30 @@ use crate::Primitive; /// /// _definition of the `add` function in the STL_ /// ``` -/// use orchidlang::stl::Numeric; /// use orchidlang::interpreted::ExprInst; +/// use orchidlang::stl::Numeric; /// use orchidlang::{atomic_impl, atomic_redirect, externfn_impl}; -/// +/// /// #[derive(Clone)] /// pub struct Add2; /// externfn_impl!(Add2, |_: &Self, x: ExprInst| Ok(Add1 { x })); -/// +/// /// #[derive(Debug, Clone)] -/// pub struct Add1 { x: ExprInst } +/// pub struct Add1 { +/// x: ExprInst, +/// } /// atomic_redirect!(Add1, x); /// atomic_impl!(Add1); /// externfn_impl!(Add1, |this: &Self, x: ExprInst| { /// let a: Numeric = this.x.clone().try_into()?; /// Ok(Add0 { a, x }) /// }); -/// +/// /// #[derive(Debug, Clone)] -/// pub struct Add0 { a: Numeric, x: ExprInst } +/// pub struct Add0 { +/// a: Numeric, +/// x: ExprInst, +/// } /// atomic_redirect!(Add0, x); /// atomic_impl!(Add0, |Self { a, x }: &Self, _| { /// let b: Numeric = x.clone().try_into()?; @@ -74,10 +79,8 @@ macro_rules! atomic_impl { ctx: $crate::interpreter::Context, ) -> $crate::foreign::AtomicResult { // extract the expression - let expr = >::as_ref(self) - .clone(); + let expr = + >::as_ref(self).clone(); // run the expression let ret = $crate::interpreter::run(expr, ctx.clone())?; let $crate::interpreter::Return { gas, state, inert } = ret; diff --git a/src/foreign_macros/atomic_redirect.rs b/src/foreign_macros/atomic_redirect.rs index 79e51a5..ceb202b 100644 --- a/src/foreign_macros/atomic_redirect.rs +++ b/src/foreign_macros/atomic_redirect.rs @@ -23,13 +23,9 @@ macro_rules! atomic_redirect { &self.$field } } - impl From<(&Self, $crate::interpreted::ExprInst)> - for $typ - { + impl From<(&Self, $crate::interpreted::ExprInst)> for $typ { #[allow(clippy::needless_update)] - fn from( - (old, $field): (&Self, $crate::interpreted::ExprInst), - ) -> Self { + fn from((old, $field): (&Self, $crate::interpreted::ExprInst)) -> Self { Self { $field, ..old.clone() } } } diff --git a/src/foreign_macros/externfn_impl.rs b/src/foreign_macros/externfn_impl.rs index d4b0d79..7be0e98 100644 --- a/src/foreign_macros/externfn_impl.rs +++ b/src/foreign_macros/externfn_impl.rs @@ -34,11 +34,9 @@ macro_rules! externfn_impl { let closure = $next_atomic; match closure(self, arg) { // ? casts the result but we want to strictly forward it - Ok(r) => Ok($crate::interpreted::Clause::P( - $crate::Primitive::Atom( - $crate::foreign::Atom::new(r), - ), - )), + Ok(r) => Ok($crate::interpreted::Clause::P($crate::Primitive::Atom( + $crate::foreign::Atom::new(r), + ))), Err(e) => Err(e), } } diff --git a/src/interpreter/apply.rs b/src/interpreter/apply.rs index 9f238f6..9739148 100644 --- a/src/interpreter/apply.rs +++ b/src/interpreter/apply.rs @@ -70,10 +70,12 @@ fn substitute(paths: &PathSet, value: Clause, body: ExprInst) -> ExprInst { x: substitute(right, value.clone(), x.clone()), }), (Clause::LambdaArg, None) => Ok(value.clone()), - (_, None) => - panic!("Substitution path ends in something other than LambdaArg"), - (_, Some(_)) => - panic!("Substitution path leads into something other than Apply"), + (_, None) => { + panic!("Substitution path ends in something other than LambdaArg") + }, + (_, Some(_)) => { + panic!("Substitution path leads into something other than Apply") + }, } }) .unwrap() diff --git a/src/interpreter/error.rs b/src/interpreter/error.rs index 8058d59..b8c4d34 100644 --- a/src/interpreter/error.rs +++ b/src/interpreter/error.rs @@ -23,8 +23,9 @@ impl Display for RuntimeError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Extern(e) => write!(f, "Error in external function: {e}"), - Self::NonFunctionApplication(loc) => - write!(f, "Primitive applied as function at {loc:?}"), + Self::NonFunctionApplication(loc) => { + write!(f, "Primitive applied as function at {loc:?}") + }, } } } diff --git a/src/pipeline/project_tree/collect_ops/exported_ops.rs b/src/pipeline/project_tree/collect_ops/exported_ops.rs index 88319fe..fbeac5f 100644 --- a/src/pipeline/project_tree/collect_ops/exported_ops.rs +++ b/src/pipeline/project_tree/collect_ops/exported_ops.rs @@ -65,8 +65,9 @@ pub fn collect_exported_ops( let preparsed = &loaded[&fpath].preparsed; let module = preparsed.0.walk(subpath_v, false).map_err(|walk_err| { match walk_err.kind { - WalkErrorKind::Private => - unreachable!("visibility is not being checked here"), + WalkErrorKind::Private => { + unreachable!("visibility is not being checked here") + }, WalkErrorKind::Missing => ModuleNotFound { file: i.extern_vec(fpath), subpath: subpath_v diff --git a/src/representations/ast_to_postmacro.rs b/src/representations/ast_to_postmacro.rs index 0b6f66b..152d484 100644 --- a/src/representations/ast_to_postmacro.rs +++ b/src/representations/ast_to_postmacro.rs @@ -23,8 +23,9 @@ pub enum Error { impl Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Error::EmptyS => - write!(f, "`()` as a clause is meaningless in lambda calculus"), + Error::EmptyS => { + write!(f, "`()` as a clause is meaningless in lambda calculus") + }, Error::BadGroup(_) => write!( f, "Only `(...)` may be converted to typed lambdas. `[...]` and \ diff --git a/src/rule/rule_error.rs b/src/rule/rule_error.rs index f0a0f36..d74c390 100644 --- a/src/rule/rule_error.rs +++ b/src/rule/rule_error.rs @@ -18,15 +18,17 @@ pub enum RuleError { impl InternedDisplay for RuleError { fn fmt_i(&self, f: &mut fmt::Formatter<'_>, i: &Interner) -> fmt::Result { match *self { - Self::Missing(key) => - write!(f, "Key {:?} not in match pattern", i.r(key)), + Self::Missing(key) => { + write!(f, "Key {:?} not in match pattern", i.r(key)) + }, Self::TypeMismatch(key) => write!( f, "Key {:?} used inconsistently with and without ellipsis", i.r(key) ), - Self::Multiple(key) => - write!(f, "Key {:?} appears multiple times in match pattern", i.r(key)), + Self::Multiple(key) => { + write!(f, "Key {:?} appears multiple times in match pattern", i.r(key)) + }, Self::VecNeighbors(left, right) => write!( f, "Keys {:?} and {:?} are two vectorials right next to each other", diff --git a/src/stl/mod.rs b/src/stl/mod.rs index 1bfbaf1..63e77fa 100644 --- a/src/stl/mod.rs +++ b/src/stl/mod.rs @@ -11,5 +11,6 @@ mod str; pub use cpsio::{handle as handleIO, IO}; pub use mk_stl::mk_stl; + pub use self::bool::Boolean; -pub use self::num::Numeric; \ No newline at end of file +pub use self::num::Numeric;