Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/deserializer/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ impl<'a, 'b> PropertyIterator<'a, 'b> {
) -> Option<Self> {
let root_object = object_table.get(root_object_index)?;

let properties = if let Archived::Object { data, .. } = root_object {
data
} else {
let Archived::Object {
data: properties, ..
} = root_object
else {
return None;
};

Expand Down Expand Up @@ -105,7 +106,7 @@ impl<'a, 'b: 'a> PropertyIterator<'a, 'b> {
/// ```
#[must_use]
pub fn primitives(self) -> Vec<&'b OutputData<'a>> {
self.primitives_with_limits(100, 1000000)
self.primitives_with_limits(100, 1_000_000)
}

/// Collects primitive data values with safety limits to prevent infinite loops.
Expand Down Expand Up @@ -254,7 +255,7 @@ impl<'a, 'b: 'a> Iterator for PropertyIterator<'a, 'b> {
/// ```
#[cfg(any(feature = "std", test))]
pub fn print_resolved(iter: PropertyIterator<'_, '_>, indent: usize) {
print_resolved_with_limits(iter, indent, 100, 1000000);
print_resolved_with_limits(iter, indent, 100, 1_000_000);
}

/// Print a resolved [`PropertyIterator`] with depth and item limits to prevent infinite expansion.
Expand Down
5 changes: 2 additions & 3 deletions src/deserializer/typedstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,8 @@ impl<'a> TypedStreamDeserializer<'a> {
}

// If we did not create any new classes, just return what we found.
let first_idx = match first_new {
None => return Ok(final_parent),
Some(i) => i,
let Some(first_idx) = first_new else {
return Ok(final_parent);
};

// Patch the outer-most newly created class so that it points to the
Expand Down
6 changes: 3 additions & 3 deletions src/models/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ pub enum Type<'a> {
impl<'a> Type<'a> {
/// Convert a byte to a Type enum variant
#[inline]
pub(crate) fn from_byte(byte: &u8) -> Self {
match *byte {
pub(crate) fn from_byte(byte: u8) -> Self {
match byte {
0x40 => Self::Object,
0x2B => Self::Utf8String,
0x2A => Self::EmbeddedData,
Expand Down Expand Up @@ -128,7 +128,7 @@ impl<'a> Type<'a> {
}

Ok(Consumed::new(
type_bytes.iter().map(Type::from_byte).collect(),
type_bytes.iter().copied().map(Type::from_byte).collect(),
type_length.bytes_consumed + type_bytes.len(),
))
}
Expand Down