From 7e5762b984faa4ecf25520eb92ec4ef53126f73a Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Thu, 8 Aug 2024 18:22:19 +0200 Subject: [PATCH 1/4] ci: Run all checks as pull request tests --- .github/workflows/ci.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 88c9a6c2d..5a2807284 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,9 @@ on: pull_request: merge_group: + push: + branches: + - master name: Continuous integration @@ -86,7 +89,7 @@ jobs: - run: ./scripts/all-tests.sh "$FEATURES" ${{ matrix.rust }} cross_test: - if: ${{ github.event_name == 'merge_group' }} + #if: ${{ github.event_name == 'merge_group' }} runs-on: ubuntu-latest strategy: matrix: @@ -110,7 +113,7 @@ jobs: - run: ./scripts/cross-tests.sh "docs" ${{ matrix.rust }} ${{ matrix.target }} cargo-careful: - if: ${{ github.event_name == 'merge_group' }} + #if: ${{ github.event_name == 'merge_group' }} runs-on: ubuntu-latest name: cargo-careful steps: @@ -124,7 +127,7 @@ jobs: - run: cargo careful test -Zcareful-sanitizer --features="$FEATURES" docs: - if: ${{ github.event_name == 'merge_group' }} + #if: ${{ github.event_name == 'merge_group' }} runs-on: ubuntu-latest strategy: matrix: From 6a8fb964d9152bfa108a7fba5d41b5a060f8b36c Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Thu, 8 Aug 2024 18:24:08 +0200 Subject: [PATCH 2/4] ci: Check for warnings in cargo doc --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5a2807284..f36591741 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -134,12 +134,14 @@ jobs: rust: - stable name: docs/${{ matrix.rust }} + env: + RUSTDOCFLAGS: "-Dwarnings" steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} - - run: cargo doc + - run: cargo doc --no-deps --all-features conclusion: needs: From 2d258bc605cdde8cde516e471a997b5f9c713b7a Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Thu, 8 Aug 2024 18:28:49 +0200 Subject: [PATCH 3/4] Fix rustdoc warnings everywhere --- src/dimension/broadcast.rs | 4 ++-- src/doc/crate_feature_flags.rs | 3 +++ src/doc/ndarray_for_numpy_users/mod.rs | 4 +++- src/doc/ndarray_for_numpy_users/rk_step.rs | 1 + src/slice.rs | 3 +++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/dimension/broadcast.rs b/src/dimension/broadcast.rs index d277cfea2..fb9fc1a0c 100644 --- a/src/dimension/broadcast.rs +++ b/src/dimension/broadcast.rs @@ -41,8 +41,8 @@ pub trait DimMax } /// Dimensions of the same type remain unchanged when co_broadcast. -/// So you can directly use D as the resulting type. -/// (Instead of >::BroadcastOutput) +/// So you can directly use `D` as the resulting type. +/// (Instead of `>::BroadcastOutput`) impl DimMax for D { type Output = D; diff --git a/src/doc/crate_feature_flags.rs b/src/doc/crate_feature_flags.rs index c0fc4c0f5..fc2c2bd49 100644 --- a/src/doc/crate_feature_flags.rs +++ b/src/doc/crate_feature_flags.rs @@ -30,3 +30,6 @@ //! - Enable the ``threading`` feature in the matrixmultiply package //! //! [`parallel`]: crate::parallel + +#[cfg(doc)] +use crate::parallel::par_azip; diff --git a/src/doc/ndarray_for_numpy_users/mod.rs b/src/doc/ndarray_for_numpy_users/mod.rs index 5ac15e300..eba96cdd0 100644 --- a/src/doc/ndarray_for_numpy_users/mod.rs +++ b/src/doc/ndarray_for_numpy_users/mod.rs @@ -654,7 +654,7 @@ //! convert `f32` array to `i32` array with ["saturating" conversion][sat_conv]; care needed because it can be a lossy conversion or result in non-finite values! See [the reference for information][as_typecast]. //! //! -//! +//!
//! //! [as_conv]: https://doc.rust-lang.org/rust-by-example/types/cast.html //! [sat_conv]: https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html#fixing-unsoundness-in-casts @@ -677,6 +677,8 @@ //! [.column()]: ArrayBase::column //! [.column_mut()]: ArrayBase::column_mut //! [concatenate()]: crate::concatenate() +//! [concatenate!]: crate::concatenate! +//! [stack!]: crate::stack! //! [::default()]: ArrayBase::default //! [.diag()]: ArrayBase::diag //! [.dim()]: ArrayBase::dim diff --git a/src/doc/ndarray_for_numpy_users/rk_step.rs b/src/doc/ndarray_for_numpy_users/rk_step.rs index 0448e0705..c882a3d00 100644 --- a/src/doc/ndarray_for_numpy_users/rk_step.rs +++ b/src/doc/ndarray_for_numpy_users/rk_step.rs @@ -169,6 +169,7 @@ //! ``` //! //! [`.scaled_add()`]: crate::ArrayBase::scaled_add +//! [`azip!()`]: crate::azip! //! //! ### SciPy license //! diff --git a/src/slice.rs b/src/slice.rs index 9e6acc449..e6c237a92 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -7,7 +7,10 @@ // except according to those terms. use crate::dimension::slices_intersect; use crate::error::{ErrorKind, ShapeError}; +#[cfg(doc)] +use crate::s; use crate::{ArrayViewMut, DimAdd, Dimension, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, IxDyn}; + #[cfg(not(feature = "std"))] use alloc::vec::Vec; use std::convert::TryFrom; From f07b2fe6f6b7c2bdc6a859f57ad1b51d6025eafd Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Thu, 8 Aug 2024 08:17:14 +0200 Subject: [PATCH 4/4] Set doc, doctest = false for test crates --- crates/blas-tests/Cargo.toml | 2 ++ crates/numeric-tests/Cargo.toml | 2 ++ crates/serialization-tests/Cargo.toml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/crates/blas-tests/Cargo.toml b/crates/blas-tests/Cargo.toml index 33323ceac..0dbd9fd12 100644 --- a/crates/blas-tests/Cargo.toml +++ b/crates/blas-tests/Cargo.toml @@ -7,6 +7,8 @@ edition = "2018" [lib] test = false +doc = false +doctest = false [dependencies] ndarray = { workspace = true, features = ["approx"] } diff --git a/crates/numeric-tests/Cargo.toml b/crates/numeric-tests/Cargo.toml index 09fe14dbb..214612258 100644 --- a/crates/numeric-tests/Cargo.toml +++ b/crates/numeric-tests/Cargo.toml @@ -7,6 +7,8 @@ edition = "2018" [lib] test = false +doc = false +doctest = false [dependencies] ndarray = { workspace = true, features = ["approx"] } diff --git a/crates/serialization-tests/Cargo.toml b/crates/serialization-tests/Cargo.toml index 8e7056b88..be7c4c17b 100644 --- a/crates/serialization-tests/Cargo.toml +++ b/crates/serialization-tests/Cargo.toml @@ -7,6 +7,8 @@ edition = "2018" [lib] test = false +doc = false +doctest = false [dependencies] ndarray = { workspace = true, features = ["serde"] }