Skip to content

Commit

Permalink
style: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia Rosenfield Boeira committed Jan 30, 2025
1 parent 544114c commit f59cf31
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 41 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: format
run: cargo fmt -- --check

clippy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Configure Cargo cache
uses: actions/cache@v3
with:
Expand All @@ -50,14 +50,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Test
run: cargo test --verbose

Expand All @@ -68,7 +68,7 @@ jobs:
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Generate code coverage
run: |
cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out Lcov --output-dir ./coverage
Expand Down
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ and this project adheres to [Conventional Commits](https://www.conventionalcommi
## [Unreleased]

## [0.4.1] - 2025-01-29
- Applied more modern rust code styling, rustfmt and cargo clippy.
- Replaced test bencher with criterion.
- Moved non release dependencies to `dev-dependencies`.
- `cargo update`

### Changed
- Apply more modern Rust code styling, including `rustfmt` and `cargo clippy`.
- Replace test bencher with `criterion`.
- Move non-release dependencies to `dev-dependencies`.

### Updated
- Run `cargo update` to update dependencies.

## [0.4.0] - 2023-11-01

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ harness = false

[[bench]]
name = "formatters"
harness = false
harness = false
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ reorder_imports = false
reorder_modules = false

use_field_init_shorthand = true
use_try_shorthand = true
use_try_shorthand = true
46 changes: 16 additions & 30 deletions src/maze/formatters/game_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,39 +427,25 @@ mod tests {
#[test]
fn possible_start_and_goal_positions() {
let formatter = GameMap::new().with_start_goal();
#[rustfmt::skip]
let map = vec![
'#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '.', '.', '.', '#', '.', '.', '.',
'#', '#', '#', '#', '.', '#', '.', '#', '.', '#', '#', '.', '.', '.', '#', '.', '#',
'.', '#', '#', '.', '#', '#', '#', '.', '#', '.', '#', '#', '.', '.', '.', '.', '.',
'#', '.', '#', '#', '#', '#', '#', '#', '#', '#', '.', '#', '#', '.', '.', '.', '.',
'.', '.', '.', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#',
'#', '#', '#', '#', '#', '#', '#', '#', '#',
'#', '.', '.', '.', '#', '.', '.', '.', '#',
'#', '#', '#', '.', '#', '.', '#', '.', '#',
'#', '.', '.', '.', '#', '.', '#', '.', '#',
'#', '.', '#', '#', '#', '.', '#', '.', '#',
'#', '.', '.', '.', '.', '.', '#', '.', '#',
'#', '#', '#', '#', '#', '#', '#', '.', '#',
'#', '.', '.', '.', '.', '.', '.', '.', '#',
'#', '#', '#', '#', '#', '#', '#', '#', '#',
];
#[rustfmt::skip]
let positions = vec![
(0, 1),
(0, 2),
(0, 3),
(0, 5),
(0, 6),
(0, 7),
(1, 0),
(1, 8),
(2, 8),
(3, 0),
(3, 8),
(4, 0),
(4, 8),
(5, 0),
(5, 8),
(6, 8),
(7, 0),
(7, 8),
(8, 1),
(8, 2),
(8, 3),
(8, 4),
(8, 5),
(8, 6),
(8, 7),
(0, 1), (0, 2), (0, 3), (0, 5), (0, 6),
(0, 7), (1, 0), (1, 8), (2, 8), (3, 0),
(3, 8), (4, 0), (4, 8), (5, 0), (5, 8),
(6, 8), (7, 0), (7, 8), (8, 1), (8, 2),
(8, 3), (8, 4), (8, 5), (8, 6), (8, 7),
];
let result = formatter.iter_possible_start_and_goal_positions(&map, 9, 9);
assert_eq!(positions, result.collect::<Vec<_>>());
Expand Down

0 comments on commit f59cf31

Please sign in to comment.