Skip to content

Commit 2d7e14f

Browse files
authored
chore: Fix doc warning (#1214)
* chore(docs): Fix lint warning * chore: Add ci to check cargo doc
1 parent 3ee1e6c commit 2d7e14f

File tree

5 files changed

+30
-8
lines changed

5 files changed

+30
-8
lines changed

.github/workflows/CI.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ jobs:
3939
- name: Check all targets
4040
run: cargo check --all --all-targets --all-features
4141

42+
check-docs:
43+
name: check docs
44+
runs-on: ubuntu-latest
45+
46+
env:
47+
RUSTFLAGS: "-D warnings"
48+
49+
steps:
50+
- uses: actions/checkout@v3
51+
- name: Install Protoc
52+
uses: arduino/setup-protoc@v1
53+
with:
54+
repo-token: ${{ secrets.GITHUB_TOKEN }}
55+
- uses: hecrj/setup-rust-action@v1
56+
with:
57+
rust-version: "1.60"
58+
- uses: Swatinem/rust-cache@v2
59+
- name: cargo doc
60+
run: cargo doc --workspace --no-deps --exclude examples
61+
4262
clippy:
4363
name: cargo clippy
4464
runs-on: ubuntu-latest

tonic-reflection/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
pub mod proto {
2020
#![allow(unreachable_pub)]
2121
#![allow(missing_docs)]
22+
#![allow(rustdoc::invalid_html_tags)]
2223
include!("generated/grpc.reflection.v1alpha.rs");
2324

2425
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/reflection_v1alpha1.bin");

tonic-types/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
/// Useful protobuf types
2525
pub mod pb {
26+
#![allow(rustdoc::invalid_html_tags)]
2627
include!("generated/google.rpc.rs");
2728

2829
/// Byte encoded FILE_DESCRIPTOR_SET.

tonic/src/metadata/map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ impl MetadataMap {
958958
/// use `insert_bin`.
959959
///
960960
/// This method panics when the given key is a string and it cannot be
961-
/// converted to a MetadataKey<Ascii>.
961+
/// converted to a `MetadataKey<Ascii>`.
962962
///
963963
/// If the map did not previously have this key present, then `None` is
964964
/// returned.
@@ -1008,7 +1008,7 @@ impl MetadataMap {
10081008
/// Like insert, but for Binary keys (for example "trace-proto-bin").
10091009
///
10101010
/// This method panics when the given key is a string and it cannot be
1011-
/// converted to a MetadataKey<Binary>.
1011+
/// converted to a `MetadataKey<Binary>`.
10121012
///
10131013
/// # Examples
10141014
///
@@ -1050,7 +1050,7 @@ impl MetadataMap {
10501050
/// use `append_bin`.
10511051
///
10521052
/// This method panics when the given key is a string and it cannot be
1053-
/// converted to a MetadataKey<Ascii>.
1053+
/// converted to a `MetadataKey<Ascii>`.
10541054
///
10551055
/// If the map did not previously have this key present, then `false` is
10561056
/// returned.
@@ -1099,7 +1099,7 @@ impl MetadataMap {
10991099
/// Like append, but for binary keys (for example "trace-proto-bin").
11001100
///
11011101
/// This method panics when the given key is a string and it cannot be
1102-
/// converted to a MetadataKey<Binary>.
1102+
/// converted to a `MetadataKey<Binary>`.
11031103
///
11041104
/// # Examples
11051105
///

tonic/src/metadata/value.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<VE: ValueEncoding> MetadataValue<VE> {
124124
}
125125

126126
/// Convert a `Bytes` directly into a `MetadataValue` without validating.
127-
/// For MetadataValue<Binary> the provided parameter must be base64
127+
/// For `MetadataValue<Binary>` the provided parameter must be base64
128128
/// encoded without padding bytes at the end.
129129
///
130130
/// # Safety
@@ -459,7 +459,7 @@ impl MetadataValue<Ascii> {
459459
src.parse()
460460
}
461461

462-
/// Converts a MetadataKey into a MetadataValue<Ascii>.
462+
/// Converts a MetadataKey into a `MetadataValue<Ascii>`.
463463
///
464464
/// Since every valid MetadataKey is a valid MetadataValue this is done
465465
/// infallibly.
@@ -478,9 +478,9 @@ impl MetadataValue<Ascii> {
478478

479479
/// Returns the length of `self`, in bytes.
480480
///
481-
/// This method is not available for MetadataValue<Binary> because that
481+
/// This method is not available for `MetadataValue<Binary>` because that
482482
/// cannot be implemented in constant time, which most people would probably
483-
/// expect. To get the length of MetadataValue<Binary>, convert it to a
483+
/// expect. To get the length of `MetadataValue<Binary>`, convert it to a
484484
/// Bytes value and measure its length.
485485
///
486486
/// # Examples

0 commit comments

Comments
 (0)