@@ -66,18 +66,18 @@ impl EncodingInfo for Cid {
6666 }
6767}
6868
69- impl Into < Vec < u8 > > for Cid {
70- fn into ( self ) -> Vec < u8 > {
69+ impl From < Cid > for Vec < u8 > {
70+ fn from ( cid : Cid ) -> Self {
7171 let mut v = Vec :: default ( ) ;
7272 // if we're not a v0 Cid, add in the version and the encoding codec
73- if self . codec ( ) != Codec :: Identity {
73+ if cid . codec ( ) != Codec :: Identity {
7474 // add in the Cid codec
75- v. append ( & mut self . codec . clone ( ) . into ( ) ) ;
75+ v. append ( & mut cid . codec . into ( ) ) ;
7676 // add in the target encoding codec
77- v. append ( & mut self . target_codec . clone ( ) . into ( ) ) ;
77+ v. append ( & mut cid . target_codec . into ( ) ) ;
7878 }
7979 // add in the multihash data
80- v. append ( & mut self . hash . clone ( ) . into ( ) ) ;
80+ v. append ( & mut cid . hash . into ( ) ) ;
8181 v
8282 }
8383}
@@ -211,14 +211,14 @@ impl Builder {
211211 }
212212 Ok ( EncodedCid :: new (
213213 self . base_encoding
214- . unwrap_or_else ( || Cid :: preferred_encoding ( ) ) ,
214+ . unwrap_or_else ( Cid :: preferred_encoding) ,
215215 self . try_build ( ) ?,
216216 ) )
217217 }
218218
219219 /// build the cid
220220 pub fn try_build ( & self ) -> Result < Cid , Error > {
221- if let Some ( codec) = self . codec . clone ( ) {
221+ if let Some ( codec) = self . codec {
222222 // build a v1 or later Cid
223223 Ok ( Cid {
224224 codec,
0 commit comments