@@ -8,7 +8,7 @@ use core::convert::TryInto;
88use core:: fmt:: Debug ;
99use generic_array:: { ArrayLength , GenericArray } ;
1010
11- use unsigned_varint:: { decode , encode as varint_encode} ;
11+ use unsigned_varint:: encode as varint_encode;
1212
1313#[ cfg( feature = "std" ) ]
1414use std:: io;
@@ -284,12 +284,6 @@ where
284284 R : io:: Read ,
285285 S : Size ,
286286{
287- #[ cfg( not( feature = "std" ) ) ]
288- use crate :: read_u64;
289-
290- #[ cfg( feature = "std" ) ]
291- use unsigned_varint:: io:: read_u64;
292-
293287 let code = match read_u64 ( & mut r) {
294288 Ok ( c) => c,
295289 Err ( e) => return Err ( e. into ( ) ) ,
@@ -308,10 +302,15 @@ where
308302 Ok ( ( code, size as u8 , digest) )
309303}
310304
305+ #[ cfg( feature = "std" ) ]
306+ pub ( crate ) use unsigned_varint:: io:: read_u64;
307+
311308/// Reads 64 bits from a byte array into a u64
312309/// Adapted from unsigned-varint's generated read_u64 function at
313310/// https://github.com/paritytech/unsigned-varint/blob/master/src/io.rs
314- pub fn read_u64 < R : io:: Read > ( mut r : R ) -> Result < u64 , Error > {
311+ #[ cfg( not( feature = "std" ) ) ]
312+ pub ( crate ) fn read_u64 < R : io:: Read > ( mut r : R ) -> Result < u64 , Error > {
313+ use unsigned_varint:: decode;
315314 let mut b = varint_encode:: u64_buffer ( ) ;
316315 for i in 0 ..b. len ( ) {
317316 let n = r. read ( & mut ( b[ i..i + 1 ] ) ) ?;
0 commit comments