Skip to content

Commit

Permalink
ci: add action (#14)
Browse files Browse the repository at this point in the history
* ci: add action

* fix: direct impl of ToString
  • Loading branch information
George-Miao authored May 1, 2024
1 parent 70c12fe commit ef2699d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check

on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

env:
RUST_BACKTRACE: 1

jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
run: |
rustup toolchain install nightly
rustup +nightly component add clippy
- name: Check clippy
run: |
cargo +nightly clippy --all-features --all-targets -- -Dwarnings
- name: Check Docs
run: |
cargo +nightly doc --workspace --all-features --no-deps
8 changes: 4 additions & 4 deletions src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ pub enum IntOrStr {
Str(String),
}

impl ToString for IntOrStr {
fn to_string(&self) -> String {
impl Display for IntOrStr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
IntOrStr::Int(i) => i.to_string(),
IntOrStr::Str(s) => s.clone(),
IntOrStr::Int(i) => write!(f, "{i}"),
IntOrStr::Str(s) => write!(f, "{s}"),
}
}
}
Expand Down

0 comments on commit ef2699d

Please sign in to comment.