3030#![ feature( unique) ]
3131#![ cfg_attr( test, feature( rustc_private, rand, vec_push_all) ) ]
3232
33- #[ cfg( test) ] #[ macro_use] extern crate log;
33+ #[ cfg( test) ]
34+ #[ macro_use]
35+ extern crate log;
3436
3537extern crate libc;
3638
@@ -47,9 +49,7 @@ pub struct Error {
4749
4850impl Error {
4951 fn new ( ) -> Error {
50- Error {
51- _unused : ( ) ,
52- }
52+ Error { _unused : ( ) }
5353 }
5454}
5555
@@ -73,7 +73,9 @@ impl Deref for Bytes {
7373
7474impl Drop for Bytes {
7575 fn drop ( & mut self ) {
76- unsafe { libc:: free ( * self . ptr as * mut _ ) ; }
76+ unsafe {
77+ libc:: free ( * self . ptr as * mut _ ) ;
78+ }
7779 }
7880}
7981
@@ -123,7 +125,7 @@ pub fn deflate_bytes_zlib(bytes: &[u8]) -> Bytes {
123125 deflate_bytes_internal ( bytes, LZ_NORM | TDEFL_WRITE_ZLIB_HEADER )
124126}
125127
126- fn inflate_bytes_internal ( bytes : & [ u8 ] , flags : c_int ) -> Result < Bytes , Error > {
128+ fn inflate_bytes_internal ( bytes : & [ u8 ] , flags : c_int ) -> Result < Bytes , Error > {
127129 unsafe {
128130 let mut outsz: size_t = 0 ;
129131 let res = tinfl_decompress_mem_to_heap ( bytes. as_ptr ( ) as * const _ ,
@@ -142,12 +144,12 @@ fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Result<Bytes,Error> {
142144}
143145
144146/// Decompress a buffer, without parsing any sort of header on the input.
145- pub fn inflate_bytes ( bytes : & [ u8 ] ) -> Result < Bytes , Error > {
147+ pub fn inflate_bytes ( bytes : & [ u8 ] ) -> Result < Bytes , Error > {
146148 inflate_bytes_internal ( bytes, 0 )
147149}
148150
149151/// Decompress a buffer that starts with a zlib header.
150- pub fn inflate_bytes_zlib ( bytes : & [ u8 ] ) -> Result < Bytes , Error > {
152+ pub fn inflate_bytes_zlib ( bytes : & [ u8 ] ) -> Result < Bytes , Error > {
151153 inflate_bytes_internal ( bytes, TINFL_FLAG_PARSE_ZLIB_HEADER )
152154}
153155
@@ -176,7 +178,8 @@ mod tests {
176178 let cmp = deflate_bytes ( & input) ;
177179 let out = inflate_bytes ( & cmp) . unwrap ( ) ;
178180 debug ! ( "{} bytes deflated to {} ({:.1}% size)" ,
179- input. len( ) , cmp. len( ) ,
181+ input. len( ) ,
182+ cmp. len( ) ,
180183 100.0 * ( ( cmp. len( ) as f64 ) / ( input. len( ) as f64 ) ) ) ;
181184 assert_eq ! ( & * input, & * out) ;
182185 }
0 commit comments