Browse Source

aya-obj: fix rustfmt diffs and typos

Shenghui Ye 2 years ago
parent
commit
9ec3447e89
5 changed files with 11 additions and 12 deletions
  1. 1 1
      aya-obj/README.md
  2. 2 2
      aya-obj/src/btf/btf.rs
  3. 4 4
      aya-obj/src/btf/info.rs
  4. 1 1
      aya-obj/src/btf/relocation.rs
  5. 3 4
      aya-obj/src/lib.rs

+ 1 - 1
aya-obj/README.md

@@ -3,7 +3,7 @@
 ## Overview
 
 eBPF programs written with [libbpf] or [aya-bpf] are usually compiled
-into an ELF object file, using various section to store information
+into an ELF object file, using various sections to store information
 about the eBPF programs.
 
 `aya-obj` is a library that loads, parses and processes such eBPF

+ 2 - 2
aya-obj/src/btf/btf.rs

@@ -130,7 +130,7 @@ pub enum BtfError {
     /// Loading the btf failed
     #[error("the BPF_BTF_LOAD syscall failed. Verifier output: {verifier_log}")]
     LoadError {
-        /// The [`io::Error`] returned by the `BPF_BTF_LOAD` syscall.
+        /// The [`std::io::Error`] returned by the `BPF_BTF_LOAD` syscall.
         #[source]
         io_error: std::io::Error,
         /// The error log produced by the kernel verifier.
@@ -613,7 +613,7 @@ unsafe fn read_btf_header(data: &[u8]) -> btf_header {
     ptr::read_unaligned(data.as_ptr() as *const btf_header)
 }
 
-/// Data in .BTF.ext section
+/// Data in the `.BTF.ext` section
 #[derive(Debug, Clone)]
 pub struct BtfExt {
     data: Vec<u8>,

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

@@ -71,7 +71,7 @@ impl FuncSecInfo {
         }
     }
 
-    /// Encodes the [bpf_func_info] entries
+    /// Encodes the [bpf_func_info] entries.
     pub fn func_info_bytes(&self) -> Vec<u8> {
         let mut buf = vec![];
         for l in &self.func_info {
@@ -81,7 +81,7 @@ impl FuncSecInfo {
         buf
     }
 
-    /// Returns the number of [bpf_func_info] entries
+    /// Returns the number of [bpf_func_info] entries.
     pub fn len(&self) -> usize {
         self.func_info.len()
     }
@@ -176,7 +176,7 @@ impl LineSecInfo {
         }
     }
 
-    /// Encode the entries
+    /// Encodes the entries.
     pub fn line_info_bytes(&self) -> Vec<u8> {
         let mut buf = vec![];
         for l in &self.line_info {
@@ -186,7 +186,7 @@ impl LineSecInfo {
         buf
     }
 
-    /// Returns the number of entries
+    /// Returns the number of entries.
     pub fn len(&self) -> usize {
         self.line_info.len()
     }

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

@@ -208,7 +208,7 @@ impl Relocation {
 }
 
 impl Object {
-    /// Relocate programs inside this object file with loaded BTF info.
+    /// Relocates programs inside this object file with loaded BTF info.
     pub fn relocate_btf(&mut self, target_btf: &Btf) -> Result<(), BtfRelocationError> {
         let (local_btf, btf_ext) = match (&self.btf, &self.btf_ext) {
             (Some(btf), Some(btf_ext)) => (btf, btf_ext),

+ 3 - 4
aya-obj/src/lib.rs

@@ -3,7 +3,7 @@
 //! ## Overview
 //!
 //! eBPF programs written with [libbpf] or [aya-bpf] are usually compiled
-//! into an ELF object file, using various section to store information
+//! into an ELF object file, using various sections to store information
 //! about the eBPF programs.
 //!
 //! `aya-obj` is a library that loads, parses and processes such eBPF
@@ -49,13 +49,12 @@
 #![cfg_attr(docsrs, feature(doc_cfg))]
 #![deny(clippy::all, missing_docs)]
 #![allow(clippy::missing_safety_doc, clippy::len_without_is_empty)]
-
 #![cfg_attr(feature = "no_std", feature(error_in_core))]
 
-#[cfg(not(feature = "no_std"))]
-pub(crate) use thiserror_std as thiserror;
 #[cfg(feature = "no_std")]
 pub(crate) use thiserror_core as thiserror;
+#[cfg(not(feature = "no_std"))]
+pub(crate) use thiserror_std as thiserror;
 
 extern crate alloc;
 #[cfg(not(feature = "no_std"))]