diff --git a/src/blowfish.rs b/src/blowfish.rs index d0cbddc..c1f2bcd 100755 --- a/src/blowfish.rs +++ b/src/blowfish.rs @@ -22,7 +22,7 @@ impl Blowfish { for i in 0..ROUNDS + 2 { let mut data = 0u32; for _ in 0..4 { - data = (data << 8) | (key[j as usize] as u32); + data = (data << 8) | (key[j] as u32); j += 1; if j >= (KEYBITS as usize) { diff --git a/src/dat.rs b/src/dat.rs index 687ccf6..3dd5d5b 100755 --- a/src/dat.rs +++ b/src/dat.rs @@ -284,7 +284,7 @@ impl DatFile { self.file .seek(SeekFrom::Start( - last_pos + (compressed_block_sizes[current_block as usize] as u64), + last_pos + (compressed_block_sizes[current_block] as u64), )) .ok()?; current_block += 1; diff --git a/src/fiin.rs b/src/fiin.rs index ca2208c..325cf7c 100644 --- a/src/fiin.rs +++ b/src/fiin.rs @@ -56,7 +56,7 @@ impl FileInfo { let mut entries = vec![]; for name in file_names { - let file = &read(&name).expect("Cannot read file."); + let file = &read(name).expect("Cannot read file."); entries.push(FIINEntry { file_size: file.len() as i32, diff --git a/src/gamedata.rs b/src/gamedata.rs index 659fe65..3a14f08 100755 --- a/src/gamedata.rs +++ b/src/gamedata.rs @@ -325,7 +325,7 @@ impl GameData { } }; - fs::write(&ver_path, new_version) + fs::write(ver_path, new_version) .ok() .ok_or(RepairError::FailedRepair(repository))?; } diff --git a/src/log.rs b/src/log.rs index d5ad1e2..503c05b 100644 --- a/src/log.rs +++ b/src/log.rs @@ -87,7 +87,7 @@ impl ChatLog { // TODO: handle the coloring properly, in some way entry.message = String::from_utf8_lossy( - &*buffer[cursor.position() as usize..new_last_offset as usize].to_vec(), + &buffer[cursor.position() as usize..new_last_offset as usize], ) .to_string(); diff --git a/src/patch.rs b/src/patch.rs index ca8b58d..d4a0b04 100755 --- a/src/patch.rs +++ b/src/patch.rs @@ -449,7 +449,7 @@ pub fn apply_patch(data_dir: &str, patch_path: &str) -> Result<(), PatchError> { new_file.seek(SeekFrom::Start(add.block_offset as u64))?; - new_file.write_all(&*add.block_data)?; + new_file.write_all(&add.block_data)?; wipe(&new_file, add.block_delete_number)?; } @@ -518,7 +518,7 @@ pub fn apply_patch(data_dir: &str, patch_path: &str) -> Result<(), PatchError> { new_file.seek(SeekFrom::Start(1024))?; } - new_file.write_all(&*header.header_data)?; + new_file.write_all(&header.header_data)?; } SqpkOperation::FileOperation(fop) => { let file_path = format!("{}/{}", data_dir, fop.path); @@ -526,7 +526,7 @@ pub fn apply_patch(data_dir: &str, patch_path: &str) -> Result<(), PatchError> { match fop.operation { SqpkFileOperation::AddFile => { - fs::create_dir_all(&parent_directory)?; + fs::create_dir_all(parent_directory)?; // reverse reading crc32 file.seek(SeekFrom::Current(-4))?; diff --git a/src/sqpack.rs b/src/sqpack.rs index 0020344..c143573 100755 --- a/src/sqpack.rs +++ b/src/sqpack.rs @@ -61,7 +61,7 @@ pub fn read_data_block_patch(mut buf: T) -> Option> { let compressed_length: usize = ((compressed_length as usize + 143) & 0xFFFFFF80) - (block_header.size as usize); - let mut compressed_data: Vec = vec![0; compressed_length as usize]; + let mut compressed_data: Vec = vec![0; compressed_length]; buf.read_exact(&mut compressed_data).ok()?; let mut decompressed_data: Vec = vec![0; decompressed_length as usize]; @@ -78,7 +78,7 @@ pub fn read_data_block_patch(mut buf: T) -> Option> { buf.read_exact(&mut local_data).ok()?; buf.seek(SeekFrom::Current( - (new_file_size as usize - block_header.size as usize - file_size as usize) as i64, + (new_file_size - block_header.size as usize - file_size as usize) as i64, )) .ok()?; diff --git a/src/tex.rs b/src/tex.rs index 47191dc..6ec08b0 100644 --- a/src/tex.rs +++ b/src/tex.rs @@ -92,7 +92,7 @@ impl Texture { cursor.read_exact(src.as_mut_slice()).ok()?; let mut dst: Vec = - vec![0u8; (header.width as usize * header.height as usize * 4) as usize]; + vec![0u8; header.width as usize * header.height as usize * 4]; match header.format { TextureFormat::B8G8R8A8 => {