@@ -86,14 +86,10 @@ impl DerivPaths {
86
86
}
87
87
88
88
/// Get the list of derivation paths.
89
- pub fn paths ( & self ) -> & Vec < bip32:: DerivationPath > {
90
- & self . 0
91
- }
89
+ pub fn paths ( & self ) -> & Vec < bip32:: DerivationPath > { & self . 0 }
92
90
93
91
/// Get the list of derivation paths.
94
- pub fn into_paths ( self ) -> Vec < bip32:: DerivationPath > {
95
- self . 0
96
- }
92
+ pub fn into_paths ( self ) -> Vec < bip32:: DerivationPath > { self . 0 }
97
93
}
98
94
99
95
/// Instance of one or more extended keys, as specified in BIP 389.
@@ -173,19 +169,15 @@ impl InnerXKey for bip32::ExtendedPubKey {
173
169
self . fingerprint ( )
174
170
}
175
171
176
- fn can_derive_hardened ( ) -> bool {
177
- false
178
- }
172
+ fn can_derive_hardened ( ) -> bool { false }
179
173
}
180
174
181
175
impl InnerXKey for bip32:: ExtendedPrivKey {
182
176
fn xkey_fingerprint < C : Signing > ( & self , secp : & Secp256k1 < C > ) -> bip32:: Fingerprint {
183
177
self . fingerprint ( secp)
184
178
}
185
179
186
- fn can_derive_hardened ( ) -> bool {
187
- true
188
- }
180
+ fn can_derive_hardened ( ) -> bool { true }
189
181
}
190
182
191
183
/// Whether a descriptor has a wildcard in it
@@ -271,16 +263,12 @@ impl DescriptorXKey<bip32::ExtendedPrivKey> {
271
263
pub struct DescriptorKeyParseError ( & ' static str ) ;
272
264
273
265
impl fmt:: Display for DescriptorKeyParseError {
274
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
275
- f. write_str ( self . 0 )
276
- }
266
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result { f. write_str ( self . 0 ) }
277
267
}
278
268
279
269
#[ cfg( feature = "std" ) ]
280
270
impl error:: Error for DescriptorKeyParseError {
281
- fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
282
- None
283
- }
271
+ fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > { None }
284
272
}
285
273
286
274
impl fmt:: Display for DescriptorPublicKey {
@@ -621,9 +609,7 @@ impl DescriptorPublicKey {
621
609
622
610
/// Whether or not the key has a wildcard
623
611
#[ deprecated( note = "use has_wildcard instead" ) ]
624
- pub fn is_deriveable ( & self ) -> bool {
625
- self . has_wildcard ( )
626
- }
612
+ pub fn is_deriveable ( & self ) -> bool { self . has_wildcard ( ) }
627
613
628
614
/// Whether or not the key has a wildcard
629
615
pub fn has_wildcard ( & self ) -> bool {
@@ -1093,9 +1079,7 @@ impl DefiniteDescriptorKey {
1093
1079
}
1094
1080
1095
1081
/// The fingerprint of the master key associated with this key, `0x00000000` if none.
1096
- pub fn master_fingerprint ( & self ) -> bip32:: Fingerprint {
1097
- self . 0 . master_fingerprint ( )
1098
- }
1082
+ pub fn master_fingerprint ( & self ) -> bip32:: Fingerprint { self . 0 . master_fingerprint ( ) }
1099
1083
1100
1084
/// Full path from the master key if not a multipath extended key.
1101
1085
pub fn full_derivation_path ( & self ) -> Option < bip32:: DerivationPath > {
@@ -1109,14 +1093,10 @@ impl DefiniteDescriptorKey {
1109
1093
}
1110
1094
1111
1095
/// Reference to the underlying `DescriptorPublicKey`
1112
- pub fn as_descriptor_public_key ( & self ) -> & DescriptorPublicKey {
1113
- & self . 0
1114
- }
1096
+ pub fn as_descriptor_public_key ( & self ) -> & DescriptorPublicKey { & self . 0 }
1115
1097
1116
1098
/// Converts the definite key into a generic one
1117
- pub fn into_descriptor_public_key ( self ) -> DescriptorPublicKey {
1118
- self . 0
1119
- }
1099
+ pub fn into_descriptor_public_key ( self ) -> DescriptorPublicKey { self . 0 }
1120
1100
}
1121
1101
1122
1102
impl FromStr for DefiniteDescriptorKey {
@@ -1131,9 +1111,7 @@ impl FromStr for DefiniteDescriptorKey {
1131
1111
}
1132
1112
1133
1113
impl fmt:: Display for DefiniteDescriptorKey {
1134
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1135
- self . 0 . fmt ( f)
1136
- }
1114
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result { self . 0 . fmt ( f) }
1137
1115
}
1138
1116
1139
1117
impl MiniscriptKey for DefiniteDescriptorKey {
@@ -1142,17 +1120,11 @@ impl MiniscriptKey for DefiniteDescriptorKey {
1142
1120
type Ripemd160 = ripemd160:: Hash ;
1143
1121
type Hash160 = hash160:: Hash ;
1144
1122
1145
- fn is_uncompressed ( & self ) -> bool {
1146
- self . 0 . is_uncompressed ( )
1147
- }
1123
+ fn is_uncompressed ( & self ) -> bool { self . 0 . is_uncompressed ( ) }
1148
1124
1149
- fn is_x_only_key ( & self ) -> bool {
1150
- self . 0 . is_x_only_key ( )
1151
- }
1125
+ fn is_x_only_key ( & self ) -> bool { self . 0 . is_x_only_key ( ) }
1152
1126
1153
- fn num_der_paths ( & self ) -> usize {
1154
- self . 0 . num_der_paths ( )
1155
- }
1127
+ fn num_der_paths ( & self ) -> usize { self . 0 . num_der_paths ( ) }
1156
1128
}
1157
1129
1158
1130
impl ToPublicKey for DefiniteDescriptorKey {
@@ -1161,33 +1133,21 @@ impl ToPublicKey for DefiniteDescriptorKey {
1161
1133
self . derive_public_key ( & secp) . unwrap ( )
1162
1134
}
1163
1135
1164
- fn to_sha256 ( hash : & sha256:: Hash ) -> sha256:: Hash {
1165
- * hash
1166
- }
1136
+ fn to_sha256 ( hash : & sha256:: Hash ) -> sha256:: Hash { * hash }
1167
1137
1168
- fn to_hash256 ( hash : & hash256:: Hash ) -> hash256:: Hash {
1169
- * hash
1170
- }
1138
+ fn to_hash256 ( hash : & hash256:: Hash ) -> hash256:: Hash { * hash }
1171
1139
1172
- fn to_ripemd160 ( hash : & ripemd160:: Hash ) -> ripemd160:: Hash {
1173
- * hash
1174
- }
1140
+ fn to_ripemd160 ( hash : & ripemd160:: Hash ) -> ripemd160:: Hash { * hash }
1175
1141
1176
- fn to_hash160 ( hash : & hash160:: Hash ) -> hash160:: Hash {
1177
- * hash
1178
- }
1142
+ fn to_hash160 ( hash : & hash160:: Hash ) -> hash160:: Hash { * hash }
1179
1143
}
1180
1144
1181
1145
impl From < DefiniteDescriptorKey > for DescriptorPublicKey {
1182
- fn from ( d : DefiniteDescriptorKey ) -> Self {
1183
- d. 0
1184
- }
1146
+ fn from ( d : DefiniteDescriptorKey ) -> Self { d. 0 }
1185
1147
}
1186
1148
1187
1149
impl Borrow < DescriptorPublicKey > for DefiniteDescriptorKey {
1188
- fn borrow ( & self ) -> & DescriptorPublicKey {
1189
- & self . 0
1190
- }
1150
+ fn borrow ( & self ) -> & DescriptorPublicKey { & self . 0 }
1191
1151
}
1192
1152
1193
1153
#[ cfg( feature = "serde" ) ]
0 commit comments