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
2 changes: 1 addition & 1 deletion lib/opte/src/d_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl<const L: usize> LabelBlock<L> {
}

/// Provides access to all stored [`CStr`]s.
pub fn entries<'a>(&'a self) -> LabelBlockIter<'a, L> {
pub fn entries(&self) -> LabelBlockIter<'_, L> {
LabelBlockIter { pos: 0, inner: self }
}

Expand Down
14 changes: 7 additions & 7 deletions lib/opte/src/engine/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ impl PacketChain {

/// Removes the next packet from the top of the chain and returns
/// it, taking ownership.
pub fn next(&mut self) -> Option<Packet<Initialized>> {
pub fn pop_front(&mut self) -> Option<Packet<Initialized>> {
if let Some(ref mut list) = &mut self.inner {
unsafe {
let curr = list.head.as_ptr();
Expand Down Expand Up @@ -554,7 +554,7 @@ impl Drop for PacketChain {
unsafe { ddi::freemsgchain(list.head.as_ptr()) };
}
} else {
while let Some(pkt) = self.next() {
while let Some(pkt) = self.pop_front() {
drop(pkt);
}
}
Expand Down Expand Up @@ -3945,7 +3945,7 @@ mod test {

fn create_linked_mblks(n: usize) -> Vec<*mut mblk_t> {
let mut els = vec![];
for i in 0..n {
for _ in 0..n {
els.push(allocb(8));
}

Expand All @@ -3962,7 +3962,7 @@ mod test {

#[test]
fn chain_has_correct_ends() {
let mut els = create_linked_mblks(3);
let els = create_linked_mblks(3);

let chain = unsafe { PacketChain::new(els[0]) }.unwrap();
let chain_inner = chain.inner.as_ref().unwrap();
Expand All @@ -3976,7 +3976,7 @@ mod test {

let mut chain = unsafe { PacketChain::new(els[0]) }.unwrap();

let p0 = chain.next().unwrap();
let p0 = chain.pop_front().unwrap();
assert_eq!(p0.mblk_addr(), els[0] as uintptr_t);
unsafe {
assert!((*els[0]).b_prev.is_null());
Expand Down Expand Up @@ -4024,10 +4024,10 @@ mod test {
let mut chain = unsafe { PacketChain::new(els[0]) }.unwrap();

for i in 0..els.len() {
let pkt = chain.next().unwrap();
let pkt = chain.pop_front().unwrap();
assert_eq!(pkt.mblk_addr(), els[i] as uintptr_t);
}

assert!(chain.next().is_none());
assert!(chain.pop_front().is_none());
}
}
2 changes: 1 addition & 1 deletion lib/opte/src/engine/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ impl<'a> Rule<Finalized> {
#[cfg(debug_assertions)]
{
if let Some(preds) = &self.state.preds {
if preds.hdr_preds.len() == 0 && preds.data_preds.len() == 0 {
if preds.hdr_preds.is_empty() && preds.data_preds.is_empty() {
panic!(
"bug: RulePredicates must have at least one \
predicate"
Expand Down
3 changes: 2 additions & 1 deletion xde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// Copyright 2022 Oxide Computer Company
// Copyright 2024 Oxide Computer Company

// xde - A mac provider for OPTE-based network implementations.
#![feature(extern_types)]
Expand Down Expand Up @@ -44,6 +44,7 @@ pub mod dls;
pub mod ip;
pub mod mac;
mod mac_sys;
pub mod route;
pub mod secpolicy;
pub mod sys;
pub mod xde;
Expand Down
Loading