Skip to content

Commit ad2eaac

Browse files
committed
clippy: fix doc_markdown lint
This one has a huge diff, and there's still a ton of work to do to clean up these docs, but it should be a big improvement.
1 parent 3f12046 commit ad2eaac

25 files changed

Lines changed: 256 additions & 255 deletions

src/address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl Address {
534534
}
535535

536536
/// Parse the address using the given parameters.
537-
/// When using the built-in parameters, you can use [FromStr].
537+
/// When using the built-in parameters, you can use [`FromStr`].
538538
pub fn parse_with_params(
539539
s: &str,
540540
params: &'static AddressParams,

src/blind.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub enum TxOutError {
3939
UnExpectedNullValue,
4040
/// Unexpected Null asset
4141
UnExpectedNullAsset,
42-
/// Money should be between 0 and 21_000_000
42+
/// Money should be between 0 and `21_000_000`
4343
MoneyOutofRange,
4444
/// Zero value explicit txout with non-provably unspendable script
4545
NonUnspendableZeroValue,
@@ -90,7 +90,7 @@ pub enum VerificationError {
9090
RangeProofError(usize, secp256k1_zkp::Error),
9191
/// Missing Range Proof
9292
RangeProofMissing(usize),
93-
/// Verification of SurjectionProof failed
93+
/// Verification of `SurjectionProof` failed
9494
SurjectionProofError(usize, secp256k1_zkp::Error),
9595
/// Surjection Proof verification error
9696
SurjectionProofVerificationError(usize),
@@ -165,7 +165,7 @@ pub enum ConfidentialTxOutError {
165165
NoBlindingKeyInAddress,
166166
/// Error originated in `secp256k1_zkp`.
167167
Upstream(secp256k1_zkp::Error),
168-
/// General TxOut errors
168+
/// General `TxOut` errors
169169
TxOutError(usize, TxOutError),
170170
/// Expected Explicit Asset for blinding
171171
ExpectedExplicitAsset,
@@ -264,7 +264,7 @@ impl TxOutSecrets {
264264

265265
/// Gets the surjection inputs from [`TxOutSecrets`].
266266
///
267-
/// Returns a tuple (assetid, blind_factor, generator) if the blinds are
267+
/// Returns a tuple `(assetid, blind_factor, generator)` if the blinds are
268268
/// consistent with asset commitment
269269
/// Otherwise, returns an error
270270
pub fn surjection_inputs<C: Signing>(&self, secp: &Secp256k1<C>) -> (Generator, Tag, Tweak) {
@@ -327,7 +327,7 @@ impl SurjectionInput {
327327
}
328328

329329
/// Handy method to convert [`SurjectionInput`] into a surjection target
330-
/// that can be used while creating a new [SurjectionProof].
330+
/// that can be used while creating a new [`SurjectionProof`].
331331
///
332332
/// Only errors when the input asset is Null.
333333
pub fn surjection_target<C: Signing>(
@@ -405,8 +405,8 @@ impl Value {
405405
///
406406
/// # Returns:
407407
///
408-
/// A pair of blinded value, nonce and corresponding proof as ([`Value`], [`Nonce`], [`RangeProof`])
409-
/// The nonce here refers to public key corresponding to the input `ephemeral_sk`
408+
/// * A pair of blinded value, nonce and corresponding proof as ([`Value`], [`Nonce`], [`RangeProof`])
409+
/// * The nonce here refers to public key corresponding to the input `ephemeral_sk`
410410
pub fn blind<C: Signing>(
411411
self,
412412
secp: &Secp256k1<C>,
@@ -424,7 +424,8 @@ impl Value {
424424
Ok((value_commit, nonce, rangeproof))
425425
}
426426

427-
/// Blinds with the given shared_secret(instead of computing it via ECDH)
427+
/// Blinds with the given `shared_secret` (instead of computing it via ECDH).
428+
///
428429
/// This is useful while blinding assets as there is no counter party to provide
429430
/// the blinding key.
430431
pub fn blind_with_shared_secret<C: Signing>(
@@ -466,15 +467,15 @@ impl TxOut {
466467
pub const RANGEPROOF_EXP_SHIFT: i32 = 0;
467468
/// Rangeproof Minimum private bits
468469
pub const RANGEPROOF_MIN_PRIV_BITS: u8 = 52;
469-
/// Maximum explicit amount in a bitcoin TxOut
470+
/// Maximum explicit amount in a bitcoin `TxOut`
470471
pub const MAX_MONEY: u64 = 21_000_000 * 100_000_000;
471472

472473
/// Creates a new confidential output that is **not** the last one in the transaction.
473474
/// Provide input secret information by creating [`SurjectionInput`] for each input.
474475
/// Inputs for issuances must be provided in the followed by inputs for input asset.
475476
///
476477
/// For example, if the second input contains non-null issuance and re-issuance tokens,
477-
/// the `spent_utxo_secrets` should be of the form [inp_1, inp_2, inp_2_issue, inp2_reissue,...]
478+
/// the `spent_utxo_secrets` should be of the form [`inp_1`, `inp_2`, `inp_2_issue`, `inp2_reissue`,...]
478479
///
479480
/// If the issuance or re-issuance is null, it should not be added to `spent_utxo_secrets`
480481
///
@@ -571,7 +572,7 @@ impl TxOut {
571572
Ok(txout)
572573
}
573574

574-
/// Convert a explicit TxOut into a Confidential TxOut.
575+
/// Convert a explicit `TxOut` into a Confidential `TxOut`.
575576
/// The blinding key is provided by the blinder parameter.
576577
/// The initial value of nonce is ignored and is set to the ECDH pubkey
577578
/// sampled by the sender.
@@ -653,7 +654,7 @@ impl TxOut {
653654
///
654655
/// Inputs for issuances must be provided in the followed by inputs for input asset.
655656
/// For example, if the second input contains non-null issuance and re-issuance tokens,
656-
/// the `spent_utxo_secrets` should be of the form [inp_1, inp_2, inp_2_issue, inp2_reissue,...]
657+
/// the `spent_utxo_secrets` should be of the form [`inp_1`, `inp_2`, `inp_2_issue`, `inp2_reissue`,...]
657658
/// If the issuance or re-issuance is null, it should not be added to `spent_utxo_secrets`
658659
///
659660
/// # Returns:
@@ -693,7 +694,7 @@ impl TxOut {
693694
Ok((txout, out_abf, out_vbf, ephemeral_sk))
694695
}
695696

696-
/// Similar to [TxOut::new_last_confidential], but allows specifying the asset blinding factor
697+
/// Similar to [`TxOut::new_last_confidential`], but allows specifying the asset blinding factor
697698
/// and the ephemeral key. The value-blinding factor is computed adaptively
698699
#[allow(clippy::too_many_arguments)]
699700
pub fn with_secrets_last<R, C>(
@@ -892,7 +893,7 @@ impl TxIn {
892893
/// Blind issuances for this [`TxIn`]. Asset amount and token amount must be
893894
/// set in [`AssetIssuance`](crate::AssetIssuance) field for this input
894895
///
895-
/// Returns (issuance_blinding_factor, issue_blind_sec_key, token_blinding_factor, token_blind_sec_key)
896+
/// Returns (`issuance_blinding_factor`, `issue_blind_sec_key`, `token_blinding_factor`, `token_blind_sec_key`)
896897
pub fn blind_issuances<C: Signing, R: RngCore + CryptoRng>(
897898
&mut self,
898899
secp: &Secp256k1<C>,
@@ -937,9 +938,9 @@ impl Transaction {
937938
/// equation for Confidential transactions holds.
938939
/// i.e Sum of inputs = Sum of outputs + fees.
939940
/// And the corresponding surjection/rangeproofs are correct.
940-
/// For checking of surjection proofs and amounts, spent_utxos parameter
941+
/// For checking of surjection proofs and amounts, `spent_utxos` parameter
941942
/// should contain information about the prevouts. Note that the order of
942-
/// spent_utxos should be consistent with transaction inputs.
943+
/// `spent_utxos` should be consistent with transaction inputs.
943944
/// ## Examples
944945
///
945946
/// ```
@@ -1200,9 +1201,9 @@ pub enum BlindError {
12001201
TooFewBlindingOutputs,
12011202
/// All outputs must be explicit asset/amounts
12021203
MustHaveAllExplicitTxOuts,
1203-
/// General TxOut errors
1204+
/// General `TxOut` errors
12041205
ConfidentialTxOutError(ConfidentialTxOutError),
1205-
/// No Issuances to blind in this TxIn
1206+
/// No Issuances to blind in this `TxIn`
12061207
NoIssuanceToBlind,
12071208
/// Zero Value Blinding not allowed
12081209
ZeroValueBlindingNotAllowed,
@@ -1278,7 +1279,7 @@ pub trait BlindValueProofs: Sized {
12781279
}
12791280

12801281
impl BlindValueProofs for RangeProof {
1281-
/// Outputs a `[RangeProof]` that blinded value_commit
1282+
/// Outputs a [`RangeProof`] that blinded `value_commit`
12821283
/// corresponds to explicit value
12831284
fn blind_value_proof<C: secp256k1_zkp::Signing, R: RngCore + CryptoRng>(
12841285
rng: &mut R,

src/confidential.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Value {
100100
}
101101

102102
/// Returns the explicit inner value.
103-
/// Returns [None] if [Value::is_explicit] returns false.
103+
/// Returns [None] if [`Value::is_explicit`] returns false.
104104
pub fn explicit(&self) -> Option<u64> {
105105
match *self {
106106
Value::Explicit(i) => Some(i),
@@ -109,7 +109,7 @@ impl Value {
109109
}
110110

111111
/// Returns the confidential commitment in case of a confidential value.
112-
/// Returns [None] if [Value::is_confidential] returns false.
112+
/// Returns [None] if [`Value::is_confidential`] returns false.
113113
pub fn commitment(&self) -> Option<PedersenCommitment> {
114114
match *self {
115115
Value::Confidential(i) => Some(i),
@@ -302,7 +302,7 @@ impl Asset {
302302
}
303303

304304
/// Returns the explicit inner value.
305-
/// Returns [None] if [Asset::is_explicit] returns false.
305+
/// Returns [None] if [`Asset::is_explicit`] returns false.
306306
pub fn explicit(&self) -> Option<AssetId> {
307307
match *self {
308308
Asset::Explicit(i) => Some(i),
@@ -311,7 +311,7 @@ impl Asset {
311311
}
312312

313313
/// Returns the confidential commitment in case of a confidential value.
314-
/// Returns [None] if [Asset::is_confidential] returns false.
314+
/// Returns [None] if [`Asset::is_confidential`] returns false.
315315
pub fn commitment(&self) -> Option<Generator> {
316316
match *self {
317317
Asset::Confidential(i) => Some(i),
@@ -494,7 +494,7 @@ impl Nonce {
494494
Self::with_ephemeral_sk(secp, ephemeral_sk, receiver_blinding_pk)
495495
}
496496

497-
/// Similar to [Nonce::new_confidential], but with a given `ephemeral_sk`
497+
/// Similar to [`Nonce::new_confidential`], but with a given `ephemeral_sk`
498498
/// instead of sampling it from rng.
499499
pub fn with_ephemeral_sk<C: Signing>(
500500
secp: &Secp256k1<C>,
@@ -569,7 +569,7 @@ impl Nonce {
569569
}
570570

571571
/// Returns the explicit inner value.
572-
/// Returns [None] if [Nonce::is_explicit] returns false.
572+
/// Returns [None] if [`Nonce::is_explicit`] returns false.
573573
pub fn explicit(&self) -> Option<[u8; 32]> {
574574
match *self {
575575
Nonce::Explicit(i) => Some(i),
@@ -578,7 +578,7 @@ impl Nonce {
578578
}
579579

580580
/// Returns the confidential commitment in case of a confidential value.
581-
/// Returns [None] if [Nonce::is_confidential] returns false.
581+
/// Returns [None] if [`Nonce::is_confidential`] returns false.
582582
pub fn commitment(&self) -> Option<PublicKey> {
583583
match *self {
584584
Nonce::Confidential(i) => Some(i),
@@ -740,7 +740,7 @@ impl AssetBlindingFactor {
740740
self.0
741741
}
742742

743-
/// Get a unblinded/zero AssetBlinding factor
743+
/// Get a unblinded/zero `AssetBlinding` factor
744744
pub fn zero() -> Self {
745745
AssetBlindingFactor(ZERO_TWEAK)
746746
}
@@ -907,7 +907,7 @@ impl ValueBlindingFactor {
907907
self.0
908908
}
909909

910-
/// Get a unblinded/zero AssetBlinding factor
910+
/// Get a unblinded/zero `AssetBlinding` factor
911911
pub fn zero() -> Self {
912912
ValueBlindingFactor(ZERO_TWEAK)
913913
}

src/dynafed.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub struct FullParams {
9696
}
9797

9898
impl FullParams {
99-
/// Construct a set of FullParams
99+
/// Construct a set of `FullParams`
100100
pub fn new(
101101
signblockscript: Script,
102102
signblock_witness_limit: u32,
@@ -131,7 +131,7 @@ impl FullParams {
131131
crate::fast_merkle_root::fast_merkle_root(&leaves[..])
132132
}
133133

134-
/// Calculate the root of this [FullParams].
134+
/// Calculate the root of this [`FullParams`].
135135
pub fn calculate_root(&self) -> sha256::Midstate {
136136
fn serialize_hash<E: Encodable>(obj: &E) -> sha256d::Hash {
137137
let mut engine = sha256d::Hash::engine();
@@ -162,7 +162,7 @@ impl FullParams {
162162
}
163163
}
164164

165-
/// Format for [fmt::Debug].
165+
/// Format for [`fmt::Debug`].
166166
fn fmt_debug(&self, f: &mut fmt::Formatter, name: &'static str) -> fmt::Result {
167167
let mut s = f.debug_struct(name);
168168
s.field("signblockscript", &HexBytes(&self.signblockscript[..]));
@@ -253,7 +253,7 @@ impl fmt::Debug for Params {
253253
}
254254

255255
impl Params {
256-
/// Check whether this is [Params::Null].
256+
/// Check whether this is [`Params::Null`].
257257
pub fn is_null(&self) -> bool {
258258
match *self {
259259
Params::Null => true,
@@ -262,7 +262,7 @@ impl Params {
262262
}
263263
}
264264

265-
/// Check whether this is [Params::Compact].
265+
/// Check whether this is [`Params::Compact`].
266266
pub fn is_compact(&self) -> bool {
267267
match *self {
268268
Params::Null => false,
@@ -271,7 +271,7 @@ impl Params {
271271
}
272272
}
273273

274-
/// Check whether this is [Params::Full].
274+
/// Check whether this is [`Params::Full`].
275275
pub fn is_full(&self) -> bool {
276276
match *self {
277277
Params::Null => false,
@@ -280,7 +280,7 @@ impl Params {
280280
}
281281
}
282282

283-
/// Get the signblockscript. Is [None] for [Params::Null] params.
283+
/// Get the signblockscript. Is [None] for [`Params::Null`] params.
284284
pub fn signblockscript(&self) -> Option<&Script> {
285285
match *self {
286286
Params::Null => None,
@@ -289,7 +289,7 @@ impl Params {
289289
}
290290
}
291291

292-
/// Get the signblock_witness_limit. Is [None] for [Params::Null] params.
292+
/// Get the `signblock_witness_limit`. Is [None] for [`Params::Null`] params.
293293
pub fn signblock_witness_limit(&self) -> Option<u32> {
294294
match *self {
295295
Params::Null => None,
@@ -298,7 +298,7 @@ impl Params {
298298
}
299299
}
300300

301-
/// Get the fedpeg_program. Is [None] for non-[Params::Full] params.
301+
/// Get the `fedpeg_program`. Is [None] for non-[`Params::Full`] params.
302302
pub fn fedpeg_program(&self) -> Option<&bitcoin::ScriptBuf> {
303303
match *self {
304304
Params::Null => None,
@@ -307,7 +307,7 @@ impl Params {
307307
}
308308
}
309309

310-
/// Get the fedpegscript. Is [None] for non-[Params::Full] params.
310+
/// Get the fedpegscript. Is [None] for non-[`Params::Full`] params.
311311
pub fn fedpegscript(&self) -> Option<&Vec<u8>> {
312312
match *self {
313313
Params::Null => None,
@@ -316,7 +316,7 @@ impl Params {
316316
}
317317
}
318318

319-
/// Get the extension_space. Is [None] for non-[Params::Full] params.
319+
/// Get the `extension_space`. Is [None] for non-[`Params::Full`] params.
320320
pub fn extension_space(&self) -> Option<&Vec<Vec<u8>>> {
321321
match *self {
322322
Params::Null => None,
@@ -325,7 +325,7 @@ impl Params {
325325
}
326326
}
327327

328-
/// Get the elided_root. Is [None] for non-[Params::Compact] params.
328+
/// Get the `elided_root`. Is [None] for non-[`Params::Compact`] params.
329329
pub fn elided_root(&self) -> Option<&sha256::Midstate> {
330330
match *self {
331331
Params::Null => None,

src/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub enum Error {
5959
HexError(crate::hex::Error),
6060
/// Got a time-based locktime when expecting a height-based one, or vice-versa
6161
BadLockTime(crate::LockTime),
62-
/// VarInt was encoded in a non-minimal way.
62+
/// `VarInt` was encoded in a non-minimal way.
6363
NonMinimalVarInt,
6464
}
6565

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
pub use crate::parse::ParseIntError;
44

5-
/// Impls std::error::Error for the specified type with appropriate attributes, possibly returning
5+
/// Impls `std::error::Error` for the specified type with appropriate attributes, possibly returning
66
/// source.
77
macro_rules! impl_std_error {
88
// No source available

src/hash_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//! File defines types for hashes used throughout the library.
1616
//!
1717
//! These types are needed in order
18-
//! to avoid mixing data of the same hash format (like SHA256d) but of different meaning
18+
//! to avoid mixing data of the same hash format (like `SHA256d`) but of different meaning
1919
//! (transaction id, block hash etc).
2020
2121
use crate::hashes::{hash160, hash_newtype, sha256, sha256d, Hash};

src/internal_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ macro_rules! serde_string_impl {
211211
};
212212
}
213213

214-
/// A combination of serde_struct_impl and serde_string_impl where string is
214+
/// A combination of `serde_struct_impl` and `serde_string_impl` where string is
215215
/// used for human-readable serialization and struct is used for
216216
/// non-human-readable serialization.
217217
macro_rules! serde_struct_human_string_impl {

0 commit comments

Comments
 (0)