about summary refs log tree commit diff
path: root/users/tazjin/finito/finito-door
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-02-07T16·29+0300
committerclbot <clbot@tvl.fyi>2022-02-07T16·58+0000
commit0d0b43ed8819e66a0888eb6d1d1f47b171ae62e0 (patch)
tree305c04d3fe26c92ed7037f0b0f41f38444ce83ea /users/tazjin/finito/finito-door
parent8b8c98380e85b2057a3c35ce3d76879fab4266b0 (diff)
fix(users/tazjin): rustfmt code with non-default settings r/3776
rustfmt only sometimes detects path-based nested config
files (probably some kind of race?), so my users folder uses a
separate formatting check for rustfmt to avoid flaky CI. Enough flakes
around already ...

Change-Id: Ifd862f9974f071b3a256643dd8e56c019116156a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5242
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/finito/finito-door')
-rw-r--r--users/tazjin/finito/finito-door/src/lib.rs34
1 files changed, 20 insertions, 14 deletions
diff --git a/users/tazjin/finito/finito-door/src/lib.rs b/users/tazjin/finito/finito-door/src/lib.rs
index 68542c0bc448..441ab0e3d2cf 100644
--- a/users/tazjin/finito/finito-door/src/lib.rs
+++ b/users/tazjin/finito/finito-door/src/lib.rs
@@ -27,15 +27,15 @@
 //! The door can only be locked if it is closed. Oh, and it has a few
 //! extra features:
 //!
-//! * whenever the door's state changes, an IRC channel receives a
-//!   message about that
+//! * whenever the door's state changes, an IRC channel receives a message about
+//!   that
 //!
-//! * the door calls the police if the code is intered incorrectly more
-//!   than a specified number of times (mhm, lets say, three)
+//! * the door calls the police if the code is intered incorrectly more than a
+//!   specified number of times (mhm, lets say, three)
 //!
-//! * if the police is called the door can not be interacted with
-//!   anymore (and honestly, for the sake of this example, we don't
-//!   care how its functionality is restored)
+//! * if the police is called the door can not be interacted with anymore (and
+//!   honestly, for the sake of this example, we don't care how its
+//!   functionality is restored)
 //!
 //! ## The Door - Visualized
 //!
@@ -71,7 +71,8 @@
 //!
 //! Alright, enough foreplay, lets dive in!
 
-#[macro_use] extern crate serde_derive;
+#[macro_use]
+extern crate serde_derive;
 
 extern crate failure;
 extern crate finito;
@@ -292,11 +293,13 @@ mod tests {
     use finito::advance;
 
     fn test_fsm<S: FSM>(initial: S, events: Vec<S::Event>) -> (S, Vec<S::Action>) {
-        events.into_iter().fold((initial, vec![]), |(state, mut actions), event| {
-            let (new_state, mut new_actions) = advance(state, event);
-            actions.append(&mut new_actions);
-            (new_state, actions)
-        })
+        events
+            .into_iter()
+            .fold((initial, vec![]), |(state, mut actions), event| {
+                let (new_state, mut new_actions) = advance(state, event);
+                actions.append(&mut new_actions);
+                (new_state, actions)
+            })
     }
 
     #[test]
@@ -313,7 +316,10 @@ mod tests {
         ];
         let (final_state, actions) = test_fsm(initial, events);
 
-        assert_eq!(final_state, DoorState::Locked { code: 4567, attempts: 2 });
+        assert_eq!(final_state, DoorState::Locked {
+            code: 4567,
+            attempts: 2
+        });
         assert_eq!(actions, vec![
             DoorAction::NotifyIRC("door was closed".into()),
             DoorAction::NotifyIRC("door was opened".into()),