Skip to content

Commit 68a7a40

Browse files
committed
clippy: a couple tiny fixes
Clippy prefers we do string slicing after conversion to bytes, not before, which may be more efficient (at least, in elimantes some panic paths which we know are impossible since our strings are ASCII, but the compiler probably doesn't). It also changes some nested lists in docs to use 1/2/3 numbering because that's what rustdoc recognizes (and clippy complains about weird indentation with the existing a/b/c sublist).
1 parent 00a6be5 commit 68a7a40

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/descriptor/checksum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn verify_checksum(s: &str) -> Result<&str, Error> {
112112
}
113113

114114
let mut eng = Engine::new();
115-
eng.input_unchecked(s[..last_hash_pos].as_bytes());
115+
eng.input_unchecked(&s.as_bytes()[..last_hash_pos]);
116116

117117
let expected = eng.checksum_chars();
118118

src/descriptor/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ impl Descriptor<DefiniteDescriptorKey> {
549549
/// Returns a plan if the provided assets are sufficient to produce a non-malleable satisfaction
550550
///
551551
/// If the assets aren't sufficient for generating a Plan, the descriptor is returned
552+
#[allow(clippy::result_large_err)] // our "error type" is the original descriptor
552553
pub fn plan<P>(self, provider: &P) -> Result<Plan, Self>
553554
where
554555
P: AssetProvider<DefiniteDescriptorKey>,
@@ -577,6 +578,7 @@ impl Descriptor<DefiniteDescriptorKey> {
577578
/// Returns a plan if the provided assets are sufficient to produce a malleable satisfaction
578579
///
579580
/// If the assets aren't sufficient for generating a Plan, the descriptor is returned
581+
#[allow(clippy::result_large_err)] // our "error type" is the original descriptor
580582
pub fn plan_mall<P>(self, provider: &P) -> Result<Plan, Self>
581583
where
582584
P: AssetProvider<DefiniteDescriptorKey>,

src/miniscript/analyzable.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use crate::{Miniscript, MiniscriptKey, ScriptContext, Terminal};
1818
/// This allows parsing miniscripts if
1919
/// 1. It is unsafe(does not require a digital signature to spend it)
2020
/// 2. It contains a unspendable path because of either
21-
/// a. Resource limitations
22-
/// b. Timelock Mixing
21+
/// 1. Resource limitations
22+
/// 2. Timelock Mixing
2323
/// 3. The script is malleable and thereby some of satisfaction weight
2424
/// guarantees are not satisfied.
2525
/// 4. It has repeated public keys
@@ -124,8 +124,8 @@ impl ExtParams {
124124
/// We currently mark Miniscript as Non-Analyzable if
125125
/// 1. It is unsafe(does not require a digital signature to spend it)
126126
/// 2. It contains a unspendable path because of either
127-
/// a. Resource limitations
128-
/// b. Timelock Mixing
127+
/// 1. Resource limitations
128+
/// 2. Timelock Mixing
129129
/// 3. The script is malleable and thereby some of satisfaction weight
130130
/// guarantees are not satisfied.
131131
/// 4. It has repeated publickeys

src/psbt/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ pub trait PsbtExt {
480480
/// Returns a tuple containing
481481
/// - Original psbt
482482
/// - Input Error detailing why the input finalization failed
483+
#[allow(clippy::result_large_err)] // our "error type" includes the original PSBT
483484
fn finalize_inp<C: secp256k1::Verification>(
484485
self,
485486
secp: &secp256k1::Secp256k1<C>,
@@ -494,6 +495,7 @@ pub trait PsbtExt {
494495
) -> Result<(), Error>;
495496

496497
/// Same as [`PsbtExt::finalize_inp`], but allows for malleable satisfactions
498+
#[allow(clippy::result_large_err)] // our "error type" includes the original PSBT
497499
fn finalize_inp_mall<C: secp256k1::Verification>(
498500
self,
499501
secp: &secp256k1::Secp256k1<C>,

0 commit comments

Comments
 (0)