From 9e4be959feaf8fa2154f8624cbaf082673edc77b Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Wed, 22 Jan 2025 14:14:24 -0600 Subject: [PATCH] rustdoc: enforce rustdocs to build without warnings in ci --- Makefile | 2 +- crates/sui-graphql-client-build/README.md | 4 ++-- crates/sui-graphql-client/README.md | 2 +- crates/sui-graphql-client/src/streams.rs | 4 +++- crates/sui-transaction-builder/src/lib.rs | 8 ++++---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 28b52774a..a5438b6d3 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ wasm: ## Build WASM modules .PHONY: doc doc: ## Generate documentation - RUSTDOCFLAGS="--cfg=doc_cfg -Zunstable-options --generate-link-to-definition" RUSTC_BOOTSTRAP=1 cargo doc --all-features --no-deps + RUSTDOCFLAGS="-Dwarnings --cfg=doc_cfg -Zunstable-options --generate-link-to-definition" RUSTC_BOOTSTRAP=1 cargo doc --all-features --no-deps .PHONY: doc-open doc-open: ## Generate and open documentation diff --git a/crates/sui-graphql-client-build/README.md b/crates/sui-graphql-client-build/README.md index e6f20fbec..cbf199e1e 100644 --- a/crates/sui-graphql-client-build/README.md +++ b/crates/sui-graphql-client-build/README.md @@ -31,7 +31,7 @@ sui-graphql-client-build = { git = "https://github.com/mystenlabs/sui-rust-sdk", ``` 4. If using `cynic`, use the cynic generator to generate the Rust types from the GraphQL schema. \ - Go to https://generator.cynic-rs.dev/ and paste the URL to the GraphQL service or manually copy paste the schema. \ + Go to and paste the URL to the GraphQL service or manually copy paste the schema. \ Then you can select the fields in the query you want to have, and the generator will generate the Rust types for you. 5. In your Rust code, you can now use the custom query types generated by `cynic`. @@ -57,6 +57,6 @@ async fn main() { } ``` -6. For `UInt53`, you can use `u64` type directly as the `sui-graphql-client`'s schema implements the `impl_scalar`. Similarly for other types (Base64, DateTime). See more available types here: https://github.com/MystenLabs/sui-rust-sdk/blob/02639f6b09375fe03fa2243868be17bec1dfa33c/crates/sui-graphql-client/src/query_types/mod.rs?plain=1#L124-L126 +6. For `UInt53`, you can use `u64` type directly as the `sui-graphql-client`'s schema implements the `impl_scalar`. Similarly for other types (Base64, DateTime). See more available types here: 7. Read the `cynic` [documentation](https://cynic-rs.dev/) to learn how to work with it, particularly when it comes to passing arguments to the query. diff --git a/crates/sui-graphql-client/README.md b/crates/sui-graphql-client/README.md index 808e7467b..6e36986ef 100644 --- a/crates/sui-graphql-client/README.md +++ b/crates/sui-graphql-client/README.md @@ -67,7 +67,7 @@ async fn main() -> Result<()> { ``` ### Example for custom faucet service. -Note that this [`FaucetClient`] is explicitly designed to work with two endpoints: `v1/gas`, and `v1/status`. When passing in the custom faucet URL, skip the final endpoint and only pass in the top-level url (e.g., `https://faucet.devnet.sui.io`). +Note that this `FaucetClient` is explicitly designed to work with two endpoints: `v1/gas`, and `v1/status`. When passing in the custom faucet URL, skip the final endpoint and only pass in the top-level url (e.g., `https://faucet.devnet.sui.io`). ```rust, no_run use sui_graphql_client::faucet::FaucetClient; use sui_types::Address; diff --git a/crates/sui-graphql-client/src/streams.rs b/crates/sui-graphql-client/src/streams.rs index f16985e71..f28f0c07c 100644 --- a/crates/sui-graphql-client/src/streams.rs +++ b/crates/sui-graphql-client/src/streams.rs @@ -151,6 +151,7 @@ where /// Creates a new `PageStream` for a paginated query. /// /// Examples +/// /// ```rust,ignore /// use futures::StreamExt; /// use sui_graphql_client::streams::stream_paginated_query; @@ -160,8 +161,9 @@ where /// /// let client = Client::new_testnet(); /// let stream = stream_paginated_query(|pagination_filter, Direction::Forward| { -/// client.coins(owner, coin_type, pagination_filter }) +/// client.coins(owner, coin_type, pagination_filter) /// }); +/// /// while let Some(result) = stream.next().await { /// match result { /// Ok(coin) => println!("Got coin: {:?}", coin), diff --git a/crates/sui-transaction-builder/src/lib.rs b/crates/sui-transaction-builder/src/lib.rs index 86b79ce5a..5aa82376e 100644 --- a/crates/sui-transaction-builder/src/lib.rs +++ b/crates/sui-transaction-builder/src/lib.rs @@ -27,7 +27,7 @@ use sui_types::Upgrade; use base64ct::Encoding; use serde::Serialize; -/// A builder for creating transactions. Use [`resolve`] to finalize the transaction data. +/// A builder for creating transactions. Use `resolve` to finalize the transaction data. #[derive(Clone, Default, Debug)] pub struct TransactionBuilder { /// The inputs to the transaction. @@ -95,7 +95,7 @@ impl TransactionBuilder { /// Add one or more gas objects to use to pay for the transaction. /// - /// Most commonly the gas can be passed as a reference to an owned/immutable [`Object`], + /// Most commonly the gas can be passed as a reference to an owned/immutable `Object`, /// or can created using one of the of the constructors of the [`unresolved::Input`] enum, /// e.g., [`unresolved::Input::owned`]. pub fn add_gas_objects(&mut self, gas: I) @@ -227,7 +227,7 @@ impl TransactionBuilder { /// /// let mut tx = TransactionBuilder::new(); /// let package_id = "0x...".parse().unwrap(); - /// let upgrade_cap = tx.input(unresolved::Input::by_id("0x...".parse().unwrap()); + /// let upgrade_cap = tx.input(unresolved::Input::by_id("0x...".parse().unwrap())); /// let upgrade_policy = tx.input(Serialized(&0u8)); /// // the digest of the new package that was compiled /// let package_digest: &[u8] = &[ @@ -286,7 +286,7 @@ impl TransactionBuilder { } /// Assuming everything is resolved, convert this transaction into the - /// resolved form. Returns a [`Transaction`] if successful, or an [`Error`] if not. + /// resolved form. Returns a [`Transaction`] if successful, or an `Error` if not. pub fn finish(self) -> Result { let Some(sender) = self.sender else { return Err(Error::MissingSender);