From 2d7e14f5134e469a8be7f9ee0232ca89bf40770b Mon Sep 17 00:00:00 2001 From: tottoto Date: Thu, 5 Jan 2023 04:20:24 +0900 Subject: [PATCH] chore: Fix doc warning (#1214) * chore(docs): Fix lint warning * chore: Add ci to check cargo doc --- .github/workflows/CI.yml | 20 ++++++++++++++++++++ tonic-reflection/src/lib.rs | 1 + tonic-types/src/lib.rs | 1 + tonic/src/metadata/map.rs | 8 ++++---- tonic/src/metadata/value.rs | 8 ++++---- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b9246a9..0b293da 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -39,6 +39,26 @@ jobs: - name: Check all targets run: cargo check --all --all-targets --all-features + check-docs: + name: check docs + runs-on: ubuntu-latest + + env: + RUSTFLAGS: "-D warnings" + + steps: + - uses: actions/checkout@v3 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: hecrj/setup-rust-action@v1 + with: + rust-version: "1.60" + - uses: Swatinem/rust-cache@v2 + - name: cargo doc + run: cargo doc --workspace --no-deps --exclude examples + clippy: name: cargo clippy runs-on: ubuntu-latest diff --git a/tonic-reflection/src/lib.rs b/tonic-reflection/src/lib.rs index 615e48f..a7938b5 100644 --- a/tonic-reflection/src/lib.rs +++ b/tonic-reflection/src/lib.rs @@ -19,6 +19,7 @@ pub mod proto { #![allow(unreachable_pub)] #![allow(missing_docs)] + #![allow(rustdoc::invalid_html_tags)] include!("generated/grpc.reflection.v1alpha.rs"); pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/reflection_v1alpha1.bin"); diff --git a/tonic-types/src/lib.rs b/tonic-types/src/lib.rs index 7f2f03b..556661b 100644 --- a/tonic-types/src/lib.rs +++ b/tonic-types/src/lib.rs @@ -23,6 +23,7 @@ /// Useful protobuf types pub mod pb { + #![allow(rustdoc::invalid_html_tags)] include!("generated/google.rpc.rs"); /// Byte encoded FILE_DESCRIPTOR_SET. diff --git a/tonic/src/metadata/map.rs b/tonic/src/metadata/map.rs index 3c7820c..d1222ce 100644 --- a/tonic/src/metadata/map.rs +++ b/tonic/src/metadata/map.rs @@ -958,7 +958,7 @@ impl MetadataMap { /// use `insert_bin`. /// /// This method panics when the given key is a string and it cannot be - /// converted to a MetadataKey. + /// converted to a `MetadataKey`. /// /// If the map did not previously have this key present, then `None` is /// returned. @@ -1008,7 +1008,7 @@ impl MetadataMap { /// Like insert, but for Binary keys (for example "trace-proto-bin"). /// /// This method panics when the given key is a string and it cannot be - /// converted to a MetadataKey. + /// converted to a `MetadataKey`. /// /// # Examples /// @@ -1050,7 +1050,7 @@ impl MetadataMap { /// use `append_bin`. /// /// This method panics when the given key is a string and it cannot be - /// converted to a MetadataKey. + /// converted to a `MetadataKey`. /// /// If the map did not previously have this key present, then `false` is /// returned. @@ -1099,7 +1099,7 @@ impl MetadataMap { /// Like append, but for binary keys (for example "trace-proto-bin"). /// /// This method panics when the given key is a string and it cannot be - /// converted to a MetadataKey. + /// converted to a `MetadataKey`. /// /// # Examples /// diff --git a/tonic/src/metadata/value.rs b/tonic/src/metadata/value.rs index 31bcd4d..7389309 100644 --- a/tonic/src/metadata/value.rs +++ b/tonic/src/metadata/value.rs @@ -124,7 +124,7 @@ impl MetadataValue { } /// Convert a `Bytes` directly into a `MetadataValue` without validating. - /// For MetadataValue the provided parameter must be base64 + /// For `MetadataValue` the provided parameter must be base64 /// encoded without padding bytes at the end. /// /// # Safety @@ -459,7 +459,7 @@ impl MetadataValue { src.parse() } - /// Converts a MetadataKey into a MetadataValue. + /// Converts a MetadataKey into a `MetadataValue`. /// /// Since every valid MetadataKey is a valid MetadataValue this is done /// infallibly. @@ -478,9 +478,9 @@ impl MetadataValue { /// Returns the length of `self`, in bytes. /// - /// This method is not available for MetadataValue because that + /// This method is not available for `MetadataValue` because that /// cannot be implemented in constant time, which most people would probably - /// expect. To get the length of MetadataValue, convert it to a + /// expect. To get the length of `MetadataValue`, convert it to a /// Bytes value and measure its length. /// /// # Examples