@@ -117,14 +117,14 @@ impl Compress {
117117 ///
118118 /// Allowable values range from 0 to 250 inclusive. 0 is a special case,
119119 /// equivalent to using the default value of 30.
120- pub fn new ( lvl : Compression , work_factor : u32 ) -> Compress {
120+ pub fn new ( lvl : Compression , work_factor : u32 ) -> Self {
121121 unsafe {
122122 let mut raw = Box :: new ( mem:: zeroed ( ) ) ;
123123 assert_eq ! (
124124 ffi:: BZ2_bzCompressInit ( & mut * raw, lvl. level( ) as c_int, 0 , work_factor as c_int) ,
125125 0
126126 ) ;
127- Compress {
127+ Self {
128128 inner : Stream {
129129 raw,
130130 _marker : marker:: PhantomData ,
@@ -163,7 +163,7 @@ impl Compress {
163163 ffi:: BZ_FINISH_OK => Ok ( Status :: FinishOk ) ,
164164 ffi:: BZ_STREAM_END => Ok ( Status :: StreamEnd ) ,
165165 ffi:: BZ_SEQUENCE_ERROR => Err ( Error :: Sequence ) ,
166- c => panic ! ( "unknown return status: {}" , c ) ,
166+ c => panic ! ( "unknown return status: {c}" ) ,
167167 }
168168 }
169169 }
@@ -213,11 +213,11 @@ impl Decompress {
213213 /// decompression algorithm which uses less memory but at the cost of
214214 /// decompressing more slowly (roughly speaking, half the speed, but the
215215 /// maximum memory requirement drops to around 2300k).
216- pub fn new ( small : bool ) -> Decompress {
216+ pub fn new ( small : bool ) -> Self {
217217 unsafe {
218218 let mut raw = Box :: new ( mem:: zeroed ( ) ) ;
219219 assert_eq ! ( ffi:: BZ2_bzDecompressInit ( & mut * raw, 0 , small as c_int) , 0 ) ;
220- Decompress {
220+ Self {
221221 inner : Stream {
222222 raw,
223223 _marker : marker:: PhantomData ,
@@ -241,7 +241,7 @@ impl Decompress {
241241 ffi:: BZ_DATA_ERROR => Err ( Error :: Data ) ,
242242 ffi:: BZ_DATA_ERROR_MAGIC => Err ( Error :: DataMagic ) ,
243243 ffi:: BZ_SEQUENCE_ERROR => Err ( Error :: Sequence ) ,
244- c => panic ! ( "wut: {}" , c ) ,
244+ c => panic ! ( "wut: {c}" ) ,
245245 }
246246 }
247247 }
@@ -294,18 +294,18 @@ impl error::Error for Error {}
294294impl fmt:: Display for Error {
295295 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
296296 let description = match self {
297- Error :: Sequence => "bzip2: sequence of operations invalid" ,
298- Error :: Data => "bzip2: invalid data" ,
299- Error :: DataMagic => "bzip2: bz2 header missing" ,
300- Error :: Param => "bzip2: invalid parameters" ,
297+ Self :: Sequence => "bzip2: sequence of operations invalid" ,
298+ Self :: Data => "bzip2: invalid data" ,
299+ Self :: DataMagic => "bzip2: bz2 header missing" ,
300+ Self :: Param => "bzip2: invalid parameters" ,
301301 } ;
302302 f. write_str ( description)
303303 }
304304}
305305
306306impl From < Error > for std:: io:: Error {
307- fn from ( data : Error ) -> std :: io :: Error {
308- std :: io :: Error :: other ( data)
307+ fn from ( data : Error ) -> Self {
308+ Self :: other ( data)
309309 }
310310}
311311
0 commit comments