Skip to content

Commit

Permalink
rename single-letter and overly abbreviated variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
tremwil committed Aug 18, 2024
1 parent 6401dfd commit 4847037
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/formats/src/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ impl<T: traits::ParamTraits> RowDescriptor<T> {
///
/// Retuns [`None`] if the resulting slice is out-of-bounds.
fn data<'a>(&self, file: &'a Param<'a, T>) -> Option<&'a [u8]> {
let ofs: usize = self.data_offset.into() as usize;
let offset: usize = self.data_offset.into() as usize;
match file.detected_row_size {
Some(s) => file.data.get(ofs..ofs + s as usize),
None => file.data.get(ofs..),
Some(size) => file.data.get(offset..offset + size as usize),
None => file.data.get(offset..),
}
}

Expand All @@ -191,7 +191,7 @@ impl<T: traits::ParamTraits> RowDescriptor<T> {
fn name<'a>(&self, file: &'a Param<'a, T>) -> Option<&'a T::Str> {
match self.name_offset.into() as usize {
0 => None,
ofs => T::Str::read_cstr(file.data.get(ofs..)?),
offset => T::Str::read_cstr(file.data.get(offset..)?),
}
}
}
Expand Down Expand Up @@ -373,8 +373,8 @@ impl<'a, T: traits::ParamTraits> Param<'a, T> {
}
// If we have a single row and the strings offset is known,
// then the row size will be the difference between the row data and strings
if let Some(o) = detected_strings_offset {
let diff = o
if let Some(offset) = detected_strings_offset {
let diff = offset
.checked_sub(row_descriptors[0].data_offset.into())
.ok_or(ParamParseError::InvalidData)?;
detected_row_size.get_or_insert(diff);
Expand Down

0 comments on commit 4847037

Please sign in to comment.