From 1e17c5108e39cf8bf2fdbd8958b6e4edfa9097a9 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:31:15 +0200 Subject: [PATCH 1/8] style(code): fix hidden elided lifetime new warning in latest rust --- src/code.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code.rs b/src/code.rs index 29367b5..44629b7 100644 --- a/src/code.rs +++ b/src/code.rs @@ -86,7 +86,7 @@ pub struct StructField { impl StructField { /// Assemble the current options into a rust type, like `base_type: String, is_optional: true` to `Option` - pub fn to_rust_type(&self) -> Cow { + pub fn to_rust_type(&self) -> Cow<'_, str> { let mut rust_type = self.base_type.clone(); // order matters! From c73e3a591ba8b34282db78f957c81f8929ab40bf Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:31:56 +0200 Subject: [PATCH 2/8] style(error): fix "unneeded return statement" warnings --- src/error.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/error.rs b/src/error.rs index 70d5641..6012686 100644 --- a/src/error.rs +++ b/src/error.rs @@ -61,10 +61,10 @@ impl Error { M: Into, P: AsRef, { - return Self::new(ErrorEnum::IoError( + Self::new(ErrorEnum::IoError( ioError::new(kind, msg.into()), format_path(path.as_ref().to_string_lossy().to_string()), - )); + )) } pub fn not_a_directory(msg: M, path: P) -> Self @@ -72,10 +72,10 @@ impl Error { M: Into, P: AsRef, { - return Self::new(ErrorEnum::NotADirectory( + Self::new(ErrorEnum::NotADirectory( msg.into(), path.as_ref().to_string_lossy().to_string(), - )); + )) } } @@ -87,7 +87,7 @@ impl std::fmt::Display for Error { impl std::error::Error for Error { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { - return self.source.source(); + self.source.source() } } @@ -148,13 +148,13 @@ pub trait IOErrorToError { impl IOErrorToError for std::result::Result { fn attach_path_err>(self, path: P) -> Result { - return match self { + match self { Ok(v) => Ok(v), Err(e) => Err(crate::Error::new(ErrorEnum::IoError( e, format_path(path.as_ref().to_string_lossy().to_string()), ))), - }; + } } fn attach_path_msg, M: AsRef>(self, path: P, msg: M) -> Result { From b82e9f9430776c5f2d9b7707105804916408541e Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:49:11 +0200 Subject: [PATCH 3/8] chore(workflows/CI): enable workflow run on any push --- .github/workflows/CI.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 044809a..a8a52d8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,8 +1,6 @@ name: CI on: push: - branches: - - main pull_request: workflow_dispatch: From 62ac545e2d020fd9367d8ac395a754e737f70f65 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:34:40 +0200 Subject: [PATCH 4/8] chore(workflows/CI): switch to use "Swatinem/rust-cache@v2" for rust caching --- .github/workflows/CI.yml | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a8a52d8..51e8c5b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,13 +19,9 @@ jobs: - uses: actions/checkout@v4 - uses: rui314/setup-mold@v1 - uses: dtolnay/rust-toolchain@stable - - uses: actions/cache@v3 + - uses: Swatinem/rust-cache@v2 with: - path: | - ./.cargo/.build - ./target - ~/.cargo - key: ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }} + shared-key: "build" - run: cargo build --all-targets clippy: @@ -37,13 +33,9 @@ jobs: - uses: rui314/setup-mold@v1 - uses: dtolnay/rust-toolchain@stable - run: rustup component add clippy - - uses: actions/cache@v3 + - uses: Swatinem/rust-cache@v2 with: - path: | - ./.cargo/.build - ./target - ~/.cargo - key: ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }} + shared-key: "build" - run: cargo clippy --all test-script: @@ -54,13 +46,9 @@ jobs: - uses: actions/checkout@v4 - uses: rui314/setup-mold@v1 - uses: dtolnay/rust-toolchain@stable - - uses: actions/cache@v3 + - uses: Swatinem/rust-cache@v2 with: - path: | - ./.cargo/.build - ./target - ~/.cargo - key: ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }} + shared-key: "build" - run: bash test/test_all.sh - run: git diff --exit-code --stat || exit 1 @@ -72,13 +60,7 @@ jobs: - uses: actions/checkout@v4 - uses: rui314/setup-mold@v1 - uses: dtolnay/rust-toolchain@stable - - uses: actions/cache@v3 - with: - path: | - ./.cargo/.build - ./target - ~/.cargo - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 - run: cargo test # Things that don't need a cache From 30f1ba01448c7de8aeae3cba3571ead8a4d37f05 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:36:41 +0200 Subject: [PATCH 5/8] chore(workflows/CI): run build step on stable and minimal rust version --- .github/workflows/CI.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 51e8c5b..4d4969a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,11 +14,17 @@ concurrency: jobs: build: name: cargo build - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest] + rust: [stable, "1.70"] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: rui314/setup-mold@v1 - uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.rust }} - uses: Swatinem/rust-cache@v2 with: shared-key: "build" From 261783a2d771814eea4318cfe18ddd6b3ec66f12 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:39:45 +0200 Subject: [PATCH 6/8] chore(workflows/CI): combine build & test jobs --- .github/workflows/CI.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4d4969a..d49bae5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ concurrency: jobs: build: - name: cargo build + name: cargo build & test strategy: matrix: os: [ubuntu-latest] @@ -29,6 +29,7 @@ jobs: with: shared-key: "build" - run: cargo build --all-targets + - run: cargo test clippy: name: cargo clippy @@ -58,17 +59,6 @@ jobs: - run: bash test/test_all.sh - run: git diff --exit-code --stat || exit 1 - # things that use the cargo-test cache - test: - name: cargo test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: rui314/setup-mold@v1 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - run: cargo test - # Things that don't need a cache fmt: name: cargo fmt @@ -84,7 +74,7 @@ jobs: release: runs-on: ubuntu-latest name: release - needs: [build, clippy, test, test-script, fmt] + needs: [build, clippy, test-script, fmt] if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' permissions: contents: write # for actions/checkout to fetch code and for semantic-release to push commits, release releases and tags From 5f8209993290e195c843aed33f4cdc711fe683a9 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:53:37 +0200 Subject: [PATCH 7/8] chore(workflows/CI): directly install rust components instead of manually calling rustup --- .github/workflows/CI.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d49bae5..df00aab 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -39,7 +39,8 @@ jobs: - uses: actions/checkout@v4 - uses: rui314/setup-mold@v1 - uses: dtolnay/rust-toolchain@stable - - run: rustup component add clippy + with: + components: clippy - uses: Swatinem/rust-cache@v2 with: shared-key: "build" @@ -68,7 +69,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: toolchain: nightly - - run: rustup component add rustfmt + components: rustfmt - run: cargo fmt --all -- --check release: From d56b15280ee46fd4f0a8c834013c7808e1ece770 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Sat, 6 Sep 2025 14:54:51 +0200 Subject: [PATCH 8/8] fix: set MSRV to 1.70 it was basically that version already according to lib.rs --- CHANGELOG.md | 4 ++++ Cargo.toml | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d61f2..0ba37f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## next + +- set MSRV to `1.70` + ## 0.1.0 - replace `structopt` with `clap` diff --git a/Cargo.toml b/Cargo.toml index f3a3fb3..304de16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ authors = [ "hasezoey ", ] edition = "2021" +rust-version = "1.70" [features] default = ["tsync", "backtrace", "derive-queryablebyname"]