Skip to content

Commit f6c92e1

Browse files
ci(lint): gate rustdoc warnings in lint-rust (paradedb#5562)
## What Add a Rustdoc step to `lint-rust` (`RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items`) so broken intra-doc links, bare URLs, and malformed HTML in doc comments fail CI, and clear the 53 pre-existing warnings that surface under `--document-private-items`. Follow-up to the doc-link fix in paradedb#5547, which noted the linter would have caught it — this wires up that gate. ## The fixes - **De-link** intra-doc references that don't resolve (out-of-scope, private, or local-variable targets), keeping the backticked inline code — e.g. `[`ExecMethod`]` → ``ExecMethod``. - **Path typos**: `pg_sys:Buffer` → `pg_sys::Buffer`. - **Bare URLs** wrapped in angle brackets. - **Generic type expressions** (`Option<i16>`, `Vec<Datum>`, `<uuid>.<ext>`) backticked so rustdoc stops parsing them as unclosed HTML tags. No runtime code changed — doc comments only, plus the workflow step. ## Notes - `--document-private-items` is what catches most of these: crate-internal modules (`mod foo;`) are skipped by default `cargo doc`. - Matches Clippy's default feature set (single pg version), so cfg-gated doc links aren't covered — a link that only breaks under a disabled `#[cfg]` won't be caught. Acceptable for now. - The `proc-macro-error2` future-incompat notice is a dependency-level cargo report, not a rustdoc lint, so it doesn't trip `-D warnings`. ## Tests - `RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items` — clean (exit 0). - Same with the default (public-only) doc build — clean. - `cargo fmt -- --check` — clean. https://claude.ai/code/session_01369qmSBKYCAXRv1qJsKS8g --------- Signed-off-by: Philippe Noël <21990816+philippemnoel@users.noreply.github.com>
1 parent b8506fe commit f6c92e1

34 files changed

Lines changed: 63 additions & 60 deletions

File tree

.github/workflows/lint-rust.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ jobs:
8181
- name: Run Rustfmt
8282
run: cargo fmt -- --check
8383

84+
- name: Run Rustdoc
85+
env:
86+
RUSTDOCFLAGS: "-D warnings"
87+
run: cargo doc --workspace --no-deps --document-private-items
88+
8489
- name: Run Clippy
8590
run: cargo clippy --workspace --all-targets -- -D warnings --no-deps
8691

benchmarks/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn mean(data: &[f64]) -> f64 {
6262
/// Returns the half-width of the confidence interval for the provided confidence level
6363
///
6464
/// The math for this comes from single-level version of what is shown in this paper:
65-
/// https://dl.acm.org/doi/10.1145/2555670.2464160.
65+
/// <https://dl.acm.org/doi/10.1145/2555670.2464160>.
6666
pub fn confidence_interval_half_width(data: &[f64], confidence_level: f64) -> f64 {
6767
assert!(!data.is_empty());
6868
assert!(confidence_level > 0.0);

pg_search/src/index/directory/mvcc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use tantivy::{Directory, IndexMeta, SegmentMeta, TantivyError};
5757
/// which creates less lock contention than allocating one block at a time.
5858
pub const BUFWRITER_CAPACITY: usize = bm25_max_free_space() * MAX_BUFFERS_TO_EXTEND_BY;
5959

60-
/// Describes how a [`MvccDirectory`] should resolve segment visibility. Note that
60+
/// Describes how a `MvccDirectory` should resolve segment visibility. Note that
6161
/// this enum is purposely non-cloneable. Wrap it with an [`Arc`] if you need that. Because of
6262
/// the [`MvccSatisfies::ParallelWorker`] variant, cloning could be incredibly expensive when
6363
/// an index has many (thousands!) of segments.
@@ -389,7 +389,7 @@ impl Directory for MVCCDirectory {
389389
}
390390

391391
/// Returns a list of all segment components to Tantivy,
392-
/// identified by <uuid>.<ext> PathBufs
392+
/// identified by `<uuid>.<ext>` PathBufs
393393
fn list_managed_files(&self) -> tantivy::Result<std::collections::HashSet<PathBuf>> {
394394
unsafe {
395395
Ok(MetaPage::open(&self.indexrel)

pg_search/src/postgres/catalog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub fn lookup_database_collation_locale() -> Option<CollationLocale> {
235235
}
236236

237237
/// Helper function to lookup the `collcollate` and `collprovider` fields for a collation object in `pg_collation`
238-
/// Note that while `collprovider` is always present in `pg_collation`, `collcollate` may be NULL: https://www.postgresql.org/docs/current/catalog-pg-collation.html
238+
/// Note that while `collprovider` is always present in `pg_collation`, `collcollate` may be NULL: <https://www.postgresql.org/docs/current/catalog-pg-collation.html>
239239
pub fn lookup_collation_locale(collation: pg_sys::Oid) -> Option<CollationLocale> {
240240
unsafe {
241241
let entry =

pg_search/src/postgres/composite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ pub unsafe fn get_composite_fields_for_index(
227227
/// ```sql
228228
/// CREATE INDEX idx ON t USING bm25 (id, ROW(a,b,c)::my_type);
229229
/// ```
230-
/// The composite at values[1] is unpacked once during construction.
230+
/// The composite at `values[1]` is unpacked once during construction.
231231
/// Fields "a", "b", "c" are then retrieved via simple lookups.
232232
///
233233
/// # Lifetime

pg_search/src/postgres/customscan/aggregatescan/aggregate_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ impl AggregateType {
404404
/// - Any referenced field is a NUMERIC type (not supported for aggregation)
405405
///
406406
/// TODO: remove field existence check once Tantivy aggregation validation is fixed.
407-
/// https://github.com/quickwit-oss/tantivy/issues/2767
407+
/// <https://github.com/quickwit-oss/tantivy/issues/2767>
408408
pub fn validate_fields(&self, schema: &SearchIndexSchema) -> Result<(), String> {
409409
// Check NUMERIC field support for standard aggregates
410410
if let Some(field) = self.field_name() {

pg_search/src/postgres/customscan/aggregatescan/datafusion_build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub unsafe fn collect_join_agg_sources(
174174
/// the planner has absorbed WHERE-clause quals into `RestrictInfo` lists on
175175
/// the planned `JoinPath` nodes - so `(*from).quals` can be null even for
176176
/// `SELECT ... FROM a, b WHERE a.id = b.id`. We recursively walk the path
177-
/// tree via [`extract_equi_keys_from_path`], inspecting each `JoinPath`'s
177+
/// tree via `extract_equi_keys_from_path`, inspecting each `JoinPath`'s
178178
/// `joinrestrictinfo` for `OpExpr` nodes with merge-joinable (equality)
179179
/// operators whose two sides reference different base relations.
180180
///
@@ -1287,8 +1287,8 @@ unsafe fn all_vars_are_fast_fields_for_agg(
12871287
}
12881288

12891289
/// Transform collected cross-table clause pointers into a `JoinLevelExpr`
1290-
/// tree by delegating to JoinScan's [`transform_to_search_expr`] via a
1291-
/// temporary [`JoinCSClause`]. After plan_positions have been assigned,
1290+
/// tree by delegating to JoinScan's `transform_to_search_expr` via a
1291+
/// temporary `JoinCSClause`. After plan_positions have been assigned,
12921292
/// `plan.sources()` returns `&[&JoinSource]` - the same type JoinScan uses -
12931293
/// so the shared function works directly.
12941294
///

pg_search/src/postgres/customscan/aggregatescan/join_targetlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn find_source_by_rti<'a>(
5555
}
5656

5757
/// Simplified aggregate classification for the DataFusion backend.
58-
/// Unlike [`AggregateType`] (Tantivy-oriented), this enum is lightweight and maps
58+
/// Unlike `AggregateType` (Tantivy-oriented), this enum is lightweight and maps
5959
/// directly to DataFusion aggregate expressions.
6060
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
6161
pub enum AggKind {

pg_search/src/postgres/customscan/aggregatescan/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ unsafe fn group_key_to_datum(
19161916
}
19171917

19181918
/// Detects ORDER BY + LIMIT for join aggregate queries and returns a
1919-
/// [`DataFusionTopK`] describing the sort target, direction, and K.
1919+
/// `DataFusionTopK` describing the sort target, direction, and K.
19201920
///
19211921
/// Supports two patterns:
19221922
/// - **ORDER BY aggregate LIMIT K** (e.g., `ORDER BY COUNT(*) DESC LIMIT 5`)

pg_search/src/postgres/customscan/aggregatescan/scan_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub struct DataFusionAggState {
7575
pub current_batch: Option<RecordBatch>,
7676
/// Row index within current_batch.
7777
pub batch_row_idx: usize,
78-
/// Mapping from group_columns[i] to its 0-based column index in DataFusion's
78+
/// Mapping from `group_columns[i]` to its 0-based column index in DataFusion's
7979
/// output RecordBatch. Needed because DataFusion deduplicates grouping
8080
/// expressions (e.g. metadata.brand).
8181
pub group_df_indices: Vec<usize>,

0 commit comments

Comments
 (0)