Skip to content

Commit 0240a3a

Browse files
tchardingSarcasticNastik
authored andcommitted
Use KeySource instead of tuple
Clippy emits: warning: very complex type used. Consider factoring parts into `type` definitions The type we return is more complex than needed because we do not use the `bip32::KeySource` alias but instead write the full tuple `(byp32::Fingerprint, bip32::DerivationPath)`. To fix the clippy warning we have at least 3 options 1. Add an alias for the complex return type 2. Add a compiler directive to quieten clippy 3. Use `bip32::KeySource` instead of tuple (1) seems like an overkill (2) means we loose lint coverage for the whole function Elect to do (3), the best of 3 imperfect solutions.
1 parent 69440a4 commit 0240a3a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/descriptor/key.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,7 @@ impl FromStr for DescriptorSecretKey {
539539
impl<K: InnerXKey> DescriptorXKey<K> {
540540
fn parse_xkey_origin(
541541
s: &str,
542-
) -> Result<(&str, Option<(bip32::Fingerprint, bip32::DerivationPath)>), DescriptorKeyParseError>
543-
{
542+
) -> Result<(&str, Option<bip32::KeySource>), DescriptorKeyParseError> {
544543
for ch in s.as_bytes() {
545544
if *ch < 20 || *ch > 127 {
546545
return Err(DescriptorKeyParseError(

0 commit comments

Comments
 (0)