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 ce6807b

Browse filesBrowse files
committed
fixes and formatting
1 parent 264a39c commit ce6807b
Copy full SHA for ce6807b

File tree

2 files changed

+13
-6
lines changed
Filter options

2 files changed

+13
-6
lines changed

‎stdlib/src/lzma.rs

Copy file name to clipboardExpand all lines: stdlib/src/lzma.rs
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ mod _lzma {
3939
use std::fmt;
4040
use xz2::stream::{Action, Check, Error, Filters, Status, Stream};
4141

42+
#[cfg(windows)]
43+
type EnumVal = i32;
44+
#[cfg(not(windows))]
45+
type EnumVal = u32;
46+
4247
const BUFSIZ: usize = 8192;
4348
// TODO: can't find this in lzma-sys, but find way not to hardcode this
4449
#[pyattr]
@@ -268,8 +273,11 @@ mod _lzma {
268273
}
269274

270275
fn int_to_check(check: i32) -> Option<Check> {
271-
match check {
272-
-1 | CHECK_NONE => Some(Check::None),
276+
if check == -1 {
277+
return Some(Check::None);
278+
}
279+
match check as EnumVal {
280+
CHECK_NONE => Some(Check::None),
273281
CHECK_CRC32 => Some(Check::Crc32),
274282
CHECK_CRC64 => Some(Check::Crc64),
275283
CHECK_SHA256 => Some(Check::Sha256),
@@ -374,7 +382,7 @@ mod _lzma {
374382

375383
fn py_new(_cls: PyTypeRef, args: Self::Args, vm: &VirtualMachine) -> PyResult {
376384
let preset = args.preset.unwrap_or(PRESET_DEFAULT);
377-
if args.format != FORMAT_XZ && args.check != -1 && args.check != CHECK_NONE {
385+
if args.format != FORMAT_XZ as _ && args.check != -1 && args.check != CHECK_NONE as _ {
378386
return Err(new_lzma_error(
379387
"Integrity checks are only supported by FORMAT_XZ",
380388
vm,

‎stdlib/src/zlib.rs

Copy file name to clipboardExpand all lines: stdlib/src/zlib.rs
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,9 @@ mod zlib {
573573
flush: Self::Flush,
574574
vm: &VirtualMachine,
575575
) -> PyResult<Self::Status> {
576-
Ok(self
577-
.compress
576+
self.compress
578577
.compress_vec(input, output, flush)
579-
.map_err(|_| new_zlib_error("error while compressing", vm))?)
578+
.map_err(|_| new_zlib_error("error while compressing", vm))
580579
}
581580

582581
fn total_in(&mut self) -> usize {

0 commit comments

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