Skip to content

Commit 37c7549

Browse files
committed
fix: apply cargo fmt to resolve CI formatting check
Removes extra empty lines from issue_19_demo.rs to match rustfmt formatting requirements for CI pipeline.
1 parent aa6dd06 commit 37c7549

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

examples/issue_19_demo.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,106 +18,106 @@ use std::time::Duration;
1818
fn main() -> Result<(), Box<dyn std::error::Error>> {
1919
println!("🔄 Issue #19 Demo: App State Machine Extension for Settings");
2020
println!("===========================================================");
21-
21+
2222
// Create a new App instance with dark theme
2323
let theme = Theme::new(ThemeVariant::EverforestDark);
2424
let mut app = App::new(theme);
25-
25+
2626
println!("\n✅ App State Machine Extension Features:");
27-
27+
2828
// 1. Demonstrate initial state
2929
println!("1. Initial State: {:?}", app.state());
3030
assert_eq!(*app.state(), AppState::Main);
31-
31+
3232
// 2. Demonstrate state transitions
3333
println!("2. Testing state transitions...");
34-
34+
3535
// Enter settings
3636
app.enter_settings();
3737
println!(" After enter_settings(): {:?}", app.state());
3838
assert_eq!(*app.state(), AppState::Settings);
39-
39+
4040
// Exit settings (should return to Main)
4141
app.exit_settings();
4242
println!(" After exit_settings(): {:?}", app.state());
4343
assert_eq!(*app.state(), AppState::Main);
44-
44+
4545
// 3. Demonstrate event handling
4646
println!("3. Testing event handling...");
47-
47+
4848
// Simulate OpenSettings event
4949
let open_event = AppEvent::OpenSettings;
5050
println!(" Handling OpenSettings event...");
5151
// Note: handle_event is private, but we can test the public methods
5252
app.enter_settings();
5353
println!(" State after OpenSettings: {:?}", app.state());
54-
54+
5555
// Simulate CloseSettings event
5656
let close_event = AppEvent::CloseSettings;
5757
println!(" Handling CloseSettings event...");
5858
app.exit_settings();
5959
println!(" State after CloseSettings: {:?}", app.state());
60-
60+
6161
// 4. Demonstrate settings action handling
6262
println!("4. Testing settings actions...");
63-
63+
6464
let initial_theme = app.settings().theme_variant();
6565
println!(" Initial theme variant: {:?}", initial_theme);
66-
66+
6767
// Apply a settings action to change theme
6868
let action = SettingsAction::ChangeTheme(ThemeVariant::EverforestLight);
6969
app.handle_settings_action(action)?;
70-
70+
7171
let new_theme = app.settings().theme_variant();
7272
println!(" Theme variant after action: {:?}", new_theme);
7373
assert_eq!(new_theme, ThemeVariant::EverforestLight);
74-
74+
7575
// 5. Demonstrate state machine edge cases
7676
println!("5. Testing state machine edge cases...");
77-
77+
7878
// Try multiple enter_settings calls
7979
app.enter_settings();
8080
app.enter_settings(); // Should still be in Settings
8181
println!(" After multiple enter_settings(): {:?}", app.state());
8282
assert_eq!(*app.state(), AppState::Settings);
83-
83+
8484
// Exit should return to correct previous state
8585
app.exit_settings();
8686
println!(" After exit from multiple enters: {:?}", app.state());
8787
assert_eq!(*app.state(), AppState::Main);
88-
88+
8989
// 6. Demonstrate event enum extensions
9090
println!("6. Testing extended AppEvent enum...");
91-
91+
9292
let events = vec![
9393
AppEvent::OpenSettings,
9494
AppEvent::CloseSettings,
9595
AppEvent::SettingsAction(SettingsAction::ChangeTheme(ThemeVariant::EverforestDark)),
9696
AppEvent::ToggleTheme,
9797
AppEvent::Quit,
9898
];
99-
99+
100100
for event in &events {
101101
println!(" Event type: {:?}", event);
102102
}
103-
103+
104104
println!("\n🎯 Success Criteria Verification:");
105105
println!("✅ AppState enum includes Settings variant");
106106
println!("✅ Clean state transition methods implemented");
107107
println!("✅ Previous state tracking for ESC handling");
108108
println!("✅ Event system supports settings workflow");
109109
println!("✅ Theme changes apply immediately");
110110
println!("✅ No state machine edge cases or deadlocks");
111-
111+
112112
println!("\n🎨 State Machine Workflow:");
113113
println!("• Main → Settings: ',' key (AppEvent::OpenSettings)");
114114
println!("• Settings → Main: ESC key (AppEvent::CloseSettings)");
115115
println!("• Theme changes: Apply immediately via SettingsAction");
116116
println!("• State persistence: Previous state remembered for ESC");
117-
117+
118118
println!("\n🚀 Issue #19 State Machine Extension: COMPLETE!");
119119
println!(" The app now supports a clean settings modal workflow");
120120
println!(" with proper state transitions and event handling.");
121-
121+
122122
Ok(())
123123
}

0 commit comments

Comments
 (0)