Skip to content

Commit 4679b7f

Browse files
committed
chore: tidy
1 parent 77dc668 commit 4679b7f

File tree

31 files changed

+56
-63
lines changed

31 files changed

+56
-63
lines changed

aoclp/src/forth/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ pub type Result<T> = std::result::Result<T, Error>;
8383
///
8484
/// let mut forth = Forth::new();
8585
/// assert!(forth.eval("1 2 + 3 * DUP 4 SWAP").is_ok());
86-
/// assert!(forth
87-
/// .eval(": deflabox OVER DUP ; deflabox 23 deflabox")
88-
/// .is_ok());
86+
/// assert!(
87+
/// forth
88+
/// .eval(": deflabox OVER DUP ; deflabox 23 deflabox")
89+
/// .is_ok()
90+
/// );
8991
/// assert_eq!(&[9, 4, 9, 4, 4, 23, 4, 4], forth.stack());
9092
/// ```
9193
///
@@ -254,9 +256,11 @@ impl Forth {
254256
/// use aoclp::forth::Forth;
255257
///
256258
/// let mut forth = Forth::new();
257-
/// assert!(forth
258-
/// .eval(": foo 1 ; : bar foo ; : foo 2 ; foo bar")
259-
/// .is_ok());
259+
/// assert!(
260+
/// forth
261+
/// .eval(": foo 1 ; : bar foo ; : foo 2 ; foo bar")
262+
/// .is_ok()
263+
/// );
260264
/// assert_eq!(&[2, 1], forth.stack());
261265
/// ```
262266
///

aoclp/src/forth/word.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ where
102102
///
103103
/// use aoclp::forth;
104104
/// use aoclp::forth::stack::Stack;
105-
/// use aoclp::forth::word::{wrap_fn_word, Words};
105+
/// use aoclp::forth::word::{Words, wrap_fn_word};
106106
///
107107
/// fn add_10(stack: &mut Stack, _dictionary: &Words) -> forth::Result<()> {
108108
/// let value = stack.pop()?;

aoclp/src/forth/word/builtins.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pub mod arith;
44
pub mod stack;
55

6-
use crate::forth::word::{wrap_fn_word, Words};
6+
use crate::forth::word::{Words, wrap_fn_word};
77

88
/// Adds all built-in [`Word`](crate::word::Word) to the given [word map](Words).
99
pub fn add_builtin_words(words: &mut Words) {

aoclp/src/forth/word/builtins/arith.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! Definition of built-in arithmetic Forth words, like `+`.
22
33
use crate::forth;
4+
use crate::forth::Value;
45
use crate::forth::stack::Stack;
56
use crate::forth::word::Words;
6-
use crate::forth::Value;
77

88
// A little helper macro to save on code duplication for simple arithmetic operators.
99
macro_rules! arith_op {

aoclp/src/forth/word/custom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ impl Word for CustomWord {
3232
///
3333
/// use aoclp::forth;
3434
/// use aoclp::forth::stack::Stack;
35+
/// use aoclp::forth::word::Words;
3536
/// use aoclp::forth::word::builtins::add_builtin_words;
3637
/// use aoclp::forth::word::custom::CustomWord;
3738
/// use aoclp::forth::word::value::ValueWord;
38-
/// use aoclp::forth::word::Words;
3939
///
4040
/// let mut words = Words::new();
4141
/// add_builtin_words(&mut words);

aoclp/src/forth/word/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use std::rc::Rc;
44

55
use crate::forth;
6+
use crate::forth::Value;
67
use crate::forth::stack::Stack;
78
use crate::forth::word::{Word, WordRc, Words};
8-
use crate::forth::Value;
99

1010
/// A Forth [`Word`] that pushes a [`Value`] on the [`Stack`] when [`call`]ed.
1111
///

aoclp/src/looping.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ where
112112
let prefix_len = self.prefix.len();
113113
self.prefix.nth(n).or_else(|| {
114114
self.cycle_pos = min(self.cycle_pos + (n - prefix_len), self.cycle_size);
115-
if self.cycle_len() != 0 {
116-
self.next()
117-
} else {
118-
None
119-
}
115+
if self.cycle_len() != 0 { self.next() } else { None }
120116
})
121117
}
122118
}

aoclp/src/positioning/direction/eight_points.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::ops::{Add, AddAssign, Neg, Sub, SubAssign};
22

33
use strum::{Display, EnumCount, EnumIter, EnumProperty, FromRepr};
44

5-
use crate::num::{one, zero, One, Zero};
5+
use crate::num::{One, Zero, one, zero};
66
use crate::positioning::direction::{Direction, MovementDirection};
77
use crate::positioning::pt::Pt;
88

aoclp/src/positioning/direction/four_points.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::ops::{Add, AddAssign, Neg, Sub, SubAssign};
22

33
use strum::{Display, EnumCount, EnumIter, EnumProperty, FromRepr};
44

5-
use crate::num::{one, zero, One, Zero};
5+
use crate::num::{One, Zero, one, zero};
66
use crate::positioning::direction::{Direction, MovementDirection};
77
use crate::positioning::pt::Pt;
88

aoclp/src/positioning/pt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ use std::sync::OnceLock;
1010
use strum::IntoEnumIterator;
1111

1212
use crate::captures::CapturesHelper;
13-
use crate::num::{zero, Signed, Zero};
13+
use crate::num::{Signed, Zero, zero};
14+
use crate::positioning::direction::MovementDirection;
1415
use crate::positioning::direction::eight_points::Direction8;
1516
use crate::positioning::direction::four_points::Direction4;
16-
use crate::positioning::direction::MovementDirection;
1717
use crate::regex::Regex;
1818

1919
/// A point in 2D space.

0 commit comments

Comments
 (0)