Skip to content

Commit

Permalink
Fix edition-idioms
Browse files Browse the repository at this point in the history
Run `cargo fix --edition-idioms`. This fixes uses of 'extern crate' and
also lifetimes that the compiler can infer.
  • Loading branch information
tcharding committed Apr 22, 2022
1 parent 4dbb0c1 commit 900ae8a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions examples/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

//! Example: Parsing a descriptor from a string
extern crate bitcoin;
extern crate miniscript;
use bitcoin;
use miniscript;

use miniscript::{descriptor::DescriptorType, Descriptor, DescriptorTrait};
use std::str::FromStr;
Expand Down
3 changes: 1 addition & 2 deletions examples/psbt.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate bitcoin;
extern crate miniscript;
use bitcoin;

use bitcoin::consensus::encode::deserialize;
use bitcoin::hashes::hex::FromHex;
Expand Down
4 changes: 2 additions & 2 deletions examples/sign_multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

//! Example: Signing a 2-of-3 multisignature
extern crate bitcoin;
extern crate miniscript;
use bitcoin;
use miniscript;

use bitcoin::blockdata::witness::Witness;
use bitcoin::secp256k1; // secp256k1 re-exported from rust-bitcoin
Expand Down
4 changes: 2 additions & 2 deletions examples/verify_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

//! Example: Verifying a signed transaction
extern crate bitcoin;
extern crate miniscript;
use bitcoin;
use miniscript;

use bitcoin::consensus::Decodable;
use bitcoin::util::sighash;
Expand Down
2 changes: 0 additions & 2 deletions examples/xpub_descriptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

//! Example: Parsing a xpub and getting address
extern crate miniscript;

use miniscript::bitcoin::{self, secp256k1};
use miniscript::{Descriptor, DescriptorPublicKey, DescriptorTrait, TranslatePk2};

Expand Down
5 changes: 1 addition & 4 deletions src/descriptor/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Tr<Pk> {
/// would yield (2, A), (2, B), (2,C), (3, D), (3, E).
///
#[derive(Debug, Clone)]
pub struct TapTreeIter<'a, Pk: MiniscriptKey>
where
Pk: 'a,
{
pub struct TapTreeIter<'a, Pk: MiniscriptKey> {
stack: Vec<(u8, &'a TapTree<Pk>)>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
#![deny(unused_imports)]
#![deny(missing_docs)]

pub extern crate bitcoin;
pub use bitcoin;
#[cfg(feature = "serde")]
pub extern crate serde;
#[cfg(all(test, feature = "unstable"))]
Expand Down Expand Up @@ -469,7 +469,7 @@ impl<
}

/// Either a key or a keyhash
pub enum ForEach<'a, Pk: MiniscriptKey + 'a> {
pub enum ForEach<'a, Pk: MiniscriptKey> {
/// A key
Key(&'a Pk),
/// A keyhash
Expand Down
8 changes: 4 additions & 4 deletions src/miniscript/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {

/// Iterator for traversing all [Miniscript] miniscript AST references starting from some specific
/// node which constructs the iterator via [Miniscript::iter] method.
pub struct Iter<'a, Pk: 'a + MiniscriptKey, Ctx: 'a + ScriptContext> {
pub struct Iter<'a, Pk: MiniscriptKey, Ctx: ScriptContext> {
next: Option<&'a Miniscript<Pk, Ctx>>,
// Here we store vec of path elements, where each element is a tuple, consisting of:
// 1. Miniscript node on the path
Expand Down Expand Up @@ -277,7 +277,7 @@ impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> Iterator for Iter<'a, Pk, Ctx> {

/// Iterator for traversing all [MiniscriptKey]'s in AST starting from some specific node which
/// constructs the iterator via [Miniscript::iter_pk] method.
pub struct PkIter<'a, Pk: 'a + MiniscriptKey, Ctx: 'a + ScriptContext> {
pub struct PkIter<'a, Pk: MiniscriptKey, Ctx: ScriptContext> {
node_iter: Iter<'a, Pk, Ctx>,
curr_node: Option<&'a Miniscript<Pk, Ctx>>,
key_index: usize,
Expand Down Expand Up @@ -319,7 +319,7 @@ impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> Iterator for PkIter<'a, Pk, Ctx>

/// Iterator for traversing all [MiniscriptKey] hashes in AST starting from some specific node which
/// constructs the iterator via [Miniscript::iter_pkh] method.
pub struct PkhIter<'a, Pk: 'a + MiniscriptKey, Ctx: 'a + ScriptContext> {
pub struct PkhIter<'a, Pk: MiniscriptKey, Ctx: ScriptContext> {
node_iter: Iter<'a, Pk, Ctx>,
curr_node: Option<&'a Miniscript<Pk, Ctx>>,
key_index: usize,
Expand Down Expand Up @@ -371,7 +371,7 @@ pub enum PkPkh<Pk: MiniscriptKey> {
/// Iterator for traversing all [MiniscriptKey]'s and hashes, depending what data are present in AST,
/// starting from some specific node which constructs the iterator via
/// [Miniscript::iter_pk_pkh] method.
pub struct PkPkhIter<'a, Pk: 'a + MiniscriptKey, Ctx: 'a + ScriptContext> {
pub struct PkPkhIter<'a, Pk: MiniscriptKey, Ctx: ScriptContext> {
node_iter: Iter<'a, Pk, Ctx>,
curr_node: Option<&'a Miniscript<Pk, Ctx>>,
key_index: usize,
Expand Down

0 comments on commit 900ae8a

Please sign in to comment.