Skip to content

Commit 3c1c896

Browse files
committed
blanket_traits: remove crate:: in a bunch of places
1 parent 9280609 commit 3c1c896

File tree

9 files changed

+44
-46
lines changed

9 files changed

+44
-46
lines changed

src/descriptor/bare.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ use crate::policy::{semantic, Liftable};
2222
use crate::prelude::*;
2323
use crate::util::{varint_len, witness_to_scriptsig};
2424
use crate::{
25-
BareCtx, Error, ForEachKey, Miniscript, MiniscriptKey, Satisfier, ToPublicKey, TranslateErr,
26-
TranslatePk, Translator,
25+
BareCtx, Error, ForEachKey, FromStrKey, Miniscript, MiniscriptKey, Satisfier, ToPublicKey,
26+
TranslateErr, TranslatePk, Translator,
2727
};
2828

2929
/// Create a Bare Descriptor. That is descriptor that is
@@ -166,15 +166,15 @@ impl<Pk: MiniscriptKey> Liftable<Pk> for Bare<Pk> {
166166
fn lift(&self) -> Result<semantic::Policy<Pk>, Error> { self.ms.lift() }
167167
}
168168

169-
impl<Pk: crate::FromStrKey> FromTree for Bare<Pk> {
169+
impl<Pk: FromStrKey> FromTree for Bare<Pk> {
170170
fn from_tree(top: &expression::Tree) -> Result<Self, Error> {
171171
let sub = Miniscript::<Pk, BareCtx>::from_tree(top)?;
172172
BareCtx::top_level_checks(&sub)?;
173173
Bare::new(sub)
174174
}
175175
}
176176

177-
impl<Pk: crate::FromStrKey> core::str::FromStr for Bare<Pk> {
177+
impl<Pk: FromStrKey> core::str::FromStr for Bare<Pk> {
178178
type Err = Error;
179179
fn from_str(s: &str) -> Result<Self, Self::Err> {
180180
let desc_str = verify_checksum(s)?;
@@ -364,7 +364,7 @@ impl<Pk: MiniscriptKey> Liftable<Pk> for Pkh<Pk> {
364364
}
365365
}
366366

367-
impl<Pk: crate::FromStrKey> FromTree for Pkh<Pk> {
367+
impl<Pk: FromStrKey> FromTree for Pkh<Pk> {
368368
fn from_tree(top: &expression::Tree) -> Result<Self, Error> {
369369
if top.name == "pkh" && top.args.len() == 1 {
370370
Ok(Pkh::new(expression::terminal(&top.args[0], |pk| Pk::from_str(pk))?)?)
@@ -378,7 +378,7 @@ impl<Pk: crate::FromStrKey> FromTree for Pkh<Pk> {
378378
}
379379
}
380380

381-
impl<Pk: crate::FromStrKey> core::str::FromStr for Pkh<Pk> {
381+
impl<Pk: FromStrKey> core::str::FromStr for Pkh<Pk> {
382382
type Err = Error;
383383
fn from_str(s: &str) -> Result<Self, Self::Err> {
384384
let desc_str = verify_checksum(s)?;

src/descriptor/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ use crate::miniscript::{satisfy, Legacy, Miniscript, Segwitv0};
2525
use crate::plan::{AssetProvider, Plan};
2626
use crate::prelude::*;
2727
use crate::{
28-
expression, hash256, BareCtx, Error, ForEachKey, MiniscriptKey, Satisfier, ToPublicKey,
29-
TranslateErr, TranslatePk, Translator,
28+
expression, hash256, BareCtx, Error, ForEachKey, FromStrKey, MiniscriptKey, Satisfier,
29+
ToPublicKey, TranslateErr, TranslatePk, Translator,
3030
};
3131

3232
mod bare;
@@ -918,7 +918,7 @@ impl Descriptor<DefiniteDescriptorKey> {
918918
}
919919
}
920920

921-
impl<Pk: crate::FromStrKey> crate::expression::FromTree for Descriptor<Pk> {
921+
impl<Pk: FromStrKey> crate::expression::FromTree for Descriptor<Pk> {
922922
/// Parse an expression tree into a descriptor.
923923
fn from_tree(top: &expression::Tree) -> Result<Descriptor<Pk>, Error> {
924924
Ok(match (top.name, top.args.len() as u32) {
@@ -932,7 +932,7 @@ impl<Pk: crate::FromStrKey> crate::expression::FromTree for Descriptor<Pk> {
932932
}
933933
}
934934

935-
impl<Pk: crate::FromStrKey> FromStr for Descriptor<Pk> {
935+
impl<Pk: FromStrKey> FromStr for Descriptor<Pk> {
936936
type Err = Error;
937937
fn from_str(s: &str) -> Result<Descriptor<Pk>, Error> {
938938
// tr tree parsing has special code

src/descriptor/segwitv0.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use crate::policy::{semantic, Liftable};
2020
use crate::prelude::*;
2121
use crate::util::varint_len;
2222
use crate::{
23-
Error, ForEachKey, Miniscript, MiniscriptKey, Satisfier, Segwitv0, ToPublicKey, TranslateErr,
24-
TranslatePk, Translator,
23+
Error, ForEachKey, FromStrKey, Miniscript, MiniscriptKey, Satisfier, Segwitv0, ToPublicKey,
24+
TranslateErr, TranslatePk, Translator,
2525
};
2626
/// A Segwitv0 wsh descriptor
2727
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
@@ -231,7 +231,7 @@ impl<Pk: MiniscriptKey> Liftable<Pk> for Wsh<Pk> {
231231
}
232232
}
233233

234-
impl<Pk: crate::FromStrKey> crate::expression::FromTree for Wsh<Pk> {
234+
impl<Pk: FromStrKey> crate::expression::FromTree for Wsh<Pk> {
235235
fn from_tree(top: &expression::Tree) -> Result<Self, Error> {
236236
if top.name == "wsh" && top.args.len() == 1 {
237237
let top = &top.args[0];
@@ -269,7 +269,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Wsh<Pk> {
269269
}
270270
}
271271

272-
impl<Pk: crate::FromStrKey> core::str::FromStr for Wsh<Pk> {
272+
impl<Pk: FromStrKey> core::str::FromStr for Wsh<Pk> {
273273
type Err = Error;
274274
fn from_str(s: &str) -> Result<Self, Self::Err> {
275275
let desc_str = verify_checksum(s)?;
@@ -473,7 +473,7 @@ impl<Pk: MiniscriptKey> Liftable<Pk> for Wpkh<Pk> {
473473
}
474474
}
475475

476-
impl<Pk: crate::FromStrKey> crate::expression::FromTree for Wpkh<Pk> {
476+
impl<Pk: FromStrKey> crate::expression::FromTree for Wpkh<Pk> {
477477
fn from_tree(top: &expression::Tree) -> Result<Self, Error> {
478478
if top.name == "wpkh" && top.args.len() == 1 {
479479
Ok(Wpkh::new(expression::terminal(&top.args[0], |pk| Pk::from_str(pk))?)?)
@@ -487,7 +487,7 @@ impl<Pk: crate::FromStrKey> crate::expression::FromTree for Wpkh<Pk> {
487487
}
488488
}
489489

490-
impl<Pk: crate::FromStrKey> core::str::FromStr for Wpkh<Pk> {
490+
impl<Pk: FromStrKey> core::str::FromStr for Wpkh<Pk> {
491491
type Err = Error;
492492
fn from_str(s: &str) -> Result<Self, Self::Err> {
493493
let desc_str = verify_checksum(s)?;

src/descriptor/sh.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use crate::policy::{semantic, Liftable};
2424
use crate::prelude::*;
2525
use crate::util::{varint_len, witness_to_scriptsig};
2626
use crate::{
27-
push_opcode_size, Error, ForEachKey, Legacy, Miniscript, MiniscriptKey, Satisfier, Segwitv0,
28-
ToPublicKey, TranslateErr, TranslatePk, Translator,
27+
push_opcode_size, Error, ForEachKey, FromStrKey, Legacy, Miniscript, MiniscriptKey, Satisfier,
28+
Segwitv0, ToPublicKey, TranslateErr, TranslatePk, Translator,
2929
};
3030

3131
/// A Legacy p2sh Descriptor
@@ -81,7 +81,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Sh<Pk> {
8181
}
8282
}
8383

84-
impl<Pk: crate::FromStrKey> crate::expression::FromTree for Sh<Pk> {
84+
impl<Pk: FromStrKey> crate::expression::FromTree for Sh<Pk> {
8585
fn from_tree(top: &expression::Tree) -> Result<Self, Error> {
8686
if top.name == "sh" && top.args.len() == 1 {
8787
let top = &top.args[0];
@@ -106,7 +106,7 @@ impl<Pk: crate::FromStrKey> crate::expression::FromTree for Sh<Pk> {
106106
}
107107
}
108108

109-
impl<Pk: crate::FromStrKey> core::str::FromStr for Sh<Pk> {
109+
impl<Pk: FromStrKey> core::str::FromStr for Sh<Pk> {
110110
type Err = Error;
111111
fn from_str(s: &str) -> Result<Self, Self::Err> {
112112
let desc_str = verify_checksum(s)?;

src/descriptor/tr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use crate::policy::Liftable;
2323
use crate::prelude::*;
2424
use crate::util::{varint_len, witness_size};
2525
use crate::{
26-
errstr, Error, ForEachKey, MiniscriptKey, Satisfier, ScriptContext, Tap, ToPublicKey,
27-
TranslateErr, TranslatePk, Translator,
26+
errstr, Error, ForEachKey, FromStrKey, MiniscriptKey, Satisfier, ScriptContext, Tap,
27+
ToPublicKey, TranslateErr, TranslatePk, Translator,
2828
};
2929

3030
/// A Taproot Tree representation.
@@ -467,7 +467,7 @@ where
467467
}
468468

469469
#[rustfmt::skip]
470-
impl<Pk: crate::FromStrKey> Tr<Pk> {
470+
impl<Pk: FromStrKey> Tr<Pk> {
471471
// Helper function to parse taproot script path
472472
fn parse_tr_script_spend(tree: &expression::Tree,) -> Result<TapTree<Pk>, Error> {
473473
match tree {
@@ -488,7 +488,7 @@ impl<Pk: crate::FromStrKey> Tr<Pk> {
488488
}
489489
}
490490

491-
impl<Pk: crate::FromStrKey> crate::expression::FromTree for Tr<Pk> {
491+
impl<Pk: FromStrKey> crate::expression::FromTree for Tr<Pk> {
492492
fn from_tree(top: &expression::Tree) -> Result<Self, Error> {
493493
if top.name == "tr" {
494494
match top.args.len() {
@@ -530,7 +530,7 @@ impl<Pk: crate::FromStrKey> crate::expression::FromTree for Tr<Pk> {
530530
}
531531
}
532532

533-
impl<Pk: crate::FromStrKey> core::str::FromStr for Tr<Pk> {
533+
impl<Pk: FromStrKey> core::str::FromStr for Tr<Pk> {
534534
type Err = Error;
535535
fn from_str(s: &str) -> Result<Self, Self::Err> {
536536
let desc_str = verify_checksum(s)?;

src/miniscript/astelem.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use crate::miniscript::{types, ScriptContext};
1919
use crate::prelude::*;
2020
use crate::util::MsKeyBuilder;
2121
use crate::{
22-
errstr, expression, AbsLockTime, Error, Miniscript, MiniscriptKey, Terminal, ToPublicKey,
22+
errstr, expression, AbsLockTime, Error, FromStrKey, Miniscript, MiniscriptKey, Terminal,
23+
ToPublicKey,
2324
};
2425

2526
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
@@ -240,15 +241,13 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> fmt::Display for Terminal<Pk, Ctx> {
240241
}
241242
}
242243

243-
impl<Pk: crate::FromStrKey, Ctx: ScriptContext> crate::expression::FromTree
244-
for Arc<Terminal<Pk, Ctx>>
245-
{
244+
impl<Pk: FromStrKey, Ctx: ScriptContext> crate::expression::FromTree for Arc<Terminal<Pk, Ctx>> {
246245
fn from_tree(top: &expression::Tree) -> Result<Arc<Terminal<Pk, Ctx>>, Error> {
247246
Ok(Arc::new(expression::FromTree::from_tree(top)?))
248247
}
249248
}
250249

251-
impl<Pk: crate::FromStrKey, Ctx: ScriptContext> crate::expression::FromTree for Terminal<Pk, Ctx> {
250+
impl<Pk: FromStrKey, Ctx: ScriptContext> crate::expression::FromTree for Terminal<Pk, Ctx> {
252251
fn from_tree(top: &expression::Tree) -> Result<Terminal<Pk, Ctx>, Error> {
253252
let (frag_name, frag_wrap) = super::split_expression_name(top.name)?;
254253
let unwrapped = match (frag_name, top.args.len()) {

src/miniscript/mod.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ use crate::miniscript::decode::Terminal;
4545
use crate::miniscript::types::extra_props::ExtData;
4646
use crate::miniscript::types::Type;
4747
use crate::{
48-
expression, plan, Error, ForEachKey, MiniscriptKey, ToPublicKey, TranslatePk, Translator,
48+
expression, plan, Error, ForEachKey, FromStrKey, MiniscriptKey, ToPublicKey, TranslatePk,
49+
Translator,
4950
};
5051
#[cfg(test)]
5152
mod ms_tests;
@@ -617,7 +618,7 @@ where
617618
Ok(ms)
618619
}
619620

620-
impl<Pk: crate::FromStrKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
621+
impl<Pk: FromStrKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
621622
/// Attempt to parse an insane(scripts don't clear sanity checks)
622623
/// from string into a Miniscript representation.
623624
/// Use this to parse scripts with repeated pubkeys, timelock mixing, malleable
@@ -648,17 +649,13 @@ impl<Pk: crate::FromStrKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
648649
}
649650
}
650651

651-
impl<Pk: crate::FromStrKey, Ctx: ScriptContext> crate::expression::FromTree
652-
for Arc<Miniscript<Pk, Ctx>>
653-
{
652+
impl<Pk: FromStrKey, Ctx: ScriptContext> crate::expression::FromTree for Arc<Miniscript<Pk, Ctx>> {
654653
fn from_tree(top: &expression::Tree) -> Result<Arc<Miniscript<Pk, Ctx>>, Error> {
655654
Ok(Arc::new(expression::FromTree::from_tree(top)?))
656655
}
657656
}
658657

659-
impl<Pk: crate::FromStrKey, Ctx: ScriptContext> crate::expression::FromTree
660-
for Miniscript<Pk, Ctx>
661-
{
658+
impl<Pk: FromStrKey, Ctx: ScriptContext> crate::expression::FromTree for Miniscript<Pk, Ctx> {
662659
/// Parse an expression tree into a Miniscript. As a general rule, this
663660
/// should not be called directly; rather go through the descriptor API.
664661
fn from_tree(top: &expression::Tree) -> Result<Miniscript<Pk, Ctx>, Error> {
@@ -667,7 +664,7 @@ impl<Pk: crate::FromStrKey, Ctx: ScriptContext> crate::expression::FromTree
667664
}
668665
}
669666

670-
impl<Pk: crate::FromStrKey, Ctx: ScriptContext> str::FromStr for Miniscript<Pk, Ctx> {
667+
impl<Pk: FromStrKey, Ctx: ScriptContext> str::FromStr for Miniscript<Pk, Ctx> {
671668
type Err = Error;
672669
/// Parse a Miniscript from string and perform sanity checks
673670
/// See [Miniscript::from_str_insane] to parse scripts from string that

src/policy/concrete.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::prelude::*;
2929
use crate::sync::Arc;
3030
#[cfg(all(doc, not(feature = "compiler")))]
3131
use crate::Descriptor;
32-
use crate::{errstr, AbsLockTime, Error, ForEachKey, MiniscriptKey, Translator};
32+
use crate::{errstr, AbsLockTime, Error, ForEachKey, FromStrKey, MiniscriptKey, Translator};
3333

3434
/// Maximum TapLeafs allowed in a compiled TapTree
3535
#[cfg(feature = "compiler")]
@@ -930,7 +930,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Policy<Pk> {
930930
}
931931
}
932932

933-
impl<Pk: crate::FromStrKey> str::FromStr for Policy<Pk> {
933+
impl<Pk: FromStrKey> str::FromStr for Policy<Pk> {
934934
type Err = Error;
935935
fn from_str(s: &str) -> Result<Policy<Pk>, Error> {
936936
expression::check_valid_chars(s)?;
@@ -945,7 +945,7 @@ impl<Pk: crate::FromStrKey> str::FromStr for Policy<Pk> {
945945
serde_string_impl_pk!(Policy, "a miniscript concrete policy");
946946

947947
#[rustfmt::skip]
948-
impl<Pk: crate::FromStrKey> Policy<Pk> {
948+
impl<Pk: FromStrKey> Policy<Pk> {
949949
/// Helper function for `from_tree` to parse subexpressions with
950950
/// names of the form x@y
951951
fn from_tree_prob(top: &expression::Tree, allow_prob: bool,)
@@ -1050,7 +1050,7 @@ impl<Pk: crate::FromStrKey> Policy<Pk> {
10501050
}
10511051
}
10521052

1053-
impl<Pk: crate::FromStrKey> expression::FromTree for Policy<Pk> {
1053+
impl<Pk: FromStrKey> expression::FromTree for Policy<Pk> {
10541054
fn from_tree(top: &expression::Tree) -> Result<Policy<Pk>, Error> {
10551055
Policy::from_tree_prob(top, false).map(|(_, result)| result)
10561056
}

src/policy/semantic.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ use super::ENTAILMENT_MAX_TERMINALS;
1515
use crate::iter::{Tree, TreeLike};
1616
use crate::prelude::*;
1717
use crate::sync::Arc;
18-
use crate::{errstr, expression, AbsLockTime, Error, ForEachKey, MiniscriptKey, Translator};
18+
use crate::{
19+
errstr, expression, AbsLockTime, Error, ForEachKey, FromStrKey, MiniscriptKey, Translator,
20+
};
1921

2022
/// Abstract policy which corresponds to the semantics of a miniscript and
2123
/// which allows complex forms of analysis, e.g. filtering and normalization.
@@ -308,7 +310,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Policy<Pk> {
308310
}
309311
}
310312

311-
impl<Pk: crate::FromStrKey> str::FromStr for Policy<Pk> {
313+
impl<Pk: FromStrKey> str::FromStr for Policy<Pk> {
312314
type Err = Error;
313315
fn from_str(s: &str) -> Result<Policy<Pk>, Error> {
314316
expression::check_valid_chars(s)?;
@@ -320,7 +322,7 @@ impl<Pk: crate::FromStrKey> str::FromStr for Policy<Pk> {
320322

321323
serde_string_impl_pk!(Policy, "a miniscript semantic policy");
322324

323-
impl<Pk: crate::FromStrKey> expression::FromTree for Policy<Pk> {
325+
impl<Pk: FromStrKey> expression::FromTree for Policy<Pk> {
324326
fn from_tree(top: &expression::Tree) -> Result<Policy<Pk>, Error> {
325327
match (top.name, top.args.len()) {
326328
("UNSATISFIABLE", 0) => Ok(Policy::Unsatisfiable),

0 commit comments

Comments
 (0)