diff --git a/src/peer/download_peer.rs b/src/peer/download_peer.rs index 5634673..0f93885 100644 --- a/src/peer/download_peer.rs +++ b/src/peer/download_peer.rs @@ -83,7 +83,10 @@ impl FileManager { } fn extract_filename_from_path(full_path: &str) -> &str { - full_path.split(['/', '\\']).last().unwrap_or(full_path) + full_path + .split(['/', '\\']) + .next_back() + .unwrap_or(full_path) } fn create_download_path_from_filename( diff --git a/src/utils/zlib.rs b/src/utils/zlib.rs index 8b52421..599889b 100644 --- a/src/utils/zlib.rs +++ b/src/utils/zlib.rs @@ -72,7 +72,7 @@ pub fn deflate(input: &[u8]) -> Result> { return Err(SoulseekRs::CompressionError("invalid CINFO".to_string())); } let flg = r.read_byte()?; - if ((cmf as u32) * 256 + (flg as u32)) % 31 != 0 { + if !((cmf as u32) * 256 + (flg as u32)).is_multiple_of(31) { return Err(SoulseekRs::CompressionError( "CMF+FLG checksum failed".to_string(), ));