From fbfbedb6a89825bec107b2f0b8fc6fed8042321d Mon Sep 17 00:00:00 2001 From: Ricky Han Date: Wed, 2 Nov 2022 05:54:34 +0000 Subject: [PATCH] cargo fmt --- aya/src/maps/array/array.rs | 3 ++- aya/src/maps/bloom_filter.rs | 2 +- aya/src/maps/hash_map/hash_map.rs | 10 ++++++++-- aya/src/maps/hash_map/per_cpu_hash_map.rs | 10 ++++++++-- aya/src/maps/lpm_trie.rs | 10 ++++++++-- aya/src/maps/queue.rs | 3 ++- aya/src/maps/sock/sock_hash.rs | 10 ++++++++-- aya/src/maps/stack.rs | 3 ++- bpf/aya-bpf/src/maps/sock_hash.rs | 2 +- 9 files changed, 40 insertions(+), 13 deletions(-) diff --git a/aya/src/maps/array/array.rs b/aya/src/maps/array/array.rs index f5a3d449..f38d992c 100644 --- a/aya/src/maps/array/array.rs +++ b/aya/src/maps/array/array.rs @@ -1,6 +1,7 @@ use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, - marker::PhantomData, borrow::Borrow, + marker::PhantomData, }; use crate::{ diff --git a/aya/src/maps/bloom_filter.rs b/aya/src/maps/bloom_filter.rs index 78c71e2f..9532974c 100644 --- a/aya/src/maps/bloom_filter.rs +++ b/aya/src/maps/bloom_filter.rs @@ -1,5 +1,5 @@ //! A Bloom Filter. -use std::{convert::AsRef, marker::PhantomData, borrow::Borrow}; +use std::{borrow::Borrow, convert::AsRef, marker::PhantomData}; use crate::{ maps::{check_v_size, MapData, MapError}, diff --git a/aya/src/maps/hash_map/hash_map.rs b/aya/src/maps/hash_map/hash_map.rs index 601502e3..3745865e 100644 --- a/aya/src/maps/hash_map/hash_map.rs +++ b/aya/src/maps/hash_map/hash_map.rs @@ -1,6 +1,7 @@ use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, - marker::PhantomData, borrow::Borrow, + marker::PhantomData, }; use crate::{ @@ -78,7 +79,12 @@ impl, K: Pod, V: Pod> HashMap { impl, K: Pod, V: Pod> HashMap { /// Inserts a key-value pair into the map. - pub fn insert(&mut self, key: impl Borrow, value: impl Borrow, flags: u64) -> Result<(), MapError> { + pub fn insert( + &mut self, + key: impl Borrow, + value: impl Borrow, + flags: u64, + ) -> Result<(), MapError> { hash_map::insert(self.inner.as_mut(), &key, &value, flags) } diff --git a/aya/src/maps/hash_map/per_cpu_hash_map.rs b/aya/src/maps/hash_map/per_cpu_hash_map.rs index 194f66c4..f56c232f 100644 --- a/aya/src/maps/hash_map/per_cpu_hash_map.rs +++ b/aya/src/maps/hash_map/per_cpu_hash_map.rs @@ -1,7 +1,8 @@ //! Per-CPU hash map. use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, - marker::PhantomData, borrow::Borrow, + marker::PhantomData, }; use crate::{ @@ -115,7 +116,12 @@ impl, K: Pod, V: Pod> PerCpuHashMap { /// )?; /// # Ok::<(), Error>(()) /// ``` - pub fn insert(&mut self, key: impl Borrow, values: PerCpuValues, flags: u64) -> Result<(), MapError> { + pub fn insert( + &mut self, + key: impl Borrow, + values: PerCpuValues, + flags: u64, + ) -> Result<(), MapError> { let fd = self.inner.as_mut().fd_or_err()?; bpf_map_update_elem_per_cpu(fd, &key, &values, flags).map_err(|(_, io_error)| { MapError::SyscallError { diff --git a/aya/src/maps/lpm_trie.rs b/aya/src/maps/lpm_trie.rs index 3555d036..505fbc5d 100644 --- a/aya/src/maps/lpm_trie.rs +++ b/aya/src/maps/lpm_trie.rs @@ -1,8 +1,9 @@ //! A LPM Trie. use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, marker::PhantomData, - mem, borrow::Borrow, + mem, }; use crate::{ @@ -128,7 +129,12 @@ impl, K: Pod, V: Pod> LpmTrie { impl, K: Pod, V: Pod> LpmTrie { /// Inserts a key value pair into the map. - pub fn insert(&mut self, key: &Key, value: impl Borrow, flags: u64) -> Result<(), MapError> { + pub fn insert( + &mut self, + key: &Key, + value: impl Borrow, + flags: u64, + ) -> Result<(), MapError> { let fd = self.inner.as_mut().fd_or_err()?; bpf_map_update_elem(fd, Some(key), &value, flags).map_err(|(_, io_error)| { MapError::SyscallError { diff --git a/aya/src/maps/queue.rs b/aya/src/maps/queue.rs index 383659f1..2e6d3ba1 100644 --- a/aya/src/maps/queue.rs +++ b/aya/src/maps/queue.rs @@ -1,7 +1,8 @@ //! A FIFO queue. use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, - marker::PhantomData, borrow::Borrow, + marker::PhantomData, }; use crate::{ diff --git a/aya/src/maps/sock/sock_hash.rs b/aya/src/maps/sock/sock_hash.rs index 74659fb2..08366530 100644 --- a/aya/src/maps/sock/sock_hash.rs +++ b/aya/src/maps/sock/sock_hash.rs @@ -1,7 +1,8 @@ use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, marker::PhantomData, - os::unix::io::{AsRawFd, RawFd}, borrow::Borrow, + os::unix::io::{AsRawFd, RawFd}, }; use crate::{ @@ -115,7 +116,12 @@ impl, K: Pod> SockHash { impl, K: Pod> SockHash { /// Inserts a socket under the given key. - pub fn insert(&mut self, key: impl Borrow, value: I, flags: u64) -> Result<(), MapError> { + pub fn insert( + &mut self, + key: impl Borrow, + value: I, + flags: u64, + ) -> Result<(), MapError> { hash_map::insert(self.inner.as_mut(), &key, &value.as_raw_fd(), flags) } diff --git a/aya/src/maps/stack.rs b/aya/src/maps/stack.rs index 9d48e1c3..ff156c0e 100644 --- a/aya/src/maps/stack.rs +++ b/aya/src/maps/stack.rs @@ -1,7 +1,8 @@ //! A LIFO stack. use std::{ + borrow::Borrow, convert::{AsMut, AsRef}, - marker::PhantomData, borrow::Borrow, + marker::PhantomData, }; use crate::{ diff --git a/bpf/aya-bpf/src/maps/sock_hash.rs b/bpf/aya-bpf/src/maps/sock_hash.rs index aacfda66..39eedcce 100644 --- a/bpf/aya-bpf/src/maps/sock_hash.rs +++ b/bpf/aya-bpf/src/maps/sock_hash.rs @@ -1,4 +1,4 @@ -use core::{cell::UnsafeCell, marker::PhantomData, mem, borrow::Borrow}; +use core::{borrow::Borrow, cell::UnsafeCell, marker::PhantomData, mem}; use aya_bpf_cty::c_void;