aboutsummaryrefslogtreecommitdiff
path: root/stockton-levels/src/q3/planes.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:21 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:21 +0100
commit2111c1248b08236a839dcf22036f92735bceb31c (patch)
tree9313da344b7134a913d1d917162e55b35fe1e74f /stockton-levels/src/q3/planes.rs
parent102e166b040030b590df83888a1d1a47d0130f10 (diff)
chore(all): style formatting and clippy fixes
Diffstat (limited to 'stockton-levels/src/q3/planes.rs')
-rw-r--r--stockton-levels/src/q3/planes.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/stockton-levels/src/q3/planes.rs b/stockton-levels/src/q3/planes.rs
index 618a441..7acc872 100644
--- a/stockton-levels/src/q3/planes.rs
+++ b/stockton-levels/src/q3/planes.rs
@@ -17,22 +17,20 @@
const PLANE_SIZE: usize = (4 * 3) + 4;
-use crate::helpers::{slice_to_f32, slice_to_vec3};
-use crate::types::{Result, ParseError};
-use crate::traits::planes::*;
use super::Q3BSPFile;
use crate::coords::CoordSystem;
+use crate::helpers::{slice_to_f32, slice_to_vec3};
+use crate::traits::planes::*;
+use crate::types::{ParseError, Result};
/// Parse a lump of planes.
/// A lump is (data length / plane size) planes long
pub fn from_data(data: &[u8]) -> Result<Box<[Plane]>> {
-
let length = data.len() / PLANE_SIZE;
if data.is_empty() || data.len() % PLANE_SIZE != 0 || length % 2 != 0 {
return Err(ParseError::Invalid);
}
-
let mut planes = Vec::with_capacity(length / 2);
for n in 0..length {
let offset = n * PLANE_SIZE;
@@ -49,11 +47,11 @@ pub fn from_data(data: &[u8]) -> Result<Box<[Plane]>> {
impl<T: CoordSystem> HasPlanes<T> for Q3BSPFile<T> {
type PlanesIter<'a> = std::slice::Iter<'a, Plane>;
- fn planes_iter<'a>(&'a self) -> Self::PlanesIter<'a> {
+ fn planes_iter(&self) -> Self::PlanesIter<'_> {
self.planes.iter()
}
- fn get_plane<'a>(&'a self, idx: u32) -> &'a Plane {
+ fn get_plane(&self, idx: u32) -> &Plane {
&self.planes[idx as usize]
}
-} \ No newline at end of file
+}