Browse Source

cargo fmt

Ricky Han 2 years ago
parent
commit
fbfbedb6a8

+ 2 - 1
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::{

+ 1 - 1
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},

+ 8 - 2
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<T: AsRef<MapData>, K: Pod, V: Pod> HashMap<T, K, V> {
 
 impl<T: AsMut<MapData>, K: Pod, V: Pod> HashMap<T, K, V> {
     /// Inserts a key-value pair into the map.
-    pub fn insert(&mut self, key: impl Borrow<K>, value: impl Borrow<V>, flags: u64) -> Result<(), MapError> {
+    pub fn insert(
+        &mut self,
+        key: impl Borrow<K>,
+        value: impl Borrow<V>,
+        flags: u64,
+    ) -> Result<(), MapError> {
         hash_map::insert(self.inner.as_mut(), &key, &value, flags)
     }
 

+ 8 - 2
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<T: AsMut<MapData>, K: Pod, V: Pod> PerCpuHashMap<T, K, V> {
     /// )?;
     /// # Ok::<(), Error>(())
     /// ```
-    pub fn insert(&mut self, key: impl Borrow<K>, values: PerCpuValues<V>, flags: u64) -> Result<(), MapError> {
+    pub fn insert(
+        &mut self,
+        key: impl Borrow<K>,
+        values: PerCpuValues<V>,
+        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 {

+ 8 - 2
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<T: AsRef<MapData>, K: Pod, V: Pod> LpmTrie<T, K, V> {
 
 impl<T: AsMut<MapData>, K: Pod, V: Pod> LpmTrie<T, K, V> {
     /// Inserts a key value pair into the map.
-    pub fn insert(&mut self, key: &Key<K>, value: impl Borrow<V>, flags: u64) -> Result<(), MapError> {
+    pub fn insert(
+        &mut self,
+        key: &Key<K>,
+        value: impl Borrow<V>,
+        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 {

+ 2 - 1
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::{

+ 8 - 2
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<T: AsRef<MapData>, K: Pod> SockHash<T, K> {
 
 impl<T: AsMut<MapData>, K: Pod> SockHash<T, K> {
     /// Inserts a socket under the given key.
-    pub fn insert<I: AsRawFd>(&mut self, key: impl Borrow<K>, value: I, flags: u64) -> Result<(), MapError> {
+    pub fn insert<I: AsRawFd>(
+        &mut self,
+        key: impl Borrow<K>,
+        value: I,
+        flags: u64,
+    ) -> Result<(), MapError> {
         hash_map::insert(self.inner.as_mut(), &key, &value.as_raw_fd(), flags)
     }
 

+ 2 - 1
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::{

+ 1 - 1
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;