1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 10:44:07 +02:00

clippy fixes

This commit is contained in:
Robin Appelman 2025-02-15 16:55:20 +01:00
commit 5e1ae07d36
5 changed files with 83 additions and 164 deletions

View file

@ -6,8 +6,6 @@ use crate::data::*;
use crate::Bsp;
use ahash::RandomState;
use std::fmt::{Debug, Formatter};
use std::hash::BuildHasher;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
/// A handle represents a data structure in the bsp file and the bsp file containing it.
@ -163,11 +161,11 @@ impl<'a> Handle<'a, TextureData> {
}
}
/// Get a color that is unique but determistic for this texture
/// Get a color that is unique but deterministic for this texture
pub fn debug_color(&self) -> [u8; 3] {
let mut name_hasher = RandomState::with_seeds(0, 0, 0, 0).build_hasher();
self.name().hash(&mut name_hasher);
let name_hash = name_hasher.finish().to_be_bytes();
let name_hash = RandomState::with_seeds(0, 0, 0, 0)
.hash_one(self.name())
.to_le_bytes();
[name_hash[0], name_hash[1], name_hash[2]]
}
}

View file

@ -547,20 +547,6 @@ impl Bsp {
}
}
#[cfg(test)]
mod tests {
use super::Bsp;
#[test]
fn tf2_file() {
use std::fs::read;
let data = read("koth_bagel_rc2a.bsp").unwrap();
Bsp::read(&data).unwrap();
}
}
/// LZMA decompression with the header used by source
fn lzma_decompress_with_header(data: &[u8], expected_length: usize) -> Result<Vec<u8>, BspError> {
// extra 8 byte because game lumps need some padding for reasons
@ -597,3 +583,17 @@ fn lzma_decompress_with_header(data: &[u8], expected_length: usize) -> Result<Ve
}
Ok(output)
}
#[cfg(test)]
mod tests {
use super::Bsp;
#[test]
fn tf2_file() {
use std::fs::read;
let data = read("koth_bagel_rc2a.bsp").unwrap();
Bsp::read(&data).unwrap();
}
}