Skip to content

Commit

Permalink
Fix rendering of documentation on docs.rs (#807)
Browse files Browse the repository at this point in the history
* Fix rendering of documentation on docs.rs

* Add workflow to build docs on nightly (with same config as docs.rs)

* Update changelog

* Fix doc build errors and allow warnings in generated files

* Fix some more non-autolinks

* Fix more clippy warnings

* Formatting

* Fix last remaining comment
  • Loading branch information
romac authored Feb 10, 2021
1 parent 1a66290 commit e964b1a
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 10 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,18 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
env:
RUSTFLAGS: "--cfg docsrs"
with:
command: doc
args: --all-features
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

* `[tendermint-proto]` Fix panic in evidence serialization in the case where we
receive an empty evidence Protobuf structure ([#782])
* `[light-node]` Upgrade `jsonrpc` dependency to v17.0 to fix security
* `[tendermint-light-node]` Upgrade `jsonrpc` dependency to v17.0 to fix security
vulnerability in `hyper` v0.12.35 ([#803])
* `[tendermint-light-client]` Fix Fix rendering of documentation on docs.rs ([#806])

[#782]: https://github.com/informalsystems/tendermint-rs/issues/782
[#803]: https://github.com/informalsystems/tendermint-rs/issues/803
[#806]: https://github.com/informalsystems/tendermint-rs/issues/806

## v0.18.0

Expand Down
1 change: 1 addition & 0 deletions light-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
html_root_url = "https://docs.rs/tendermint-light-client/0.18.0",
html_logo_url = "https://raw.githubusercontent.com/informalsystems/tendermint-rs/master/img/logo-tendermint-rs_3961x4001.png"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

//! See the `light_client` module for the main documentation.

Expand Down
2 changes: 1 addition & 1 deletion light-client/tests/model_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ fn model_based_test(
match run_apalache_test(env.current_dir(), test) {
Ok(run) => match run {
ApalacheRun::Counterexample(_) => (),
run => panic!(run.message().to_string()),
run => panic!("{}", run.message()),
},
Err(e) => panic!("failed to run Apalache; reason: {}", e),
}
Expand Down
4 changes: 3 additions & 1 deletion proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#![forbid(unsafe_code)]
#![doc(html_root_url = "https://docs.rs/tendermint-proto/0.18.0")]

// Built-in prost_types with slight customization to enable JSON-encoding
/// Built-in prost_types with slight customization to enable JSON-encoding
#[allow(warnings)]
pub mod google {
pub mod protobuf {
include!("prost/google.protobuf.rs");
Expand All @@ -14,6 +15,7 @@ pub mod google {
}
}

#[allow(warnings)]
mod tendermint;
pub use tendermint::*;

Expand Down
2 changes: 1 addition & 1 deletion proto/src/serializers/part_set_header_total.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! The deserializer is created for backwards compatibility: `total` was changed from a
//! string-quoted integer value into an integer value without quotes in Tendermint Core v0.34.0.
//! This deserializer allows backwards-compatibility by deserializing both ways.
//! See also: https://github.com/informalsystems/tendermint-rs/issues/679
//! See also: <https://github.com/informalsystems/tendermint-rs/issues/679>
use serde::{de::Error, de::Visitor, Deserializer, Serialize, Serializer};
use std::convert::TryFrom;
use std::fmt::Formatter;
Expand Down
4 changes: 2 additions & 2 deletions rpc/src/endpoint/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use subtle_encoding::hex;
use tendermint::block::{Height, Round};
use tendermint::{account, hash, vote, Hash, Time};

// From https://github.com/tendermint/tendermint/blob/e820e68acd69737cfb63bc9ccca5f5450a42b5cf/types/vote.go#L16
// From <https://github.com/tendermint/tendermint/blob/e820e68acd69737cfb63bc9ccca5f5450a42b5cf/types/vote.go#L16>
const NIL_VOTE_STR: &str = "nil-Vote";

/// Get the current consensus state.
Expand All @@ -35,7 +35,7 @@ impl crate::SimpleRequest for Request {}

/// The current consensus state (UNSTABLE).
///
/// Currently based on https://github.com/tendermint/tendermint/blob/e820e68acd69737cfb63bc9ccca5f5450a42b5cf/consensus/types/round_state.go#L97
/// Currently based on <https://github.com/tendermint/tendermint/blob/e820e68acd69737cfb63bc9ccca5f5450a42b5cf/consensus/types/round_state.go#L97>
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub round_state: RoundState,
Expand Down
4 changes: 2 additions & 2 deletions tendermint/src/block/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ pub const PREFIX_LENGTH: usize = 10;
/// <https://github.com/tendermint/spec/blob/d46cd7f573a2c6a2399fcab2cde981330aa63f37/spec/core/data_structures.md#blockid>
///
/// Default implementation is an empty Id as defined by the Go implementation in
/// https://github.com/tendermint/tendermint/blob/1635d1339c73ae6a82e062cd2dc7191b029efa14/types/block.go#L1204 .
/// <https://github.com/tendermint/tendermint/blob/1635d1339c73ae6a82e062cd2dc7191b029efa14/types/block.go#L1204>.
///
/// If the Hash is empty in BlockId, the BlockId should be empty (encoded to None).
/// This is implemented outside of this struct. Use the Default trait to check for an empty BlockId.
/// See: https://github.com/informalsystems/tendermint-rs/issues/663
/// See: <https://github.com/informalsystems/tendermint-rs/issues/663>
#[derive(
Serialize, Deserialize, Copy, Clone, Debug, Default, Hash, Eq, PartialEq, PartialOrd, Ord,
)]
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/evidence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl From<Params> for RawEvidenceParams {
/// essentially, to keep the usages look cleaner
/// i.e. you can avoid using serde annotations everywhere
/// Todo: harmonize google::protobuf::Duration, std::time::Duration and this. Too many structs.
/// https://github.com/informalsystems/tendermint-rs/issues/741
/// <https://github.com/informalsystems/tendermint-rs/issues/741>
#[derive(Copy, Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct Duration(#[serde(with = "serializers::time_duration")] pub std::time::Duration);

Expand Down
2 changes: 1 addition & 1 deletion testgen/src/light_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tendermint::{block::signed_header::SignedHeader, Hash};
/// It records everything the light client needs to know about a block.
/// NOTE: This struct & associated `impl` below are a copy of light-client's `LightBlock`.
/// The copy is necessary here to avoid a circular dependency.
/// Cf. https://github.com/informalsystems/tendermint-rs/issues/605
/// Cf. <https://github.com/informalsystems/tendermint-rs/issues/605>
/// TODO: fix redundant code without introducing cyclic dependency.
///
/// To convert `TMLightBlock` to the Domain type `LightBlock` used in light-client crate
Expand Down

0 comments on commit e964b1a

Please sign in to comment.