From 9a0654d71a9beca1be301307693b8ebdfd8a9edb Mon Sep 17 00:00:00 2001 From: antangelo Date: Sun, 23 Jul 2023 16:11:53 -0400 Subject: [PATCH] core: Fix no_std build and run CI on nightly cron (#39) --- .github/workflows/ci.yml | 35 +---------------------------- .github/workflows/nostd.yml | 45 +++++++++++++++++++++++++++++++++++++ xdvdfs-core/Cargo.toml | 1 + xdvdfs-core/src/layout.rs | 2 +- xdvdfs-core/src/read.rs | 2 ++ 5 files changed, 50 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/nostd.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a469b32..6225dee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: tags: - v* pull_request: -name: CI +name: Build jobs: check: @@ -41,39 +41,6 @@ jobs: command: clippy args: --all -- -D warnings - build_lib_no_std: - name: Build (xdvdfs-no_std) - runs-on: ubuntu-latest - steps: - - name: Checkout source - uses: actions/checkout@v3 - - - name: Install Rust nightly - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - override: true - components: clippy - - - name: Check lints - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -p xdvdfs --no-default-features --features=read -- -D warnings - - - name: Build - uses: actions-rs/cargo@v1 - with: - command: build - args: -p xdvdfs --no-default-features --features=read - - - name: Test - uses: actions-rs/cargo@v1 - with: - command: test - args: -p xdvdfs --no-default-features --features=read - build_lib: name: Build (xdvdfs) runs-on: ubuntu-latest diff --git a/.github/workflows/nostd.yml b/.github/workflows/nostd.yml new file mode 100644 index 0000000..c9d098c --- /dev/null +++ b/.github/workflows/nostd.yml @@ -0,0 +1,45 @@ +on: + push: + branches: + - main + tags: + - v* + pull_request: + schedule: + - cron: '0 0 * * *' +name: Build (no_std) + +jobs: + build_lib_no_std: + name: Build (xdvdfs-no_std) + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Install Rust nightly + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: clippy + + - name: Check lints + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -p xdvdfs --no-default-features --features=read -- -D warnings + + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: -p xdvdfs --no-default-features --features=read + + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + args: -p xdvdfs --no-default-features --features=read + diff --git a/xdvdfs-core/Cargo.toml b/xdvdfs-core/Cargo.toml index 044af29..27d8e7c 100644 --- a/xdvdfs-core/Cargo.toml +++ b/xdvdfs-core/Cargo.toml @@ -22,6 +22,7 @@ arrayvec = { version = "0.7.2", default-features = false } async-trait = { version = "0.1.68" } encoding_rs = "0.8.32" log = { version = "0.4.17", optional = true } +rustversion = "1.0.14" [features] default = ["std", "read", "write", "logging"] diff --git a/xdvdfs-core/src/layout.rs b/xdvdfs-core/src/layout.rs index ed6aab3..d08c98c 100644 --- a/xdvdfs-core/src/layout.rs +++ b/xdvdfs-core/src/layout.rs @@ -336,7 +336,7 @@ impl DirectoryEntryData { impl PartialOrd for DirectoryEntryData { fn partial_cmp(&self, other: &Self) -> Option { - Some(Ord::cmp(self, other)) + Some(self.cmp(other)) } } diff --git a/xdvdfs-core/src/read.rs b/xdvdfs-core/src/read.rs index 88ac186..f88eccc 100644 --- a/xdvdfs-core/src/read.rs +++ b/xdvdfs-core/src/read.rs @@ -6,6 +6,8 @@ use super::util; /// Read the XDVDFS volume descriptor from sector 32 of the drive /// Returns None if the volume descriptor is invalid +// Clippy bug (https://github.com/rust-lang/rust-clippy/issues/11216) returns a false positive +#[rustversion::attr(nightly, allow(clippy::needless_pass_by_ref_mut))] pub async fn read_volume( dev: &mut impl BlockDeviceRead, ) -> Result> {