Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/pr_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: cargo-code-check

on:
pull_request:
branches: ["main"]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all --check

check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace -- -D warnings

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "phasetida-core"
version = "0.1.15"
version = "0.1.16"
edition = "2024"

[lib]
Expand Down
20 changes: 10 additions & 10 deletions src/chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ impl TryFrom<i32> for NoteType {

fn try_from(value: i32) -> Result<Self, Self::Error> {
match value {
1 => Ok(NoteType::Tap),
2 => Ok(NoteType::Drag),
3 => Ok(NoteType::Hold),
4 => Ok(NoteType::Flick),
1 => Ok(Self::Tap),
2 => Ok(Self::Drag),
3 => Ok(Self::Hold),
4 => Ok(Self::Flick),
_ => Err(()),
}
}
Expand Down Expand Up @@ -246,12 +246,12 @@ impl<'de> Deserialize<'de> for ChartRaw {
let version = value
.get("formatVersion")
.and_then(serde_json::Value::as_i64)
.ok_or(serde::de::Error::missing_field("formatVersion"))?;
.ok_or_else(|| serde::de::Error::missing_field("formatVersion"))?;
match version {
1 => Ok(ChartRaw::V1(
1 => Ok(Self::V1(
serde_json::from_value::<ChartV1>(value).map_err(serde::de::Error::custom)?,
)),
3 => Ok(ChartRaw::V3(
3 => Ok(Self::V3(
serde_json::from_value::<Chart>(value).map_err(serde::de::Error::custom)?,
)),
_ => Err(serde::de::Error::custom(format!(
Expand All @@ -266,15 +266,15 @@ impl ChartRaw {
#[must_use]
pub fn convert_to_v3(self) -> Chart {
match self {
ChartRaw::V1(v1) => Chart {
Self::V1(v1) => Chart {
offset: v1.offset,
judge_line_list: v1
.judge_line_list
.into_iter()
.map(std::convert::Into::into)
.collect(),
},
ChartRaw::V3(v3) => v3,
Self::V3(v3) => v3,
}
}
}
Expand All @@ -299,7 +299,7 @@ impl From<JudgeLineV1> for JudgeLine {
}
})
.collect();
JudgeLine {
Self {
bpm: value.bpm,
notes_above: value.notes_above,
notes_below: value.notes_below,
Expand Down
Loading
Loading