1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 18:54:05 +02:00

clippy fixes

This commit is contained in:
Robin Appelman 2022-02-27 19:18:57 +01:00
commit ea557f08d3
4 changed files with 6 additions and 6 deletions

View file

@ -52,7 +52,7 @@ impl<'a> BspFile<'a> {
let raw_data = self let raw_data = self
.data .data
.get(lump.offset as usize..lump.offset as usize + lump.length as usize) .get(lump.offset as usize..lump.offset as usize + lump.length as usize)
.ok_or_else(|| BspError::LumpOutOfBounds(*lump))?; .ok_or(BspError::LumpOutOfBounds(*lump))?;
Ok(match lump.ident { Ok(match lump.ident {
0 => Cow::Borrowed(raw_data), 0 => Cow::Borrowed(raw_data),

View file

@ -138,10 +138,10 @@ where
[T; N]: Default, [T; N]: Default,
{ {
fn parse(raw: &'_ str) -> Result<Self, EntityParseError> { fn parse(raw: &'_ str) -> Result<Self, EntityParseError> {
let mut values = raw.split(" ").map(T::from_str); let mut values = raw.split(' ').map(T::from_str);
let mut result = <[T; N]>::default(); let mut result = <[T; N]>::default();
for i in 0..N { for item in result.iter_mut() {
result[i] = values.next().ok_or(EntityParseError::ElementCount)??; *item = values.next().ok_or(EntityParseError::ElementCount)??;
} }
Ok(result) Ok(result)
} }

View file

@ -96,7 +96,7 @@ impl FromStr for Vector {
type Err = EntityParseError; type Err = EntityParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut floats = s.split(" ").map(f32::from_str); let mut floats = s.split(' ').map(f32::from_str);
let x = floats.next().ok_or(EntityParseError::ElementCount)??; let x = floats.next().ok_or(EntityParseError::ElementCount)??;
let y = floats.next().ok_or(EntityParseError::ElementCount)??; let y = floats.next().ok_or(EntityParseError::ElementCount)??;
let z = floats.next().ok_or(EntityParseError::ElementCount)??; let z = floats.next().ok_or(EntityParseError::ElementCount)??;

View file

@ -51,7 +51,7 @@ impl<'a> Handle<'a, DisplacementInfo> {
.unwrap(); .unwrap();
corner_positions.rotate_left(start_index); corner_positions.rotate_left(start_index);
corner_positions.try_into().unwrap() corner_positions
} }
fn subdivided_face(&self) -> impl Iterator<Item = Vector> + 'a { fn subdivided_face(&self) -> impl Iterator<Item = Vector> + 'a {