mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-24 13:37:44 +00:00
Fix some clippy warnings
This commit is contained in:
parent
06c13853c3
commit
67eab58c24
3 changed files with 8 additions and 9 deletions
|
@ -80,8 +80,8 @@ impl ConfigFile {
|
||||||
|
|
||||||
/// Checks if the CFG contains a key named `select_key`
|
/// Checks if the CFG contains a key named `select_key`
|
||||||
pub fn has_key(&self, select_key: &str) -> bool {
|
pub fn has_key(&self, select_key: &str) -> bool {
|
||||||
for (_, keys) in &self.settings {
|
for map in self.settings.values() {
|
||||||
for (key, _) in &keys.keys {
|
for (key, _) in &map.keys {
|
||||||
if select_key == key {
|
if select_key == key {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ impl ConfigFile {
|
||||||
|
|
||||||
/// Checks if the CFG contains a category named `select_category`
|
/// Checks if the CFG contains a category named `select_category`
|
||||||
pub fn has_category(&self, select_category: &str) -> bool {
|
pub fn has_category(&self, select_category: &str) -> bool {
|
||||||
for (category, _) in &self.settings {
|
for category in self.settings.keys() {
|
||||||
if select_category == category {
|
if select_category == category {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ impl ConfigFile {
|
||||||
|
|
||||||
/// Sets the value to `new_value` of `select_key`
|
/// Sets the value to `new_value` of `select_key`
|
||||||
pub fn set_value(&mut self, select_key: &str, new_value: &str) {
|
pub fn set_value(&mut self, select_key: &str, new_value: &str) {
|
||||||
for (_, keys) in &mut self.settings {
|
for keys in self.settings.values_mut() {
|
||||||
for (key, value) in &mut keys.keys {
|
for (key, value) in &mut keys.keys {
|
||||||
if select_key == key {
|
if select_key == key {
|
||||||
*value = new_value.to_string();
|
*value = new_value.to_string();
|
||||||
|
|
|
@ -332,8 +332,8 @@ const WIPE_BUFFER: [u8; 1 << 16] = [0; 1 << 16];
|
||||||
fn wipe(mut file: &File, length: u32) -> Result<(), PatchError> {
|
fn wipe(mut file: &File, length: u32) -> Result<(), PatchError> {
|
||||||
let mut length: usize = length as usize;
|
let mut length: usize = length as usize;
|
||||||
while length > 0 {
|
while length > 0 {
|
||||||
let num_bytes = min(WIPE_BUFFER.len(), length as usize);
|
let num_bytes = min(WIPE_BUFFER.len(), length);
|
||||||
file.write_all(&WIPE_BUFFER[0..num_bytes as usize])?;
|
file.write_all(&WIPE_BUFFER[0..num_bytes])?;
|
||||||
length -= num_bytes;
|
length -= num_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ pub fn apply_patch(data_dir: &str, patch_path: &str) -> Result<(), PatchError> {
|
||||||
new_file.set_len(0)?;
|
new_file.set_len(0)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_file.seek(SeekFrom::Start(fop.offset as u64))?;
|
new_file.seek(SeekFrom::Start(fop.offset))?;
|
||||||
new_file.write_all(&data)?;
|
new_file.write_all(&data)?;
|
||||||
}
|
}
|
||||||
SqpkFileOperation::DeleteFile => {
|
SqpkFileOperation::DeleteFile => {
|
||||||
|
|
|
@ -85,8 +85,7 @@ impl Texture {
|
||||||
let header = TexHeader::read(&mut cursor).unwrap();
|
let header = TexHeader::read(&mut cursor).unwrap();
|
||||||
|
|
||||||
// TODO: Adapted from Lumina, but this really can be written better...
|
// TODO: Adapted from Lumina, but this really can be written better...
|
||||||
let mut texture_data_size = vec![];
|
let mut texture_data_size = vec![0; min(13, header.mip_levels as usize)];
|
||||||
texture_data_size.resize(min(13, header.mip_levels as usize), 0);
|
|
||||||
let size = texture_data_size.len();
|
let size = texture_data_size.len();
|
||||||
for i in 0..size - 1 {
|
for i in 0..size - 1 {
|
||||||
texture_data_size[i] = header.offset_to_surface[i + 1] - header.offset_to_surface[i];
|
texture_data_size[i] = header.offset_to_surface[i + 1] - header.offset_to_surface[i];
|
||||||
|
|
Loading…
Add table
Reference in a new issue