diff --git a/dnp3/src/app/attr.rs b/dnp3/src/app/attr.rs index 17854390..07e7b877 100644 --- a/dnp3/src/app/attr.rs +++ b/dnp3/src/app/attr.rs @@ -892,10 +892,7 @@ impl<'a> Iterator for VariationListIter<'a> { let variation = *self.data.first()?; let prop = *self.data.get(1)?; - self.data = match self.data.get(2..) { - Some(x) => x, - None => &[], - }; + self.data = self.data.get(2..).unwrap_or_default(); Some(AttrItem { variation, diff --git a/dnp3/src/outstation/database/details/event/buffer.rs b/dnp3/src/outstation/database/details/event/buffer.rs index 5210646b..448fa0db 100644 --- a/dnp3/src/outstation/database/details/event/buffer.rs +++ b/dnp3/src/outstation/database/details/event/buffer.rs @@ -682,7 +682,7 @@ impl EventBuffer { .events .iter() .filter(|(_, e)| e.state.get() == EventState::Unselected && selector(e)) - .take(limit.unwrap_or(usize::max_value())) + .take(limit.unwrap_or(usize::MAX)) { evt.state.set(EventState::Selected); count += 1; diff --git a/dnp3/src/outstation/database/details/event/write_fn.rs b/dnp3/src/outstation/database/details/event/write_fn.rs index 5af0fb43..67d084f8 100644 --- a/dnp3/src/outstation/database/details/event/write_fn.rs +++ b/dnp3/src/outstation/database/details/event/write_fn.rs @@ -66,7 +66,7 @@ where let difference: u64 = time.timestamp().raw_value() - cto.timestamp().raw_value(); // too big of a difference to encode - if difference > u16::max_value().into() { + if difference > u16::MAX.into() { return Ok(Continue::NewHeader); }