Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 91e2fc8

Browse files
committedAug 7, 2023
Take advantage of shorter generic Key
Now we have `Key` instead of `MiniscriptKey` we can take advantage of the shorter name to inline the where clauses when appropriate.
1 parent 498a2cf commit 91e2fc8

File tree

6 files changed

+8
-40
lines changed

6 files changed

+8
-40
lines changed
 

‎src/descriptor/bare.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,7 @@ impl<Pk: Key> ForEachKey<Pk> for Bare<Pk> {
180180
}
181181
}
182182

183-
impl<P, Q> TranslatePk<P, Q> for Bare<P>
184-
where
185-
P: Key,
186-
Q: Key,
187-
{
183+
impl<P: Key, Q: Key> TranslatePk<P, Q> for Bare<P> {
188184
type Output = Bare<Q>;
189185

190186
fn translate_pk<T, E>(&self, t: &mut T) -> Result<Bare<Q>, TranslateErr<E>>
@@ -365,11 +361,7 @@ impl<Pk: Key> ForEachKey<Pk> for Pkh<Pk> {
365361
}
366362
}
367363

368-
impl<P, Q> TranslatePk<P, Q> for Pkh<P>
369-
where
370-
P: Key,
371-
Q: Key,
372-
{
364+
impl<P: Key, Q: Key> TranslatePk<P, Q> for Pkh<P> {
373365
type Output = Pkh<Q>;
374366

375367
fn translate_pk<T, E>(&self, t: &mut T) -> Result<Self::Output, TranslateErr<E>>

‎src/descriptor/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,7 @@ impl<Pk: Key + ToPublicKey> Descriptor<Pk> {
509509
}
510510
}
511511

512-
impl<P, Q> TranslatePk<P, Q> for Descriptor<P>
513-
where
514-
P: Key,
515-
Q: Key,
516-
{
512+
impl<P: Key, Q: Key> TranslatePk<P, Q> for Descriptor<P> {
517513
type Output = Descriptor<Q>;
518514

519515
/// Converts a descriptor using abstract keys to one using specific keys.

‎src/descriptor/segwitv0.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,7 @@ impl<Pk: Key> ForEachKey<Pk> for Wsh<Pk> {
274274
}
275275
}
276276

277-
impl<P, Q> TranslatePk<P, Q> for Wsh<P>
278-
where
279-
P: Key,
280-
Q: Key,
281-
{
277+
impl<P: Key, Q: Key> TranslatePk<P, Q> for Wsh<P> {
282278
type Output = Wsh<Q>;
283279

284280
fn translate_pk<T, E>(&self, t: &mut T) -> Result<Self::Output, TranslateErr<E>>
@@ -472,11 +468,7 @@ impl<Pk: Key> ForEachKey<Pk> for Wpkh<Pk> {
472468
}
473469
}
474470

475-
impl<P, Q> TranslatePk<P, Q> for Wpkh<P>
476-
where
477-
P: Key,
478-
Q: Key,
479-
{
471+
impl<P: Key, Q: Key> TranslatePk<P, Q> for Wpkh<P> {
480472
type Output = Wpkh<Q>;
481473

482474
fn translate_pk<T, E>(&self, t: &mut T) -> Result<Self::Output, TranslateErr<E>>

‎src/descriptor/sh.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,7 @@ impl<Pk: Key> ForEachKey<Pk> for Sh<Pk> {
429429
}
430430
}
431431

432-
impl<P, Q> TranslatePk<P, Q> for Sh<P>
433-
where
434-
P: Key,
435-
Q: Key,
436-
{
432+
impl<P: Key, Q: Key> TranslatePk<P, Q> for Sh<P> {
437433
type Output = Sh<Q>;
438434

439435
fn translate_pk<T, E>(&self, t: &mut T) -> Result<Self::Output, TranslateErr<E>>

‎src/descriptor/tr.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,7 @@ impl<Pk: Key> ForEachKey<Pk> for Tr<Pk> {
623623
}
624624
}
625625

626-
impl<P, Q> TranslatePk<P, Q> for Tr<P>
627-
where
628-
P: Key,
629-
Q: Key,
630-
{
626+
impl<P: Key, Q: Key> TranslatePk<P, Q> for Tr<P> {
631627
type Output = Tr<Q>;
632628

633629
fn translate_pk<T, E>(&self, translate: &mut T) -> Result<Self::Output, TranslateErr<E>>

‎src/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,7 @@ impl<E: fmt::Debug> fmt::Debug for TranslateErr<E> {
414414

415415
/// Converts a descriptor using abstract keys to one using specific keys. Uses translator `t` to do
416416
/// the actual translation function calls.
417-
pub trait TranslatePk<P, Q>
418-
where
419-
P: Key,
420-
Q: Key,
421-
{
417+
pub trait TranslatePk<P: Key, Q: Key> {
422418
/// The associated output type. This must be `Self<Q>`.
423419
type Output;
424420

0 commit comments

Comments
 (0)