Skip to content

Commit 1f2aaa7

Browse files
authored
Fix broken documentation links (#536)
* Fix documentation links * Check documentation links
1 parent e5ed4a9 commit 1f2aaa7

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

src/array.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use crate::untyped_array::{PyUntypedArray, PyUntypedArrayMethods};
4343
/// These methods transfers ownership of the Rust allocation into a suitable Python object
4444
/// and uses the memory as the internal buffer backing the NumPy array.
4545
///
46-
/// Please note that some destructive methods like [`resize`][Self::resize] will fail
46+
/// Please note that some destructive methods like [`resize`][PyArrayMethods::resize] will fail
4747
/// when used with this kind of array as NumPy cannot reallocate the internal buffer.
4848
///
4949
/// - Allocated by NumPy: Constructed via other methods, like [`ToPyArray`] or
@@ -94,6 +94,7 @@ use crate::untyped_array::{PyUntypedArray, PyUntypedArrayMethods};
9494
/// });
9595
/// ```
9696
///
97+
/// [`PyObject`]: pyo3::ffi::PyObject
9798
/// [ndarray]: https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html
9899
/// [pyo3-memory]: https://pyo3.rs/main/memory.html
99100
#[repr(transparent)]
@@ -183,7 +184,7 @@ impl<T: Element, D: Dimension> PyArray<T, D> {
183184
/// into Python's heap, which NumPy will automatically zero-initialize.
184185
///
185186
/// However, the elements themselves will not be valid and should be initialized manually
186-
/// using raw pointers obtained via [`uget_raw`][Self::uget_raw]. Before that, all methods
187+
/// using raw pointers obtained via [`uget_raw`][PyArrayMethods::uget_raw]. Before that, all methods
187188
/// which produce references to the elements invoke undefined behaviour. In particular,
188189
/// zero-initialized pointers are _not_ valid instances of `PyObject`.
189190
///
@@ -721,7 +722,7 @@ pub trait PyArrayMethods<'py, T, D>: PyUntypedArrayMethods<'py> + Sized {
721722
/// Returns a pointer to the first element of the array.
722723
fn data(&self) -> *mut T;
723724

724-
/// Same as [`shape`][PyUntypedArray::shape], but returns `D` instead of `&[usize]`.
725+
/// Same as [`shape`][PyUntypedArrayMethods::shape], but returns `D` instead of `&[usize]`.
725726
#[inline(always)]
726727
fn dims(&self) -> D
727728
where

src/borrow/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
//!
162162
//! This does limit the set of programs that can be written using safe Rust in way similar to rustc itself
163163
//! which ensures that all accepted programs are memory safe but does not necessarily accept all memory safe programs.
164-
//! However, the unsafe method [`PyArray::as_array_mut`] can be used as an escape hatch.
164+
//! However, the unsafe method [`PyArrayMethods::as_array_mut`] can be used as an escape hatch.
165165
//! More involved cases like the example from above may be supported in the future.
166166
//!
167167
//! [base]: https://numpy.org/doc/stable/reference/c-api/types-and-structures.html#c.NPY_AO.base
@@ -529,7 +529,7 @@ where
529529
///
530530
/// Calling this will prevent any further [PyReadwriteArray]s from being taken out. Python
531531
/// space can reset this flag, unless the additional flag [`OWNDATA`][owndata] is unset. Such
532-
/// an array can be created from Rust space by using [PyArray::borrow_from_array_bound].
532+
/// an array can be created from Rust space by using [PyArray::borrow_from_array].
533533
///
534534
/// [writeable]: https://numpy.org/doc/stable/reference/c-api/array.html#c.NPY_ARRAY_WRITEABLE
535535
/// [owndata]: https://numpy.org/doc/stable/reference/c-api/array.html#c.NPY_ARRAY_OWNDATA
@@ -604,7 +604,7 @@ where
604604
{
605605
/// Extends or truncates the dimensions of an array.
606606
///
607-
/// Safe wrapper for [`PyArray::resize`].
607+
/// Safe wrapper for [`PyArrayMethods::resize`].
608608
///
609609
/// Note that as this mutates a pointed-to object, the [`PyReadwriteArray`] must be the only
610610
/// Python reference to the object. There cannot be `PyArray` pointers or even `Bound<PyAny>`

src/datetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<U: Unit> fmt::Debug for Datetime<U> {
171171
}
172172
}
173173

174-
/// Corresponds to the [`timedelta64`][scalars-datetime64] scalar type
174+
/// Corresponds to the [`timedelta64`][scalars-timedelta64] scalar type
175175
///
176176
/// [scalars-timedelta64]: https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.timedelta64
177177
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]

src/dtype.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pub trait PyArrayDescrMethods<'py>: Sealed {
166166
///
167167
/// Equivalent to [`numpy.dtype.itemsize`][dtype-itemsize].
168168
///
169-
/// [dtype-itemsiize]: https://numpy.org/doc/stable/reference/generated/numpy.dtype.itemsize.html
169+
/// [dtype-itemsize]: https://numpy.org/doc/stable/reference/generated/numpy.dtype.itemsize.html
170170
fn itemsize(&self) -> usize;
171171

172172
/// Returns the required alignment (bytes) of this type descriptor according to the compiler.
@@ -296,7 +296,7 @@ pub trait PyArrayDescrMethods<'py>: Sealed {
296296
/// This method will return an error if this type descriptor is not structured,
297297
/// or if it does not contain a field with a given name.
298298
///
299-
/// The list of all names can be found via [`PyArrayDescr::names`].
299+
/// The list of all names can be found via [`PyArrayDescrMethods::names`].
300300
///
301301
/// Equivalent to retrieving a single item from [`numpy.dtype.fields`][dtype-fields].
302302
///

src/untyped_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub trait PyUntypedArrayMethods<'py>: Sealed {
234234

235235
/// Returns a slice which contains dimensions of the array.
236236
///
237-
/// See also [`ndarray.shape`][ndaray-shape] and [`PyArray_DIMS`][PyArray_DIMS].
237+
/// See also [`ndarray.shape`][ndarray-shape] and [`PyArray_DIMS`][PyArray_DIMS].
238238
///
239239
/// # Example
240240
///

x.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
from pathlib import Path
88

99

10-
def run(*args):
11-
subprocess.run([*args], check=True)
10+
def run(*args, env=None):
11+
if env is not None:
12+
env = {**os.environ, **env}
13+
subprocess.run([*args], check=True, env=env)
1214

1315

1416
def can_run(*args):
@@ -55,6 +57,7 @@ def default(args):
5557

5658

5759
def check(args):
60+
run("cargo", "doc", "--no-deps", env={"RUSTDOCFLAGS": "--deny warnings"})
5861
run("cargo", "fmt", "--", "--check")
5962
run("cargo", "clippy", "--all-features", "--tests", "--", *DENY_WARNINGS)
6063

0 commit comments

Comments
 (0)