From 926c31ea18a22b33287480947f987102778a8491 Mon Sep 17 00:00:00 2001 From: Valentin Obst Date: Sun, 10 Nov 2024 18:50:02 +0100 Subject: [PATCH] fix code style --- src/elf.rs | 4 ++-- src/symbols.rs | 2 +- src/v_symbols.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/elf.rs b/src/elf.rs index 0010797..9246632 100644 --- a/src/elf.rs +++ b/src/elf.rs @@ -24,7 +24,7 @@ pub fn is_elf(raw: &[u8]) -> Result { /// Returns the `.BTF` section of the ELF file. pub fn extract_btfsec(raw: &[u8]) -> Result<&[u8]> { - let elf = Elf::parse(&raw)?; + let elf = Elf::parse(raw)?; for shdr in elf.section_headers.iter() { let Some(sec_name) = elf.shdr_strtab.get_at(shdr.sh_name) else { log::debug!("Unable to get name for section: {}", shdr.sh_name); @@ -41,7 +41,7 @@ pub fn extract_btfsec(raw: &[u8]) -> Result<&[u8]> { /// Returns the Linux banner of the ELF file. pub fn get_banner(raw: &[u8]) -> Result { - let elf = Elf::parse(&raw)?; + let elf = Elf::parse(raw)?; for sym in elf.syms.iter() { let Some(sym_name) = elf.strtab.get_at(sym.st_name) else { log::debug!("Unable to get name for symbol: {}", sym.st_name); diff --git a/src/symbols.rs b/src/symbols.rs index 3686df7..76fff99 100644 --- a/src/symbols.rs +++ b/src/symbols.rs @@ -104,7 +104,7 @@ impl Symbols { /// Get name of the System.map that was used to construct these `Symbols`. pub fn map_name(&self) -> Option { - self.name_map.as_ref().map(|n| n.clone()) + self.name_map.clone() } /// Returns pointer to the embedded symdb. diff --git a/src/v_symbols.rs b/src/v_symbols.rs index afd6885..2c32a75 100644 --- a/src/v_symbols.rs +++ b/src/v_symbols.rs @@ -32,7 +32,7 @@ impl From for Symbol { address: sym.address(), t: sym .r#type() - .map(|t| match serde_json::from_str::(&t) { + .map(|t| match serde_json::from_str::(t) { Ok(t) => t, Err(e) => { panic!("Symbol type had invalid format: {}: {}", e, t)