Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f20b05f

Browse filesBrowse files
committed
formatting
1 parent d8d0099 commit f20b05f
Copy full SHA for f20b05f

File tree

1 file changed

+10
-15
lines changed
Filter options

1 file changed

+10
-15
lines changed

‎stdlib/src/bz2.rs

Copy file name to clipboardExpand all lines: stdlib/src/bz2.rs
+10-15Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ pub(crate) use _bz2::make_module;
66
mod _bz2 {
77
use crate::common::lock::PyMutex;
88
use crate::vm::{
9-
FromArgs,
10-
VirtualMachine,
9+
FromArgs, VirtualMachine,
1110
builtins::{PyBytesRef, PyTypeRef},
1211
function::{ArgBytesLike, OptionalArg},
1312
object::{PyPayload, PyResult},
@@ -26,7 +25,7 @@ mod _bz2 {
2625
eof: bool,
2726
// Unused data found after the end of stream.
2827
unused_data: Option<Vec<u8>>,
29-
needs_input: bool
28+
needs_input: bool,
3029
}
3130

3231
#[pyattr]
@@ -51,7 +50,7 @@ mod _bz2 {
5150
eof: false,
5251
input_buffer: Vec::new(),
5352
unused_data: None,
54-
needs_input: true
53+
needs_input: true,
5554
}),
5655
}
5756
.into_ref_with_type(vm, cls)
@@ -70,11 +69,7 @@ mod _bz2 {
7069
#[pyclass(with(Constructor))]
7170
impl BZ2Decompressor {
7271
#[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> {
7873
let DecompressArgs { data, max_length } = args;
7974
let DecompressorState {
8075
eof,
@@ -94,13 +89,13 @@ mod _bz2 {
9489
// If max_length is nonnegative, read at most that many bytes.
9590
if max_length >= 0 {
9691
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)))?;
10095
} 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)))?;
10499
}
105100

106101
// Determine how many bytes were consumed from the input.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.