mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 10:44:07 +02:00
nix ci
This commit is contained in:
parent
35ef379950
commit
0850bb8dbd
13 changed files with 946 additions and 55 deletions
|
|
@ -98,7 +98,7 @@ impl<'a> RawEntity<'a> {
|
|||
|
||||
pub fn prop(&self, key: &'static str) -> Result<&'a str, EntityParseError> {
|
||||
self.properties()
|
||||
.find_map(|(prop_key, value)| (key == prop_key).then(|| value))
|
||||
.find_map(|(prop_key, value)| (key == prop_key).then_some(value))
|
||||
.ok_or(EntityParseError::NoSuchProperty(key))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ pub struct SurfaceEdge {
|
|||
|
||||
impl SurfaceEdge {
|
||||
pub fn edge_index(&self) -> u32 {
|
||||
self.edge.abs() as u32
|
||||
self.edge.unsigned_abs()
|
||||
}
|
||||
|
||||
pub fn direction(&self) -> EdgeDirection {
|
||||
|
|
@ -374,7 +374,7 @@ pub struct Face {
|
|||
|
||||
impl Face {
|
||||
pub fn displacement_index(&self) -> Option<i16> {
|
||||
(self.displacement_info >= 0).then(|| self.displacement_info)
|
||||
(self.displacement_info >= 0).then_some(self.displacement_info)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ impl<'a> Handle<'a, TextureData> {
|
|||
pub fn name(&self) -> &'a str {
|
||||
let start = self.bsp.texture_string_tables[self.name_string_table_id as usize] as usize;
|
||||
let part = &self.bsp.texture_string_data[start..];
|
||||
if let Some((s, _)) = part.split_once("\0") {
|
||||
if let Some((s, _)) = part.split_once('\0') {
|
||||
s
|
||||
} else {
|
||||
part
|
||||
|
|
|
|||
10
src/lib.rs
10
src/lib.rs
|
|
@ -139,7 +139,7 @@ impl<'a> IntoIterator for &'a Leaves {
|
|||
type IntoIter = <&'a [Leaf] as IntoIterator>::IntoIter;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
(&self.leaves[..]).iter()
|
||||
self.leaves[..].iter()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -452,8 +452,8 @@ impl Bsp {
|
|||
"texture_string_tables",
|
||||
)?;
|
||||
self.validate_indexes(
|
||||
self.texture_string_tables.iter().map(|texture| *texture),
|
||||
&self.texture_string_data.as_bytes(),
|
||||
self.texture_string_tables.iter().copied(),
|
||||
self.texture_string_data.as_bytes(),
|
||||
"texture_string_tables",
|
||||
"texture_string_data",
|
||||
)?;
|
||||
|
|
@ -467,7 +467,7 @@ impl Bsp {
|
|||
self.nodes
|
||||
.iter()
|
||||
.flat_map(|node| node.children)
|
||||
.filter_map(|index| (index >= 0).then(|| index)),
|
||||
.filter_map(|index| (index >= 0).then_some(index)),
|
||||
&self.nodes,
|
||||
"node",
|
||||
"node",
|
||||
|
|
@ -476,7 +476,7 @@ impl Bsp {
|
|||
self.nodes
|
||||
.iter()
|
||||
.flat_map(|node| node.children)
|
||||
.filter_map(|index| (index < 0).then(|| !index)),
|
||||
.filter_map(|index| (index < 0).then_some(!index)),
|
||||
&self.leaves,
|
||||
"node",
|
||||
"leaf",
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ impl<R: BinReaderExt + Read> LumpReader<R> {
|
|||
}
|
||||
|
||||
pub fn read_visdata(&mut self) -> BspResult<VisData> {
|
||||
if (self.length as usize) < size_of::<u32>() * 2 {
|
||||
if self.length < size_of::<u32>() * 2 {
|
||||
return Ok(VisData::default());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue