diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index af1a1c9..14af2fd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,33 +1,53 @@ -name: Rust CI for WSLPlugins-rs - on: push: branches: ["main"] pull_request: branches: ["main"] -env: - CARGO_TERM_COLOR: always - jobs: build-and-validate: runs-on: windows-latest - strategy: matrix: - toolchain: ["stable", "nightly"] + include: + - toolchain: stable + RUSTDOCFLAGS: "-D warnings" + DOCTYPE: "docrs" + - toolchain: nightly + RUSTDOCFLAGS: "-D warnings --cfg docsrs" + DOCTYPE: "doc" + + name: "Build and validate (${{ matrix.toolchain}})" + env: + CARGO_TERM_COLOR: always + RUSTFLAGS: -D warnings + RUSTDOCFLAGS: ${{ matrix.RUSTDOCFLAGS }} steps: - name: Checkout Code uses: actions/checkout@v4 + - name: Cache Cargo Registry + uses: actions/cache@v3 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-registry- + + - name: Cache Cargo Git Index + uses: actions/cache@v3 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo-index- + - name: Install Rust (Matrix) shell: pwsh run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} - name: Lint with Clippy (Stable Only) if: matrix.toolchain == 'stable' - run: cargo clippy --all-targets --all-features -- -D warnings + run: cargo clippy --all-targets --all-features - name: Check Code Formatting (Stable Only) if: matrix.toolchain == 'stable' @@ -39,16 +59,8 @@ jobs: - name: Run Tests run: cargo test --verbose - - name: Generate Documentation (Stable Only) - if: matrix.toolchain == 'stable' - run: cargo doc --no-deps - - - name: Generate Documentation for Docs.rs (Nightly Only) - if: matrix.toolchain == 'nightly' - shell: pwsh - run: | - $env:RUSTDOCFLAGS = "--cfg docsrs" - cargo +nightly doc --no-deps + - name: Generate Documentation (${{ matrix.RUSTDOCFLAGS }}, ${{ matrix.toolchain }}) + run: cargo doc --no-deps --all-features - name: Install and Run Security Audit (Nightly Only) if: matrix.toolchain == 'nightly' diff --git a/wslplugins-rs/src/plugin/utils.rs b/wslplugins-rs/src/plugin/utils.rs index 882d714..3e9257a 100644 --- a/wslplugins-rs/src/plugin/utils.rs +++ b/wslplugins-rs/src/plugin/utils.rs @@ -65,7 +65,7 @@ pub fn create_plugin_with_required_version( /// into a [windows::core::Error] using the `consume_error_message_unwrap` method. /// /// # Arguments -/// - `result`: A [Result] using the custom [Error] type defined in this crate. +/// - `result`: A [`Result`] using the custom [Error] type defined in this crate. /// /// # Returns /// A `WinResult` where: @@ -74,7 +74,7 @@ pub fn create_plugin_with_required_version( /// /// # Behavior /// - If the `result` is `Ok`, it is returned as-is. -/// - If the `result` is `Err`, the error is consumed using the +/// - If the `result` is `Err`, the error is consumed /// and sent to WSL and is then /// converted into a [windows::core::Error]. /// diff --git a/wslplugins-rs/src/wsl_user_configuration/bitflags.rs b/wslplugins-rs/src/wsl_user_configuration/bitflags.rs index 32c89ec..c100abe 100644 --- a/wslplugins-rs/src/wsl_user_configuration/bitflags.rs +++ b/wslplugins-rs/src/wsl_user_configuration/bitflags.rs @@ -1,10 +1,10 @@ -//! Provides a [bitflags] implementation for [WSLUserConfiguration] flags. +//! Provides a [mod@bitflags] implementation for [WSLUserConfiguration] flags. use super::WSLUserConfiguration; use bitflags::bitflags; bitflags! { /// Represents the user configuration flags for Windows Subsystem for Linux (WSL) as - /// [bitflags] + /// [mod@bitflags] /// /// These flags are used to customize the behavior of WSL instances based on user configuration. /// The values correspond to the definitions in the WSL Plugin API provided by Microsoft.