@@ -404,15 +404,15 @@ impl Builder {
404404 let key_bytes = match codec {
405405 Codec :: Ed25519Priv => Ed25519Keypair :: random ( rng) . private . to_bytes ( ) . to_vec ( ) ,
406406 Codec :: P256Priv => EcdsaKeypair :: random ( rng, EcdsaCurve :: NistP256 )
407- . map_err ( |e| ConversionsError :: SshKey ( e ) ) ?
407+ . map_err ( ConversionsError :: SshKey ) ?
408408 . private_key_bytes ( )
409409 . to_vec ( ) ,
410410 Codec :: P384Priv => EcdsaKeypair :: random ( rng, EcdsaCurve :: NistP384 )
411- . map_err ( |e| ConversionsError :: SshKey ( e ) ) ?
411+ . map_err ( ConversionsError :: SshKey ) ?
412412 . private_key_bytes ( )
413413 . to_vec ( ) ,
414414 Codec :: P521Priv => EcdsaKeypair :: random ( rng, EcdsaCurve :: NistP521 )
415- . map_err ( |e| ConversionsError :: SshKey ( e ) ) ?
415+ . map_err ( ConversionsError :: SshKey ) ?
416416 . private_key_bytes ( )
417417 . to_vec ( ) ,
418418 Codec :: Secp256K1Priv => k256:: SecretKey :: random ( rng) . to_bytes ( ) . to_vec ( ) ,
@@ -592,7 +592,7 @@ impl Builder {
592592 ..Default :: default ( )
593593 } )
594594 }
595- s => return Err ( ConversionsError :: UnsupportedAlgorithm ( s. to_string ( ) ) . into ( ) ) ,
595+ s => Err ( ConversionsError :: UnsupportedAlgorithm ( s. to_string ( ) ) . into ( ) ) ,
596596 } ,
597597 Ed25519 => {
598598 let key_bytes = match sshkey. key_data ( ) {
@@ -780,7 +780,7 @@ impl Builder {
780780 ..Default :: default ( )
781781 } )
782782 }
783- s => return Err ( ConversionsError :: UnsupportedAlgorithm ( s. to_string ( ) ) . into ( ) ) ,
783+ s => Err ( ConversionsError :: UnsupportedAlgorithm ( s. to_string ( ) ) . into ( ) ) ,
784784 } ,
785785 Ed25519 => {
786786 let key_bytes = match sshkey. key_data ( ) {
@@ -819,7 +819,7 @@ impl Builder {
819819
820820 fn with_attribute ( mut self , attr : AttrId , data : & Vec < u8 > ) -> Self {
821821 let mut attributes = self . attributes . unwrap_or_default ( ) ;
822- attributes. insert ( attr, data. clone ( ) . into ( ) ) ;
822+ attributes. insert ( attr, data. to_owned ( ) . into ( ) ) ;
823823 self . attributes = Some ( attributes) ;
824824 self
825825 }
@@ -831,7 +831,8 @@ impl Builder {
831831
832832 /// add in the threshold value
833833 pub fn with_threshold ( self , threshold : usize ) -> Self {
834- self . with_attribute ( AttrId :: Threshold , & Varuint ( threshold) . into ( ) )
834+ let v: Vec < u8 > = Varuint ( threshold) . into ( ) ;
835+ self . with_attribute ( AttrId :: Threshold , & v)
835836 }
836837
837838 /// add in the limit value
@@ -861,7 +862,7 @@ impl Builder {
861862 pub fn try_build_encoded ( self ) -> Result < EncodedMultikey , Error > {
862863 Ok ( BaseEncoded :: new (
863864 self . base_encoding
864- . unwrap_or_else ( || Multikey :: preferred_encoding ( ) ) ,
865+ . unwrap_or_else ( Multikey :: preferred_encoding) ,
865866 self . try_build ( ) ?,
866867 ) )
867868 }
0 commit comments