From 25d4c2b599900dbb6e607a9914a31898cf2a116b Mon Sep 17 00:00:00 2001 From: nullstalgia Date: Sat, 12 Jul 2025 16:29:58 -0700 Subject: [PATCH 1/5] Fix and modernize GitHub CI Workflow --- .github/workflows/ci.yml | 118 +++++++++++++-------------------------- 1 file changed, 39 insertions(+), 79 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92a1521..269c17a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,43 +1,30 @@ +name: Continuous Integration + +# Runs for each commit/PR, but not tag push on: push: branches: - - master - pull_request: {} + - "**" + pull_request: + +env: + CARGO_TERM_COLOR: always -name: Continuous integration +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true jobs: check: name: Check runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - uses: actions-rs/cargo@v1 - with: - command: check - - test-versions: - name: Test Suite - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1.9.0 + - name: Run Check + run: cargo check - test-features: + test-suite: name: Test Suite runs-on: ubuntu-latest strategy: @@ -47,72 +34,45 @@ jobs: - beta - nightly - 1.39.0 + - 1.88.0 steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1.9.0 with: toolchain: ${{ matrix.rust }} override: true - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features - - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-default-features + - name: Run Tests with All Features + run: cargo test --all-features + - name: Run Tests with No Default Features + run: cargo test --no-default-features - test-os: - name: Test Suite + test-suite-os: + name: Test Suite (stable) runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - uses: actions-rs/cargo@v1 - with: - command: test + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1.9.0 + - name: Run Test + run: cargo test fmt: - name: Rustfmt + name: Rustfmt (stable) runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1.9.0 - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - name: Run Rustfmt + run: cargo fmt --all -- --check clippy: - name: Clippy + name: Clippy (stable) runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1.9.0 + - name: Run Clippy + run: cargo clippy -- -D warnings From ca0605010503158cd728304572f1176ab1f966d7 Mon Sep 17 00:00:00 2001 From: nullstalgia Date: Sat, 12 Jul 2025 16:34:26 -0700 Subject: [PATCH 2/5] Appease Clippy. --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f9b73ba..d71dd4e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -98,7 +98,6 @@ rust_2018_idioms, unreachable_pub, bad_style, - const_err, dead_code, improper_ctypes, non_shorthand_field_patterns, @@ -106,8 +105,9 @@ overflowing_literals, path_statements, patterns_in_fns_without_body, - private_in_public, + private_interfaces, unconditional_recursion, + unnameable_types, unused, unused_allocation, unused_comparisons, @@ -167,10 +167,10 @@ pub type Inserter = dyn FnMut(usize, &mut dyn fmt::Write) -> fmt::Result; impl Format<'_> { fn insert_indentation(&mut self, line: usize, f: &mut dyn fmt::Write) -> fmt::Result { match self { - Format::Uniform { indentation } => write!(f, "{}", indentation), + Format::Uniform { indentation } => write!(f, "{indentation}"), Format::Numbered { ind } => { if line == 0 { - write!(f, "{: >4}: ", ind) + write!(f, "{ind: >4}: ") } else { write!(f, " ") } @@ -219,7 +219,7 @@ where self.needs_indent = false; } - self.inner.write_fmt(format_args!("{}", line))?; + self.inner.write_fmt(format_args!("{line}"))?; } Ok(()) From 214aac99ed8cb06600c1d6bdf3497f18bc5ab4f2 Mon Sep 17 00:00:00 2001 From: nullstalgia Date: Sat, 12 Jul 2025 16:44:32 -0700 Subject: [PATCH 3/5] Set MSRV (1.39), remove conflicting lints, revert use of names args. --- Cargo.toml | 1 + src/lib.rs | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 71c485c..b0471e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "indenter" version = "0.3.3" +rust-version = "1.39" authors = ["Jane Lusby "] edition = "2018" license = "MIT OR Apache-2.0" diff --git a/src/lib.rs b/src/lib.rs index d71dd4e..5b96f8f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -105,9 +105,7 @@ overflowing_literals, path_statements, patterns_in_fns_without_body, - private_interfaces, unconditional_recursion, - unnameable_types, unused, unused_allocation, unused_comparisons, @@ -167,10 +165,10 @@ pub type Inserter = dyn FnMut(usize, &mut dyn fmt::Write) -> fmt::Result; impl Format<'_> { fn insert_indentation(&mut self, line: usize, f: &mut dyn fmt::Write) -> fmt::Result { match self { - Format::Uniform { indentation } => write!(f, "{indentation}"), + Format::Uniform { indentation } => write!(f, "{}", indentation), Format::Numbered { ind } => { if line == 0 { - write!(f, "{ind: >4}: ") + write!(f, "{: >4}: ", ind) } else { write!(f, " ") } @@ -219,7 +217,7 @@ where self.needs_indent = false; } - self.inner.write_fmt(format_args!("{line}"))?; + self.inner.write_fmt(format_args!("{}", line))?; } Ok(()) From b25e90e489a07a02b4c6487c27b17c50bbe09ce7 Mon Sep 17 00:00:00 2001 From: nullstalgia Date: Sat, 12 Jul 2025 21:19:17 -0700 Subject: [PATCH 4/5] Denote in the "cargo check" job name that it uses the stable toolchain --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 269c17a..1038478 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ concurrency: jobs: check: - name: Check + name: Check (stable) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 0f732fccaa6185cedebf512cfa53e29bc1500e89 Mon Sep 17 00:00:00 2001 From: nullstalgia Date: Sat, 12 Jul 2025 21:40:51 -0700 Subject: [PATCH 5/5] Remove unused flag. --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1038478..fca0ec4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,6 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1.9.0 with: toolchain: ${{ matrix.rust }} - override: true - name: Run Tests with All Features run: cargo test --all-features - name: Run Tests with No Default Features