diff --git a/src/descriptor/dsl.rs b/src/descriptor/dsl.rs index b3f62ae5..405be39f 100644 --- a/src/descriptor/dsl.rs +++ b/src/descriptor/dsl.rs @@ -228,10 +228,11 @@ macro_rules! impl_sortedmulti { use $crate::keys::IntoDescriptorKey; let secp = $crate::bitcoin::secp256k1::Secp256k1::new(); - let mut keys = vec![]; - $( - keys.push($key.into_descriptor_key()); - )* + let keys = vec![ + $( + $key.into_descriptor_key(), + )* + ]; keys.into_iter().collect::, _>>() .map_err($crate::descriptor::DescriptorError::Key) @@ -656,10 +657,11 @@ macro_rules! fragment { use $crate::keys::IntoDescriptorKey; let secp = $crate::bitcoin::secp256k1::Secp256k1::new(); - let mut keys = vec![]; - $( - keys.push($key.into_descriptor_key()); - )* + let keys = vec![ + $( + $key.into_descriptor_key(), + )* + ]; keys.into_iter().collect::, _>>() .map_err($crate::descriptor::DescriptorError::Key) diff --git a/src/descriptor/template.rs b/src/descriptor/template.rs index 8ad9eaf7..3fdbec89 100644 --- a/src/descriptor/template.rs +++ b/src/descriptor/template.rs @@ -440,11 +440,11 @@ macro_rules! expand_make_bipxx { KeychainKind::Internal => vec![bip32::ChildNumber::from_normal_idx(1)?].into(), }; - let mut source_path = Vec::with_capacity(3); - source_path.push(bip32::ChildNumber::from_hardened_idx(bip)?); - source_path.push(bip32::ChildNumber::from_hardened_idx(0)?); - source_path.push(bip32::ChildNumber::from_hardened_idx(0)?); - let source_path: bip32::DerivationPath = source_path.into(); + let source_path = bip32::DerivationPath::from(vec![ + bip32::ChildNumber::from_hardened_idx(bip)?, + bip32::ChildNumber::from_hardened_idx(0)?, + bip32::ChildNumber::from_hardened_idx(0)?, + ]); Ok((key, (parent_fingerprint, source_path), derivation_path)) }