Skip to content

Commit 5e6b08f

Browse files
authored
Ensure on CI that docs build without warnings (#1132)
Closes #1122
1 parent 4b58f40 commit 5e6b08f

File tree

29 files changed

+83
-52
lines changed

29 files changed

+83
-52
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ jobs:
4242
- name: Test
4343
run: cargo test --all-features
4444

45+
docs-no-warnings:
46+
name: Lint and Test
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
submodules: "recursive"
52+
- name: Install Rust
53+
uses: dtolnay/rust-toolchain@stable
54+
55+
# TODO: switch back to pixi environment
56+
- name: Install GEOS
57+
run: |
58+
sudo apt-get update
59+
sudo apt-get install -y libgeos-dev
60+
61+
# Note: in the future expand to all crates in the workspace
62+
- name: Test that docs build without warnings
63+
run: cargo doc --all-features --document-private-items
64+
env:
65+
RUSTDOCFLAGS: "-D warnings"
66+
4567
# This part of the old test suite from `geoarrow` used external dependencies,
4668
# especially GEOS, GDAL, and PROJ. Come back to this once we use these
4769
# dependencies from inside the refactored geoarrow-* crates.

rust/geoarrow-array/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ fn convert_to_point_array(array: &dyn Array, field: &Field) {
7979

8080
You can use the [`to_array_ref`][GeoArrowArray::to_array_ref] or [`into_array_ref`][GeoArrowArray::into_array_ref] methods on [`GeoArrowArray`] to convert to an [`ArrayRef`].
8181

82-
Alternatively, if you have a concrete GeoArrow array type, you can use [`IntoArray`] to convert to a concrete arrow array type.
82+
Alternatively, if you have a concrete GeoArrow array type, you can use [`IntoArray`][crate::IntoArrow] to convert to a concrete arrow array type.
8383

84-
The easiest way today to access an arrow [`Field`] is to use [`IntoArray::ext_type`] and then call `to_field` on the result. We like to make this process simpler in the future.
84+
The easiest way today to access an arrow [`Field`] is to use [`IntoArray::ext_type`][crate::IntoArrow::ext_type] and then call `to_field` on the result. We like to make this process simpler in the future.
8585

8686
## Downcasting a GeoArrow array
8787

rust/geoarrow-array/src/array/geometry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl GeometryArray {
341341
self.buffer_lengths().num_bytes()
342342
}
343343

344-
/// Slices this [`MixedGeometryArray`] in place.
344+
/// Slice this [`GeometryArray`].
345345
///
346346
/// # Implementation
347347
///

rust/geoarrow-array/src/array/geometrycollection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl GeometryCollectionArray {
7272
validity_len + self.buffer_lengths().num_bytes()
7373
}
7474

75-
/// Slices this [`GeometryCollectionArray`] in place.
75+
/// Slice this [`GeometryCollectionArray`].
7676
///
7777
/// # Implementation
7878
///

rust/geoarrow-array/src/array/linestring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl LineStringArray {
124124
validity_len + self.buffer_lengths().num_bytes()
125125
}
126126

127-
/// Slices this [`LineStringArray`] in place.
127+
/// Slice this [`LineStringArray`].
128128
///
129129
/// # Implementation
130130
///

rust/geoarrow-array/src/array/mixed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl MixedGeometryArray {
392392
self.buffer_lengths().num_bytes()
393393
}
394394

395-
/// Slices this [`MixedGeometryArray`] in place.
395+
/// Slice this [`MixedGeometryArray`].
396396
///
397397
/// # Implementation
398398
///

rust/geoarrow-array/src/array/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! The concrete array definitions.
22
//!
3-
//! All arrays implement the core [GeoArrowArray][crate::GeoArrowArray] trait.
3+
//! All arrays implement the core [GeoArrowArray] trait.
44
55
mod coord;
66
mod geometry;

rust/geoarrow-array/src/array/multilinestring.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ impl MultiLineStringArray {
156156
validity_len + self.buffer_lengths().num_bytes()
157157
}
158158

159-
/// Slices this [`MultiLineStringArray`] in place.
159+
/// Slice this [`MultiLineStringArray`].
160+
///
160161
/// # Panic
162+
///
161163
/// This function panics iff `offset + length > self.len()`.
162164
#[inline]
163165
pub fn slice(&self, offset: usize, length: usize) -> Self {

rust/geoarrow-array/src/array/multipoint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl MultiPointArray {
128128
validity_len + self.buffer_lengths().num_bytes()
129129
}
130130

131-
/// Slices this [`MultiPointArray`] in place.
131+
/// Slice this [`MultiPointArray`].
132132
///
133133
/// # Implementation
134134
///

rust/geoarrow-array/src/array/multipolygon.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ impl MultiPolygonArray {
208208
validity_len + self.buffer_lengths().num_bytes()
209209
}
210210

211-
/// Slices this [`MultiPolygonArray`] in place.
211+
/// Slice this [`MultiPolygonArray`].
212+
///
212213
/// # Panic
213214
/// This function panics iff `offset + length > self.len()`.
214215
#[inline]

rust/geoarrow-array/src/array/point.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl PointArray {
7676

7777
/// Access the underlying coordinate buffer
7878
///
79-
/// Note that some coordinates may be null, depending on the value of [`Self::nulls`]
79+
/// Note that some coordinates may be null, depending on the value of [`Self::logical_nulls`]
8080
pub fn coords(&self) -> &CoordBuffer {
8181
&self.coords
8282
}
@@ -93,7 +93,8 @@ impl PointArray {
9393
validity_len + self.buffer_lengths() * dimension.size() * 8
9494
}
9595

96-
/// Slices this [`PointArray`] in place.
96+
/// Slice this [`PointArray`].
97+
///
9798
/// # Panic
9899
/// This function panics iff `offset + length > self.len()`.
99100
#[inline]

rust/geoarrow-array/src/array/polygon.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ impl PolygonArray {
160160
validity_len + self.buffer_lengths().num_bytes()
161161
}
162162

163-
/// Slices this [`PolygonArray`] in place.
163+
/// Slice this [`PolygonArray`].
164+
///
164165
/// # Panic
165166
/// This function panics iff `offset + length > self.len()`.
166167
#[inline]

rust/geoarrow-array/src/array/rect.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,22 @@ impl RectArray {
5757

5858
/// Access the coordinate buffer of the "lower" corner of the RectArray
5959
///
60-
/// Note that this needs to be interpreted in conjunction with the [null buffer][Self::nulls].
60+
/// Note that this needs to be interpreted in conjunction with the [null
61+
/// buffer][Self::logical_nulls].
6162
pub fn lower(&self) -> &SeparatedCoordBuffer {
6263
&self.lower
6364
}
6465

6566
/// Access the coordinate buffer of the "upper" corner of the RectArray
6667
///
67-
/// Note that this needs to be interpreted in conjunction with the [null buffer][Self::nulls].
68+
/// Note that this needs to be interpreted in conjunction with the [null
69+
/// buffer][Self::logical_nulls].
6870
pub fn upper(&self) -> &SeparatedCoordBuffer {
6971
&self.upper
7072
}
7173

72-
/// Slices this [`RectArray`] in place.
74+
/// Slice this [`RectArray`].
75+
///
7376
/// # Panic
7477
/// This function panics iff `offset + length > self.len()`.
7578
#[inline]

rust/geoarrow-array/src/array/wkb.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ impl<O: OffsetSizeTrait> GenericWkbArray<O> {
6363
validity_len + self.buffer_lengths().num_bytes::<O>()
6464
}
6565

66-
/// Slices this [`GenericWkbArray`] in place.
66+
/// Slice this [`GenericWkbArray`].
67+
///
68+
///
6769
/// # Panic
6870
/// This function panics iff `offset + length > self.len()`.
6971
#[inline]
@@ -78,7 +80,7 @@ impl<O: OffsetSizeTrait> GenericWkbArray<O> {
7880
}
7981
}
8082

81-
/// Replace the [ArrayMetadata] in the array with the given metadata
83+
/// Replace the [Metadata] in the array with the given metadata
8284
pub fn with_metadata(&self, metadata: Arc<Metadata>) -> Self {
8385
let mut arr = self.clone();
8486
arr.data_type = self.data_type.clone().with_metadata(metadata);

rust/geoarrow-array/src/array/wkb_view.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ impl WkbViewArray {
3838
self.len() == 0
3939
}
4040

41-
/// Slices this [`GenericWkbArray`] in place.
41+
/// Slice this [`GenericWkbArray`].
42+
///
43+
///
4244
/// # Panic
4345
/// This function panics iff `offset + length > self.len()`.
4446
#[inline]
@@ -53,7 +55,7 @@ impl WkbViewArray {
5355
}
5456
}
5557

56-
/// Replace the [ArrayMetadata] in the array with the given metadata
58+
/// Replace the [Metadata] in the array with the given metadata
5759
pub fn with_metadata(&self, metadata: Arc<Metadata>) -> Self {
5860
let mut arr = self.clone();
5961
arr.data_type = self.data_type.clone().with_metadata(metadata);

rust/geoarrow-array/src/array/wkt.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ impl<O: OffsetSizeTrait> GenericWktArray<O> {
5050
&self.array
5151
}
5252

53-
/// Slices this [`GenericWkbArray`] in place.
53+
/// Slice this [`GenericWktArray`].
54+
///
5455
/// # Panic
5556
/// This function panics iff `offset + length > self.len()`.
5657
#[inline]
@@ -65,7 +66,7 @@ impl<O: OffsetSizeTrait> GenericWktArray<O> {
6566
}
6667
}
6768

68-
/// Replace the [`ArrayMetadata`] contained in this array.
69+
/// Replace the [`Metadata`] contained in this array.
6970
pub fn with_metadata(&self, metadata: Arc<Metadata>) -> Self {
7071
let mut arr = self.clone();
7172
arr.data_type = self.data_type.clone().with_metadata(metadata);

rust/geoarrow-array/src/array/wkt_view.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ impl WktViewArray {
4444
&self.array
4545
}
4646

47-
/// Slices this [`WktViewArray`] in place.
47+
/// Slice this [`WktViewArray`].
48+
///
49+
///
4850
/// # Panic
4951
/// This function panics iff `offset + length > self.len()`.
5052
#[inline]
@@ -59,7 +61,7 @@ impl WktViewArray {
5961
}
6062
}
6163

62-
/// Replace the [ArrayMetadata] in the array with the given metadata
64+
/// Replace the [Metadata] in the array with the given metadata
6365
pub fn with_metadata(&self, metadata: Arc<Metadata>) -> Self {
6466
let mut arr = self.clone();
6567
arr.data_type = self.data_type.clone().with_metadata(metadata);

rust/geoarrow-array/src/builder/offsets.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ impl<O: OffsetSizeTrait> Default for OffsetsBuilder<O> {
2222
}
2323

2424
impl<O: OffsetSizeTrait> OffsetsBuilder<O> {
25-
/// Returns an empty [`Offsets`] (i.e. with a single element, the zero)
25+
/// Returns an empty [`OffsetsBuilder`] (i.e. with a single element, the zero)
2626
#[inline]
2727
pub(crate) fn new() -> Self {
2828
Self(vec![O::zero()])
2929
}
3030

31-
/// Returns a new [`Offsets`] with a capacity, allocating at least `capacity + 1` entries.
31+
/// Returns a new [`OffsetsBuilder`] with a capacity, allocating at least `capacity + 1`
32+
/// entries.
3233
pub(crate) fn with_capacity(capacity: usize) -> Self {
3334
let mut offsets = Vec::with_capacity(capacity + 1);
3435
offsets.push(O::zero());

rust/geoarrow-array/src/datatypes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::error::{GeoArrowError, Result};
1717
/// "serialized" encodings.
1818
///
1919
/// This is designed to aid in downcasting from dynamically-typed geometry arrays in combination
20-
/// with the [`AsGeoArrowArray`][crate::AsGeoArrowArray] trait.
20+
/// with the [`AsGeoArrowArray`][crate::cast::AsGeoArrowArray] trait.
2121
///
2222
/// This type uniquely identifies the physical buffer layout of each geometry array type.
2323
#[derive(Debug, Clone, PartialEq, Eq, Hash)]

rust/geoarrow-array/src/geozero/export/scalar/point.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) fn process_point<P: GeomProcessor>(
1818
/// Note that this does _not_ call `processor.point_begin` and `processor.point_end` because as of
1919
/// geozero v0.12, `point_begin` and `point_end` are **not** called for each point in a
2020
/// MultiPoint
21-
/// https://github.com/georust/geozero/pull/183/files#diff-a583e23825ff28368eabfdbfdc362c6512e42097024d548fb18d88409feba76aR142-R143
21+
/// <https://github.com/georust/geozero/pull/183/files#diff-a583e23825ff28368eabfdbfdc362c6512e42097024d548fb18d88409feba76aR142-R143>
2222
pub(crate) fn process_point_as_coord<P: GeomProcessor>(
2323
geom: &impl PointTrait<T = f64>,
2424
coord_idx: usize,

rust/geoarrow-array/src/scalar/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! [`WkbViewArray`][crate::array::WkbViewArray],
88
//! [`GenericWktArray`][crate::array::GenericWktArray], and
99
//! [`WktViewArray`][crate::array::WktViewArray], there is an initial parsing step when accessing
10-
//! the scalar from the [`ArrayAccessor`][crate::ArrayAccessor] trait.
10+
//! the scalar from the [`GeoArrowArrayAccessor`][crate::GeoArrowArrayAccessor] trait.
1111
//!
1212
//! All scalars implement [`geo_traits`]. You can iterate through geometry parts directly using the
1313
//! APIs exposed by [`geo_traits`]. Or, for simplicity at the cost of a memory copy, you can use

rust/geoarrow-array/src/trait_.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ pub trait IntoArrow {
3535

3636
/// A base trait for all GeoArrow arrays.
3737
///
38-
/// This is a geospatial corollary to the upstream [`Array`][arrow_array::Array] trait.
38+
/// This is a geospatial corollary to the upstream [`Array`] trait.
3939
pub trait GeoArrowArray: Debug + Send + Sync {
4040
/// Returns the array as [`Any`] so that it can be downcasted to a specific implementation.
4141
///
42-
/// Prefer using [`AsGeoArrowArray`] instead of calling this method and manually downcasting.
42+
/// Prefer using [`AsGeoArrowArray`][crate::cast::AsGeoArrowArray] instead of calling this
43+
/// method and manually downcasting.
4344
fn as_any(&self) -> &dyn Any;
4445

4546
/// Returns the [`GeoArrowType`] of this array.
@@ -150,9 +151,10 @@ pub trait GeoArrowArray: Debug + Send + Sync {
150151
/// physical arrow representation.
151152
///
152153
/// For most array types, this is equivalent to the "physical" nulls returned by
153-
/// [`Array::nulls`]. However it is different for union arrays, including our [`GeometryArray`]
154-
/// and [`GeometryCollectionArray`] types, because the unions aren't encoded in a single null
155-
/// buffer.
154+
/// [`Array::nulls`]. However it is different for union arrays, including our
155+
/// [`GeometryArray`][crate::array::GeometryArray] and
156+
/// [`GeometryCollectionArray`][crate::array::GeometryCollectionArray] types, because the
157+
/// unions aren't encoded in a single null buffer.
156158
fn logical_nulls(&self) -> Option<NullBuffer>;
157159

158160
/// Returns the number of null slots in this array.
@@ -417,11 +419,6 @@ pub trait GeoArrowArrayAccessor<'a>: GeoArrowArray {
417419

418420
/// A trait describing a mutable geometry array; i.e. an array whose values can be changed.
419421
///
420-
/// Mutable arrays cannot be cloned but can be mutated in place,
421-
/// thereby making them useful to perform numeric operations without allocations.
422-
/// As in [`NativeArray`], concrete arrays (such as
423-
/// [`PointBuilder`][crate::array::PointBuilder]) implement how they are mutated.
424-
//
425422
// Note: This trait is not yet publicly exported from this crate, as we're not sure how the API
426423
// should be, and in particular whether we need this trait to be dyn-compatible or not.
427424
pub(crate) trait GeoArrowArrayBuilder: Debug + Send + Sync {

rust/geoarrow-geoparquet/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl GeoParquetGeometryType {
159159
///
160160
/// Note: we use [`SerializeDisplay`] and [`DeserializeFromStr`] for serde because the GeoParquet
161161
/// spec says this concept is a single string with the dimension stored as a suffix.
162-
/// https://docs.rs/serde_with/3.12.0/serde_with/struct.DisplayFromStr.html
162+
/// <https://docs.rs/serde_with/3.12.0/serde_with/struct.DisplayFromStr.html>
163163
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, SerializeDisplay, DeserializeFromStr)]
164164
pub struct GeoParquetGeometryTypeAndDimension {
165165
geometry_type: GeoParquetGeometryType,

rust/geoarrow-geoparquet/src/reader/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub trait GeoParquetReaderBuilder: Sized {
2020

2121
/// A synchronous builder used to construct [`GeoParquetRecordBatchReader`] for a file.
2222
///
23-
/// For an async API see [`crate::io::parquet::GeoParquetRecordBatchStreamBuilder`]
23+
/// For an async API see [`crate::reader::GeoParquetRecordBatchStreamBuilder`]
2424
pub struct GeoParquetRecordBatchReaderBuilder<T: ChunkReader + 'static> {
2525
builder: ParquetRecordBatchReaderBuilder<T>,
2626
geo_meta: Option<GeoParquetMetadata>,

rust/geoarrow-geoparquet/src/reader/options.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Default for GeoParquetReaderOptions {
5959
}
6060

6161
impl GeoParquetReaderOptions {
62-
/// Set the size of [RecordBatch][arrow::array::RecordBatch] to produce.
62+
/// Set the size of [RecordBatch][arrow_array::RecordBatch] to produce.
6363
///
6464
/// Defaults to 1024. If the batch_size more than the file row count, use the file row count.
6565
pub fn with_batch_size(self, batch_size: usize) -> Self {
@@ -93,7 +93,7 @@ impl GeoParquetReaderOptions {
9393
/// allowing it to limit the final set of rows decoded after any pushed down predicates
9494
///
9595
/// It is recommended to enable reading the page index if using this functionality, to allow
96-
/// more efficient skipping over data pages. See [`ArrowReaderOptions::with_page_index`]
96+
/// more efficient skipping over data pages. See `ArrowReaderOptions::with_page_index`
9797
pub fn with_limit(self, limit: usize) -> Self {
9898
Self {
9999
limit: Some(limit),

rust/geoarrow-schema/src/metadata.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ use crate::{Crs, Edges};
77
///
88
/// This follows the extension metadata [defined by the GeoArrow
99
/// specification](https://geoarrow.org/extension-types).
10-
///
11-
/// This is serialized to JSON when a [`geoarrow`](self) array is exported to an [`arrow`] array
12-
/// and deserialized when imported from an [`arrow`] array.
1310
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
1411
pub struct Metadata {
1512
// Raise the underlying crs fields to this level.

rust/geoarrow-test/src/raw/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Raw test data, copied from geoarrow-data
22
//!
3-
//! - https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src.yaml
4-
//! - https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src_generated.yaml
3+
//! - <https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src.yaml>
4+
//! - <https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src_generated.yaml>
55
66
pub mod geometry;
77
pub mod geometrycollection;

0 commit comments

Comments
 (0)