Bläddra i källkod

Change from Rust edition 2018 to 2021

Rust 2021 adds more core prelude imports, including `TryFrom` and
`TryInto`.

Signed-off-by: Michal Rostecki <[email protected]>
Michal Rostecki 2 år sedan
förälder
incheckning
944d6b8a16
65 ändrade filer med 24 tillägg och 102 borttagningar
  1. 0 1
      README.md
  2. 1 1
      aya-bpf-macros/Cargo.toml
  3. 1 1
      aya-gen/Cargo.toml
  4. 1 1
      aya-log-common/Cargo.toml
  5. 1 1
      aya-log-ebpf-macros/Cargo.toml
  6. 1 1
      aya-log/Cargo.toml
  7. 1 1
      aya-log/src/lib.rs
  8. 1 1
      aya/Cargo.toml
  9. 0 1
      aya/README.md
  10. 0 2
      aya/src/bpf.rs
  11. 0 2
      aya/src/maps/array/array.rs
  12. 0 2
      aya/src/maps/array/per_cpu_array.rs
  13. 0 2
      aya/src/maps/array/program_array.rs
  14. 1 2
      aya/src/maps/bloom_filter.rs
  15. 0 2
      aya/src/maps/hash_map/hash_map.rs
  16. 0 3
      aya/src/maps/hash_map/per_cpu_hash_map.rs
  17. 1 4
      aya/src/maps/lpm_trie.rs
  18. 0 3
      aya/src/maps/mod.rs
  19. 0 2
      aya/src/maps/perf/async_perf_event_array.rs
  20. 1 1
      aya/src/maps/perf/perf_buffer.rs
  21. 0 2
      aya/src/maps/perf/perf_event_array.rs
  22. 0 2
      aya/src/maps/queue.rs
  23. 0 2
      aya/src/maps/sock/sock_hash.rs
  24. 0 2
      aya/src/maps/sock/sock_map.rs
  25. 0 2
      aya/src/maps/stack.rs
  26. 1 4
      aya/src/maps/stack_trace.rs
  27. 0 1
      aya/src/obj/btf/btf.rs
  28. 1 1
      aya/src/obj/btf/info.rs
  29. 1 6
      aya/src/obj/btf/relocation.rs
  30. 1 5
      aya/src/obj/btf/types.rs
  31. 0 1
      aya/src/obj/mod.rs
  32. 0 1
      aya/src/programs/cgroup_skb.rs
  33. 0 1
      aya/src/programs/cgroup_sock.rs
  34. 0 1
      aya/src/programs/cgroup_sock_addr.rs
  35. 0 1
      aya/src/programs/cgroup_sockopt.rs
  36. 0 1
      aya/src/programs/cgroup_sysctl.rs
  37. 0 1
      aya/src/programs/extension.rs
  38. 0 1
      aya/src/programs/fentry.rs
  39. 0 1
      aya/src/programs/fexit.rs
  40. 0 1
      aya/src/programs/kprobe.rs
  41. 0 1
      aya/src/programs/lirc_mode2.rs
  42. 0 1
      aya/src/programs/lsm.rs
  43. 0 2
      aya/src/programs/mod.rs
  44. 0 1
      aya/src/programs/perf_event.rs
  45. 0 1
      aya/src/programs/raw_trace_point.rs
  46. 0 1
      aya/src/programs/sk_lookup.rs
  47. 0 1
      aya/src/programs/sk_msg.rs
  48. 0 1
      aya/src/programs/sk_skb.rs
  49. 0 1
      aya/src/programs/sock_ops.rs
  50. 0 1
      aya/src/programs/socket_filter.rs
  51. 0 1
      aya/src/programs/tc.rs
  52. 0 1
      aya/src/programs/tp_btf.rs
  53. 0 1
      aya/src/programs/trace_point.rs
  54. 0 1
      aya/src/programs/xdp.rs
  55. 1 1
      aya/src/sys/mod.rs
  56. 1 1
      aya/src/sys/netlink.rs
  57. 1 1
      bpf/aya-bpf-bindings/Cargo.toml
  58. 1 1
      bpf/aya-bpf/Cargo.toml
  59. 1 1
      bpf/aya-log-ebpf/Cargo.toml
  60. 1 1
      test/integration-ebpf/Cargo.toml
  61. 1 1
      test/integration-test-macros/Cargo.toml
  62. 1 1
      test/integration-test/Cargo.toml
  63. 1 5
      test/integration-test/src/tests/load.rs
  64. 0 2
      test/integration-test/src/tests/smoke.rs
  65. 1 1
      xtask/Cargo.toml

+ 0 - 1
README.md

@@ -75,7 +75,6 @@ Aya supports a large chunk of the eBPF API. The following example shows how to u
 
 ```rust
 use std::fs::File;
-use std::convert::TryInto;
 use aya::Bpf;
 use aya::programs::{CgroupSkb, CgroupSkbAttachType};
 

+ 1 - 1
aya-bpf-macros/Cargo.toml

@@ -2,7 +2,7 @@
 name = "aya-bpf-macros"
 version = "0.1.0"
 authors = ["Alessandro Decina <[email protected]>"]
-edition = "2018"
+edition = "2021"
 
 [lib]
 proc-macro = true

+ 1 - 1
aya-gen/Cargo.toml

@@ -2,7 +2,7 @@
 name = "aya-gen"
 version = "0.1.0"
 authors = ["Alessandro Decina <[email protected]>"]
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 bindgen = "0.60"

+ 1 - 1
aya-log-common/Cargo.toml

@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
 authors = ["The Aya Contributors"]
 repository = "https://github.com/aya-rs/aya-log"
 documentation = "https://docs.rs/aya-log"
-edition = "2018"
+edition = "2021"
 
 [features]
 default = []

+ 1 - 1
aya-log-ebpf-macros/Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 name = "aya-log-ebpf-macros"
 version = "0.1.0"
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 proc-macro2 = "1.0"

+ 1 - 1
aya-log/Cargo.toml

@@ -8,7 +8,7 @@ authors = ["The Aya Contributors"]
 repository = "https://github.com/aya-rs/aya-log"
 readme = "README.md"
 documentation = "https://docs.rs/aya-log"
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 aya = { path = "../aya", version = "0.11.0", features=["async_tokio"] }

+ 1 - 1
aya-log/src/lib.rs

@@ -49,7 +49,7 @@
 //! [Log]: https://docs.rs/log/0.4.14/log/trait.Log.html
 //! [log]: https://docs.rs/log
 //!
-use std::{convert::TryInto, io, mem, ptr, str, sync::Arc};
+use std::{io, mem, ptr, str, sync::Arc};
 
 use aya_log_common::{ArgType, RecordField, LOG_BUF_CAPACITY, LOG_FIELDS};
 use bytes::BytesMut;

+ 1 - 1
aya/Cargo.toml

@@ -8,7 +8,7 @@ authors = ["The Aya Contributors"]
 repository = "https://github.com/aya-rs/aya"
 readme = "README.md"
 documentation = "https://docs.rs/aya"
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 libc = { version = "0.2.105" }

+ 0 - 1
aya/README.md

@@ -75,7 +75,6 @@ Aya supports a large chunk of the eBPF API. The following example shows how to u
 
 ```rust
 use std::fs::File;
-use std::convert::TryInto;
 use aya::Bpf;
 use aya::programs::{CgroupSkb, CgroupSkbAttachType};
 

+ 0 - 2
aya/src/bpf.rs

@@ -1,7 +1,6 @@
 use std::{
     borrow::Cow,
     collections::{HashMap, HashSet},
-    convert::TryFrom,
     error::Error,
     ffi::CString,
     fs, io,
@@ -743,7 +742,6 @@ impl Bpf {
     /// ```no_run
     /// # let mut bpf = aya::Bpf::load(&[])?;
     /// use aya::programs::UProbe;
-    /// use std::convert::TryInto;
     ///
     /// let program: &mut UProbe = bpf.program_mut("SSL_read").unwrap().try_into()?;
     /// program.load()?;

+ 0 - 2
aya/src/maps/array/array.rs

@@ -1,5 +1,4 @@
 use std::{
-    convert::TryFrom,
     marker::PhantomData,
     mem,
     ops::{Deref, DerefMut},
@@ -25,7 +24,6 @@ use crate::{
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::Array;
-/// use std::convert::TryFrom;
 ///
 /// let mut array = Array::try_from(bpf.map_mut("ARRAY")?)?;
 /// array.set(1, 42, 0)?;

+ 0 - 2
aya/src/maps/array/per_cpu_array.rs

@@ -1,5 +1,4 @@
 use std::{
-    convert::TryFrom,
     marker::PhantomData,
     mem,
     ops::{Deref, DerefMut},
@@ -35,7 +34,6 @@ use crate::{
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::{PerCpuArray, PerCpuValues};
 /// use aya::util::nr_cpus;
-/// use std::convert::TryFrom;
 ///
 /// let mut array = PerCpuArray::try_from(bpf.map_mut("ARRAY")?)?;
 ///

+ 0 - 2
aya/src/maps/array/program_array.rs

@@ -1,7 +1,6 @@
 //! An array of eBPF program file descriptors used as a jump table.
 
 use std::{
-    convert::TryFrom,
     mem,
     ops::{Deref, DerefMut},
     os::unix::prelude::{AsRawFd, RawFd},
@@ -29,7 +28,6 @@ use crate::{
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::ProgramArray;
 /// use aya::programs::CgroupSkb;
-/// use std::convert::{TryFrom, TryInto};
 ///
 /// let mut prog_array = ProgramArray::try_from(bpf.map_mut("JUMP_TABLE")?)?;
 /// let prog_0: &CgroupSkb = bpf.program("example_prog_0").unwrap().try_into()?;

+ 1 - 2
aya/src/maps/bloom_filter.rs

@@ -1,5 +1,5 @@
 //! A Bloom Filter.
-use std::{convert::TryFrom, marker::PhantomData, ops::Deref};
+use std::{marker::PhantomData, ops::Deref};
 
 use core::mem;
 
@@ -21,7 +21,6 @@ use crate::{
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::bloom_filter::BloomFilter;
-/// use std::convert::TryFrom;
 ///
 /// let mut bloom_filter = BloomFilter::try_from(bpf.map_mut("BLOOM_FILTER")?)?;
 ///

+ 0 - 2
aya/src/maps/hash_map/hash_map.rs

@@ -1,5 +1,4 @@
 use std::{
-    convert::TryFrom,
     marker::PhantomData,
     ops::{Deref, DerefMut},
 };
@@ -22,7 +21,6 @@ use crate::{
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::HashMap;
-/// use std::convert::TryFrom;
 ///
 /// let mut redirect_ports = HashMap::try_from(bpf.map_mut("REDIRECT_PORTS")?)?;
 ///

+ 0 - 3
aya/src/maps/hash_map/per_cpu_hash_map.rs

@@ -1,6 +1,5 @@
 //! Per-CPU hash map.
 use std::{
-    convert::TryFrom,
     marker::PhantomData,
     ops::{Deref, DerefMut},
 };
@@ -29,7 +28,6 @@ use crate::{
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::PerCpuHashMap;
-/// use std::convert::TryFrom;
 ///
 /// const CPU_IDS: u8 = 1;
 /// const WAKEUPS: u8 = 2;
@@ -116,7 +114,6 @@ impl<T: DerefMut<Target = Map>, K: Pod, V: Pod> PerCpuHashMap<T, K, V> {
     /// # let bpf = aya::Bpf::load(&[])?;
     /// use aya::maps::{PerCpuHashMap, PerCpuValues};
     /// use aya::util::nr_cpus;
-    /// use std::convert::TryFrom;
     ///
     /// const RETRIES: u8 = 1;
     ///

+ 1 - 4
aya/src/maps/lpm_trie.rs

@@ -1,5 +1,5 @@
 //! A LPM Trie.
-use std::{convert::TryFrom, marker::PhantomData, mem, ops::Deref};
+use std::{marker::PhantomData, mem, ops::Deref};
 
 use crate::{
     generated::bpf_map_type::BPF_MAP_TYPE_LPM_TRIE,
@@ -19,7 +19,6 @@ use crate::{
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::lpm_trie::{LpmTrie, Key};
-/// use std::convert::TryFrom;
 /// use std::net::Ipv4Addr;
 ///
 /// let mut trie = LpmTrie::try_from(bpf.map_mut("LPM_TRIE")?)?;
@@ -56,7 +55,6 @@ pub struct LpmTrie<T: Deref<Target = Map>, K, V> {
 ///
 /// ```no_run
 /// use aya::maps::lpm_trie::{LpmTrie, Key};
-/// use std::convert::TryFrom;
 /// use std::net::Ipv4Addr;
 ///
 /// let ipaddr = Ipv4Addr::new(8,8,8,8);
@@ -77,7 +75,6 @@ impl<K: Pod> Key<K> {
     ///
     /// ```no_run
     /// use aya::maps::lpm_trie::{LpmTrie, Key};
-    /// use std::convert::TryFrom;
     /// use std::net::Ipv4Addr;
     ///
     /// let ipaddr = Ipv4Addr::new(8, 8, 8, 8);

+ 0 - 3
aya/src/maps/mod.rs

@@ -16,7 +16,6 @@
 //!
 //! ```no_run
 //! # let mut bpf = aya::Bpf::load(&[])?;
-//! use std::convert::{TryFrom, TryInto};
 //! use aya::maps::SockMap;
 //! use aya::programs::SkMsg;
 //!
@@ -33,7 +32,6 @@
 //! versa. Because of that, all map values must be plain old data and therefore
 //! implement the [Pod] trait.
 use std::{
-    convert::{TryFrom, TryInto},
     ffi::CString,
     fmt, io,
     marker::PhantomData,
@@ -523,7 +521,6 @@ impl PerCpuKernelMem {
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::PerCpuValues;
 /// use aya::util::nr_cpus;
-/// use std::convert::TryFrom;
 ///
 /// let values = PerCpuValues::try_from(vec![42u32; nr_cpus()?])?;
 /// # Ok::<(), Error>(())

+ 0 - 2
aya/src/maps/perf/async_perf_event_array.rs

@@ -1,6 +1,5 @@
 use bytes::BytesMut;
 use std::{
-    convert::TryFrom,
     ops::DerefMut,
     os::unix::prelude::{AsRawFd, RawFd},
 };
@@ -49,7 +48,6 @@ use crate::maps::{
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::perf::{AsyncPerfEventArray, PerfBufferError};
 /// use aya::util::online_cpus;
-/// use std::convert::TryFrom;
 /// use futures::future;
 /// use bytes::BytesMut;
 /// use tokio::task; // or async_std::task

+ 1 - 1
aya/src/maps/perf/perf_buffer.rs

@@ -318,7 +318,7 @@ mod tests {
         generated::perf_event_mmap_page,
         sys::{override_syscall, Syscall, TEST_MMAP_RET},
     };
-    use std::{convert::TryInto, fmt::Debug, mem};
+    use std::{fmt::Debug, mem};
 
     const PAGE_SIZE: usize = 4096;
     union MMappedBuf {

+ 0 - 2
aya/src/maps/perf/perf_event_array.rs

@@ -2,7 +2,6 @@
 //!
 //! [`perf`]: https://perf.wiki.kernel.org/index.php/Main_Page.
 use std::{
-    convert::TryFrom,
     ops::DerefMut,
     os::unix::io::{AsRawFd, RawFd},
     sync::Arc,
@@ -109,7 +108,6 @@ impl<T: DerefMut<Target = Map>> AsRawFd for PerfEventArrayBuffer<T> {
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::PerfEventArray;
 /// use aya::util::online_cpus;
-/// use std::convert::{TryFrom, TryInto};
 /// use bytes::BytesMut;
 ///
 /// let mut perf_array = PerfEventArray::try_from(bpf.map_mut("EVENTS")?)?;

+ 0 - 2
aya/src/maps/queue.rs

@@ -1,6 +1,5 @@
 //! A FIFO queue.
 use std::{
-    convert::TryFrom,
     marker::PhantomData,
     mem,
     ops::{Deref, DerefMut},
@@ -23,7 +22,6 @@ use crate::{
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::Queue;
-/// use std::convert::TryFrom;
 ///
 /// let mut queue = Queue::try_from(bpf.map_mut("ARRAY")?)?;
 /// queue.push(42, 0)?;

+ 0 - 2
aya/src/maps/sock/sock_hash.rs

@@ -1,5 +1,4 @@
 use std::{
-    convert::TryFrom,
     marker::PhantomData,
     ops::{Deref, DerefMut},
     os::unix::io::{AsRawFd, RawFd},
@@ -42,7 +41,6 @@ use crate::{
 /// #     Bpf(#[from] aya::BpfError)
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::{TryFrom, TryInto};
 /// use std::io::Write;
 /// use std::net::TcpStream;
 /// use std::os::unix::io::AsRawFd;

+ 0 - 2
aya/src/maps/sock/sock_map.rs

@@ -1,7 +1,6 @@
 //! An array of eBPF program file descriptors used as a jump table.
 
 use std::{
-    convert::TryFrom,
     mem,
     ops::{Deref, DerefMut},
     os::unix::{io::AsRawFd, prelude::RawFd},
@@ -30,7 +29,6 @@ use crate::{
 ///
 /// ```no_run
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::{TryFrom, TryInto};
 /// use aya::maps::SockMap;
 /// use aya::programs::SkSkb;
 ///

+ 0 - 2
aya/src/maps/stack.rs

@@ -1,6 +1,5 @@
 //! A LIFO stack.
 use std::{
-    convert::TryFrom,
     marker::PhantomData,
     mem,
     ops::{Deref, DerefMut},
@@ -23,7 +22,6 @@ use crate::{
 /// ```no_run
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::Stack;
-/// use std::convert::TryFrom;
 ///
 /// let mut stack = Stack::try_from(bpf.map_mut("STACK")?)?;
 /// stack.push(42, 0)?;

+ 1 - 4
aya/src/maps/stack_trace.rs

@@ -1,9 +1,7 @@
 //! A hash map of kernel or user space stack traces.
 //!
 //! See [`StackTraceMap`] for documentation and examples.
-use std::{
-    collections::BTreeMap, convert::TryFrom, fs, io, mem, ops::Deref, path::Path, str::FromStr,
-};
+use std::{collections::BTreeMap, fs, io, mem, ops::Deref, path::Path, str::FromStr};
 
 use crate::{
     generated::bpf_map_type::BPF_MAP_TYPE_STACK_TRACE,
@@ -37,7 +35,6 @@ use crate::{
 /// # let bpf = aya::Bpf::load(&[])?;
 /// use aya::maps::StackTraceMap;
 /// use aya::util::kernel_symbols;
-/// use std::convert::TryFrom;
 ///
 /// let mut stack_traces = StackTraceMap::try_from(bpf.map("STACK_TRACES")?)?;
 /// // load kernel symbols from /proc/kallsyms

+ 0 - 1
aya/src/obj/btf/btf.rs

@@ -1,7 +1,6 @@
 use std::{
     borrow::Cow,
     collections::HashMap,
-    convert::TryInto,
     ffi::{c_void, CStr, CString},
     fs, io, mem,
     path::{Path, PathBuf},

+ 1 - 1
aya/src/obj/btf/info.rs

@@ -1,4 +1,4 @@
-use std::{collections::HashMap, convert::TryInto};
+use std::collections::HashMap;
 
 use bytes::BufMut;
 use object::Endianness;

+ 1 - 6
aya/src/obj/btf/relocation.rs

@@ -1,9 +1,4 @@
-use std::{
-    collections::HashMap,
-    convert::{TryFrom, TryInto},
-    io, mem, ptr,
-    str::FromStr,
-};
+use std::{collections::HashMap, io, mem, ptr, str::FromStr};
 
 use thiserror::Error;
 

+ 1 - 5
aya/src/obj/btf/types.rs

@@ -1,8 +1,4 @@
-use std::{
-    convert::{TryFrom, TryInto},
-    fmt::Display,
-    mem, ptr,
-};
+use std::{fmt::Display, mem, ptr};
 
 use object::Endianness;
 

+ 0 - 1
aya/src/obj/mod.rs

@@ -9,7 +9,6 @@ use object::{
 };
 use std::{
     collections::HashMap,
-    convert::{TryFrom, TryInto},
     ffi::{CStr, CString},
     mem, ptr,
     str::FromStr,

+ 0 - 1
aya/src/programs/cgroup_skb.rs

@@ -44,7 +44,6 @@ use crate::{
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::{CgroupSkb, CgroupSkbAttachType};
 ///
 /// let file = File::open("/sys/fs/cgroup/unified")?;

+ 0 - 1
aya/src/programs/cgroup_sock.rs

@@ -43,7 +43,6 @@ use crate::{
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::{CgroupSock, CgroupSockAttachType};
 ///
 /// let file = File::open("/sys/fs/cgroup/unified")?;

+ 0 - 1
aya/src/programs/cgroup_sock_addr.rs

@@ -44,7 +44,6 @@ use crate::{
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::{CgroupSockAddr, CgroupSockAddrAttachType};
 ///
 /// let file = File::open("/sys/fs/cgroup/unified")?;

+ 0 - 1
aya/src/programs/cgroup_sockopt.rs

@@ -40,7 +40,6 @@ use crate::{
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::CgroupSockopt;
 ///
 /// let file = File::open("/sys/fs/cgroup/unified")?;

+ 0 - 1
aya/src/programs/cgroup_sysctl.rs

@@ -38,7 +38,6 @@ use crate::{
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::CgroupSysctl;
 ///
 /// let file = File::open("/sys/fs/cgroup/unified")?;

+ 0 - 1
aya/src/programs/extension.rs

@@ -36,7 +36,6 @@ pub enum ExtensionError {
 ///
 /// ```no_run
 /// use aya::{BpfLoader, programs::{Xdp, XdpFlags, Extension}};
-/// use std::convert::TryInto;
 ///
 /// let mut bpf = BpfLoader::new().extension("extension").load_file("app.o")?;
 /// let prog: &mut Xdp = bpf.program_mut("main").unwrap().try_into()?;

+ 0 - 1
aya/src/programs/fentry.rs

@@ -35,7 +35,6 @@ use crate::{
 /// # }
 /// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 /// use aya::{Bpf, programs::FEntry, BtfError, Btf};
-/// use std::convert::TryInto;
 ///
 /// let btf = Btf::from_sys_fs()?;
 /// let program: &mut FEntry = bpf.program_mut("filename_lookup").unwrap().try_into()?;

+ 0 - 1
aya/src/programs/fexit.rs

@@ -35,7 +35,6 @@ use crate::{
 /// # }
 /// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 /// use aya::{Bpf, programs::FExit, BtfError, Btf};
-/// use std::convert::TryInto;
 ///
 /// let btf = Btf::from_sys_fs()?;
 /// let program: &mut FExit = bpf.program_mut("filename_lookup").unwrap().try_into()?;

+ 0 - 1
aya/src/programs/kprobe.rs

@@ -29,7 +29,6 @@ use crate::{
 /// ```no_run
 /// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 /// use aya::{Bpf, programs::KProbe};
-/// use std::convert::TryInto;
 ///
 /// let program: &mut KProbe = bpf.program_mut("intercept_wakeups").unwrap().try_into()?;
 /// program.load()?;

+ 0 - 1
aya/src/programs/lirc_mode2.rs

@@ -36,7 +36,6 @@ use libc::{close, dup};
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::LircMode2;
 ///
 /// let file = File::open("/dev/lirc0")?;

+ 0 - 1
aya/src/programs/lsm.rs

@@ -36,7 +36,6 @@ use crate::{
 /// # }
 /// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 /// use aya::{Bpf, programs::Lsm, BtfError, Btf};
-/// use std::convert::TryInto;
 ///
 /// let btf = Btf::from_sys_fs()?;
 /// let program: &mut Lsm = bpf.program_mut("lsm_prog").unwrap().try_into()?;

+ 0 - 2
aya/src/programs/mod.rs

@@ -15,7 +15,6 @@
 //!
 //! ```no_run
 //! use aya::{Bpf, programs::KProbe};
-//! use std::convert::TryInto;
 //!
 //! let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 //! // intercept_wakeups is the name of the program we want to load
@@ -66,7 +65,6 @@ pub mod xdp;
 
 use libc::ENOSPC;
 use std::{
-    convert::TryFrom,
     ffi::CString,
     io,
     os::unix::io::{AsRawFd, RawFd},

+ 0 - 1
aya/src/programs/perf_event.rs

@@ -97,7 +97,6 @@ pub enum PerfEventScope {
 /// #     Bpf(#[from] aya::BpfError)
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::TryInto;
 /// use aya::util::online_cpus;
 /// use aya::programs::perf_event::{
 ///     perf_sw_ids::PERF_COUNT_SW_CPU_CLOCK, PerfEvent, PerfEventScope, PerfTypeId, SamplePolicy,

+ 0 - 1
aya/src/programs/raw_trace_point.rs

@@ -26,7 +26,6 @@ use crate::{
 /// ```no_run
 /// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 /// use aya::{Bpf, programs::RawTracePoint};
-/// use std::convert::TryInto;
 ///
 /// let program: &mut RawTracePoint = bpf.program_mut("sys_enter").unwrap().try_into()?;
 /// program.load()?;

+ 0 - 1
aya/src/programs/sk_lookup.rs

@@ -36,7 +36,6 @@ use super::links::FdLink;
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::SkLookup;
 ///
 /// let file = File::open("/var/run/netns/test")?;

+ 0 - 1
aya/src/programs/sk_msg.rs

@@ -34,7 +34,6 @@ use crate::{
 /// #     Bpf(#[from] aya::BpfError)
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::{TryFrom, TryInto};
 /// use std::io::Write;
 /// use std::net::TcpStream;
 /// use std::os::unix::io::AsRawFd;

+ 0 - 1
aya/src/programs/sk_skb.rs

@@ -35,7 +35,6 @@ pub enum SkSkbKind {
 ///
 /// ```no_run
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::{TryFrom, TryInto};
 /// use aya::maps::SockMap;
 /// use aya::programs::SkSkb;
 ///

+ 0 - 1
aya/src/programs/sock_ops.rs

@@ -36,7 +36,6 @@ use crate::{
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
 /// use std::fs::File;
-/// use std::convert::TryInto;
 /// use aya::programs::SockOps;
 ///
 /// let file = File::open("/sys/fs/cgroup/unified")?;

+ 0 - 1
aya/src/programs/socket_filter.rs

@@ -47,7 +47,6 @@ pub enum SocketFilterError {
 /// #     Bpf(#[from] aya::BpfError)
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::TryInto;
 /// use std::net::TcpStream;
 /// use std::os::unix::io::AsRawFd;
 /// use aya::programs::SocketFilter;

+ 0 - 1
aya/src/programs/tc.rs

@@ -55,7 +55,6 @@ pub enum TcAttachType {
 /// #     Bpf(#[from] aya::BpfError)
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::TryInto;
 /// use aya::programs::{tc, SchedClassifier, TcAttachType};
 ///
 /// // the clsact qdisc needs to be added before SchedClassifier programs can be

+ 0 - 1
aya/src/programs/tp_btf.rs

@@ -33,7 +33,6 @@ use crate::{
 /// # }
 /// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 /// use aya::{Bpf, programs::BtfTracePoint, BtfError, Btf};
-/// use std::convert::TryInto;
 ///
 /// let btf = Btf::from_sys_fs()?;
 /// let program: &mut BtfTracePoint = bpf.program_mut("sched_process_fork").unwrap().try_into()?;

+ 0 - 1
aya/src/programs/trace_point.rs

@@ -51,7 +51,6 @@ pub enum TracePointError {
 /// #     Bpf(#[from] aya::BpfError)
 /// # }
 /// # let mut bpf = aya::Bpf::load(&[])?;
-/// use std::convert::TryInto;
 /// use aya::programs::TracePoint;
 ///
 /// let prog: &mut TracePoint = bpf.program_mut("trace_context_switch").unwrap().try_into()?;

+ 0 - 1
aya/src/programs/xdp.rs

@@ -62,7 +62,6 @@ bitflags! {
 /// ```no_run
 /// # let mut bpf = Bpf::load_file("ebpf_programs.o")?;
 /// use aya::{Bpf, programs::{Xdp, XdpFlags}};
-/// use std::convert::TryInto;
 ///
 /// let program: &mut Xdp = bpf.program_mut("intercept_packets").unwrap().try_into()?;
 /// program.attach("eth0", XdpFlags::default())?;

+ 1 - 1
aya/src/sys/mod.rs

@@ -7,7 +7,7 @@ mod fake;
 
 use std::io;
 #[cfg(not(test))]
-use std::{convert::TryInto, ffi::CString, mem};
+use std::{ffi::CString, mem};
 
 #[cfg(not(test))]
 use libc::utsname;

+ 1 - 1
aya/src/sys/netlink.rs

@@ -590,7 +590,7 @@ fn bytes_of<T>(val: &T) -> &[u8] {
 
 #[cfg(test)]
 mod tests {
-    use std::{convert::TryInto, ffi::CString};
+    use std::ffi::CString;
 
     use super::*;
 

+ 1 - 1
bpf/aya-bpf-bindings/Cargo.toml

@@ -2,7 +2,7 @@
 name = "aya-bpf-bindings"
 version = "0.1.0"
 authors = ["Alessandro Decina <[email protected]>"]
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 aya-bpf-cty = { path = "../aya-bpf-cty" }

+ 1 - 1
bpf/aya-bpf/Cargo.toml

@@ -2,7 +2,7 @@
 name = "aya-bpf"
 version = "0.1.0"
 authors = ["Alessandro Decina <[email protected]>"]
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 aya-bpf-cty = { path = "../aya-bpf-cty" }

+ 1 - 1
bpf/aya-log-ebpf/Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 name = "aya-log-ebpf"
 version = "0.1.0"
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 aya-bpf = { path = "../aya-bpf" }

+ 1 - 1
test/integration-ebpf/Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 name = "integration-ebpf"
 version = "0.1.0"
-edition = "2018"
+edition = "2021"
 publish = false
 
 [dependencies]

+ 1 - 1
test/integration-test-macros/Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 name = "integration-test-macros"
 version = "0.1.0"
-edition = "2018"
+edition = "2021"
 publish = false
 
 [dependencies]

+ 1 - 1
test/integration-test/Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 name = "integration-test"
 version = "0.1.0"
-edition = "2018"
+edition = "2021"
 publish = false
 
 [dependencies]

+ 1 - 5
test/integration-test/src/tests/load.rs

@@ -1,8 +1,4 @@
-use std::{
-    convert::{TryFrom, TryInto},
-    process::Command,
-    thread, time,
-};
+use std::{process::Command, thread, time};
 
 use aya::{
     include_bytes_aligned,

+ 0 - 2
test/integration-test/src/tests/smoke.rs

@@ -1,5 +1,3 @@
-use std::convert::TryInto;
-
 use aya::{
     include_bytes_aligned,
     programs::{Extension, Xdp, XdpFlags},

+ 1 - 1
xtask/Cargo.toml

@@ -2,7 +2,7 @@
 name = "xtask"
 version = "0.1.0"
 authors = ["Alessandro Decina <[email protected]>"]
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 aya-gen = { path = "../aya-gen" }