@@ -6,8 +6,7 @@ pub(crate) use _bz2::make_module;
6
6
mod _bz2 {
7
7
use crate :: common:: lock:: PyMutex ;
8
8
use crate :: vm:: {
9
- FromArgs ,
10
- VirtualMachine ,
9
+ FromArgs , VirtualMachine ,
11
10
builtins:: { PyBytesRef , PyTypeRef } ,
12
11
function:: { ArgBytesLike , OptionalArg } ,
13
12
object:: { PyPayload , PyResult } ,
@@ -26,7 +25,7 @@ mod _bz2 {
26
25
eof : bool ,
27
26
// Unused data found after the end of stream.
28
27
unused_data : Option < Vec < u8 > > ,
29
- needs_input : bool
28
+ needs_input : bool ,
30
29
}
31
30
32
31
#[ pyattr]
@@ -51,7 +50,7 @@ mod _bz2 {
51
50
eof : false ,
52
51
input_buffer : Vec :: new ( ) ,
53
52
unused_data : None ,
54
- needs_input : true
53
+ needs_input : true ,
55
54
} ) ,
56
55
}
57
56
. into_ref_with_type ( vm, cls)
@@ -70,11 +69,7 @@ mod _bz2 {
70
69
#[ pyclass( with( Constructor ) ) ]
71
70
impl BZ2Decompressor {
72
71
#[ pymethod]
73
- fn decompress (
74
- & self ,
75
- args : DecompressArgs ,
76
- vm : & VirtualMachine ,
77
- ) -> PyResult < PyBytesRef > {
72
+ fn decompress ( & self , args : DecompressArgs , vm : & VirtualMachine ) -> PyResult < PyBytesRef > {
78
73
let DecompressArgs { data, max_length } = args;
79
74
let DecompressorState {
80
75
eof,
@@ -94,13 +89,13 @@ mod _bz2 {
94
89
// If max_length is nonnegative, read at most that many bytes.
95
90
if max_length >= 0 {
96
91
let mut limited = decoder. by_ref ( ) . take ( max_length as u64 ) ;
97
- limited. read_to_end ( & mut output ) . map_err ( |e| {
98
- vm . new_os_error ( format ! ( "Decompression error: {}" , e ) )
99
- } ) ?;
92
+ limited
93
+ . read_to_end ( & mut output )
94
+ . map_err ( |e| vm . new_os_error ( format ! ( "Decompression error: {}" , e ) ) ) ?;
100
95
} else {
101
- decoder. read_to_end ( & mut output ) . map_err ( |e| {
102
- vm . new_os_error ( format ! ( "Decompression error: {}" , e ) )
103
- } ) ?;
96
+ decoder
97
+ . read_to_end ( & mut output )
98
+ . map_err ( |e| vm . new_os_error ( format ! ( "Decompression error: {}" , e ) ) ) ?;
104
99
}
105
100
106
101
// Determine how many bytes were consumed from the input.
0 commit comments