chore: cargo fmt across workspace; add analytics domain to CSP
Build and Deploy / build-and-push (push) Successful in 4m46s
Build and Deploy / build-and-push (push) Successful in 4m46s
- Apply cargo fmt to solitaire_engine, solitaire_server formatting. - solitaire_server/src/lib.rs: add https://analytics.aleshym.co to script-src, img-src, and connect-src so the analytics beacon loads without a CSP violation. - docs and README updates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -202,7 +202,10 @@ fn cycled_piles() -> Vec<KlondikePile> {
|
||||
///
|
||||
/// If `current` is `None` the first available pile is returned.
|
||||
/// If `available` is empty, `None` is returned.
|
||||
pub fn cycle_next_pile(available: &[KlondikePile], current: Option<&KlondikePile>) -> Option<KlondikePile> {
|
||||
pub fn cycle_next_pile(
|
||||
available: &[KlondikePile],
|
||||
current: Option<&KlondikePile>,
|
||||
) -> Option<KlondikePile> {
|
||||
if available.is_empty() {
|
||||
return None;
|
||||
}
|
||||
@@ -235,7 +238,11 @@ pub fn cycle_next_pile(available: &[KlondikePile], current: Option<&KlondikePile
|
||||
///
|
||||
/// Both `current` and `next` must be `Some`; if either is `None` this returns
|
||||
/// `false`.
|
||||
fn did_wrap(available: &[KlondikePile], current: Option<&KlondikePile>, next: Option<&KlondikePile>) -> bool {
|
||||
fn did_wrap(
|
||||
available: &[KlondikePile],
|
||||
current: Option<&KlondikePile>,
|
||||
next: Option<&KlondikePile>,
|
||||
) -> bool {
|
||||
let (Some(cur), Some(nxt)) = (current, next) else {
|
||||
return false;
|
||||
};
|
||||
@@ -386,9 +393,7 @@ fn handle_selection_keys(
|
||||
KlondikePile::Tableau(Tableau::Tableau7),
|
||||
];
|
||||
all.into_iter()
|
||||
.filter(|p| {
|
||||
pile_cards(&game.0, p).last().is_some_and(|c| c.face_up)
|
||||
})
|
||||
.filter(|p| pile_cards(&game.0, p).last().is_some_and(|c| c.face_up))
|
||||
.collect()
|
||||
};
|
||||
|
||||
@@ -717,10 +722,7 @@ fn update_selection_highlight(
|
||||
|
||||
/// Returns the top face-up card on `pile`, or `None` if the pile is
|
||||
/// empty or its top card is face-down.
|
||||
fn top_face_up_card(
|
||||
pile: &KlondikePile,
|
||||
game: &GameState,
|
||||
) -> Option<Card> {
|
||||
fn top_face_up_card(pile: &KlondikePile, game: &GameState) -> Option<Card> {
|
||||
pile_cards(game, pile).last().filter(|c| c.face_up).cloned()
|
||||
}
|
||||
|
||||
@@ -1162,14 +1164,17 @@ mod tests {
|
||||
// DragState must mirror the lifted cards and carry the keyboard sentinel.
|
||||
let drag = app.world().resource::<DragState>();
|
||||
assert_eq!(drag.cards, vec![100]);
|
||||
assert_eq!(drag.origin_pile, Some(KlondikePile::Tableau(Tableau::Tableau1)));
|
||||
assert_eq!(
|
||||
drag.origin_pile,
|
||||
Some(KlondikePile::Tableau(Tableau::Tableau1))
|
||||
);
|
||||
assert_eq!(drag.active_touch_id, Some(KEYBOARD_DRAG_TOUCH_ID));
|
||||
}
|
||||
|
||||
/// Test 3 — Arrow keys in `Lifted` cycle through *legal* destinations
|
||||
/// only (foundations and tableaus that pass `can_place_on_*`), and
|
||||
/// wrap at the end of the list.
|
||||
/// Test 4 — Enter while `Lifted` with a destination focused fires
|
||||
/// Test 4 — Enter while `Lifted` with a destination focused fires
|
||||
/// exactly one `MoveRequestEvent` and resets the state machine to
|
||||
/// `Idle` with `DragState` cleared.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user