mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 10:44:07 +02:00
clippy fixes
This commit is contained in:
parent
efb0a0f7f2
commit
5e1ae07d36
5 changed files with 83 additions and 164 deletions
|
|
@ -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]]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
28
src/lib.rs
28
src/lib.rs
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue