Skip to content

Commit 784d292

Browse files
committed
Fix CI
1 parent e8c6de3 commit 784d292

File tree

4 files changed

+25
-44
lines changed

4 files changed

+25
-44
lines changed

.github/workflows/rust.yml

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,36 @@ name: Rust
33
on:
44
push:
55
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
611

712
jobs:
8-
check:
9-
name: Check
13+
ci:
14+
name: CI
1015
runs-on: ubuntu-latest
11-
steps:
12-
- name: Git checkout
13-
uses: actions/checkout@v3
14-
15-
- name: Install stable toolchain
16-
uses: actions-rs/toolchain@v1
17-
with:
18-
profile: minimal
19-
toolchain: stable
20-
override: true
21-
22-
- name: Run cargo check
23-
uses: actions-rs/cargo@v1
24-
with:
25-
command: check
2616

27-
- name: Run cargo test
28-
uses: actions-rs/cargo@v1
29-
with:
30-
command: test
31-
32-
lints:
33-
name: Lints
34-
runs-on: ubuntu-latest
3517
steps:
36-
- name: Git checkout
37-
uses: actions/checkout@v3
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
3820

39-
- name: Install stable toolchain
40-
uses: actions-rs/toolchain@v1
21+
- name: Install Rust toolchain
22+
uses: dtolnay/rust-toolchain@stable
4123
with:
42-
profile: minimal
43-
toolchain: stable
44-
override: true
4524
components: rustfmt, clippy
4625

47-
- name: Run cargo fmt
48-
uses: actions-rs/cargo@v1
26+
- name: Rust Cache
27+
uses: Swatinem/rust-cache@v2
4928
with:
50-
command: fmt
51-
args: --all -- --check
29+
cache-on-failure: true
5230

53-
- name: Run cargo clippy
54-
uses: actions-rs/cargo@v1
55-
with:
56-
command: clippy
57-
args: -- -D warnings
31+
- name: Check Formatting
32+
run: cargo fmt --all --check
33+
34+
- name: Lints (Clippy)
35+
run: cargo clippy --all-targets -- -D warnings
36+
37+
- name: Run Tests
38+
run: cargo test

src/day11.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn blink(stone: usize, counter: usize, limit: usize) -> usize {
1717
stack += blink(1, counter + 1, limit);
1818
} else {
1919
let count = stone.ilog10() + 1;
20-
if count % 2 == 0 {
20+
if count.is_multiple_of(2) {
2121
stack += blink(stone / 10_usize.pow(count / 2), counter + 1, limit);
2222
stack += blink(stone % 10_usize.pow(count / 2), counter + 1, limit);
2323
} else {

src/day22.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn part1(input: &[usize]) -> usize {
3636

3737
#[aoc(day22, part2)]
3838
pub fn part2(input: &[usize]) -> usize {
39-
let mut onces:Vec<Vec<usize>> = vec![];
39+
let mut onces: Vec<Vec<usize>> = vec![];
4040

4141
for secret in input {
4242
let mut secret = *secret;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod day1;
44
mod day10;
55
mod day11;
66
mod day2;
7-
mod day22;
7+
// mod day22;
88
mod day3;
99
mod day4;
1010
mod day5;

0 commit comments

Comments
 (0)