diff --git a/src/cmd/dwarf.rs b/src/cmd/dwarf.rs index 322cb5a..db6038d 100644 --- a/src/cmd/dwarf.rs +++ b/src/cmd/dwarf.rs @@ -360,7 +360,7 @@ fn blend_fg_color(fg: Color, bg: Color) -> Color { impl Write for HighlightWriter<'_> { fn write(&mut self, buf: &[u8]) -> std::io::Result { - let str = from_utf8(buf).map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?; + let str = from_utf8(buf).map_err(std::io::Error::other)?; for s in str.split_inclusive('\n') { self.line.push_str(s); if self.line.ends_with('\n') { @@ -377,7 +377,7 @@ impl Write for HighlightWriter<'_> { let ops = self .parse_state .parse_line(&self.line, &self.syntax_set) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?; + .map_err(std::io::Error::other)?; let iter = HighlightIterator::new( &mut self.highlight_state, &ops[..], diff --git a/src/cmd/elf2dol.rs b/src/cmd/elf2dol.rs index e5c1adf..8fc7cb7 100644 --- a/src/cmd/elf2dol.rs +++ b/src/cmd/elf2dol.rs @@ -50,7 +50,7 @@ const MAX_DATA_SECTIONS: usize = 11; pub fn run(args: Args) -> Result<()> { let mut file = open_file(&args.elf_file, true)?; let data = file.map()?; - if data.len() >= 4 && &data[0..4] == ALF_MAGIC { + if data.len() >= 4 && data[0..4] == ALF_MAGIC { return convert_alf(args, data); } diff --git a/src/cmd/rso.rs b/src/cmd/rso.rs index 64648ee..cebe223 100644 --- a/src/cmd/rso.rs +++ b/src/cmd/rso.rs @@ -204,8 +204,7 @@ fn make_rso( let mut rso_sections: Vec = vec![RsoSectionHeader::default() /* ELF null section */]; for section in file.sections() { - let is_valid_section = - section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n)); + let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n)); let section_size = section.size(); if !is_valid_section || section_size == 0 { @@ -321,8 +320,7 @@ fn make_rso( let mut exported_relocations: Vec = vec![]; for section in file.sections() { - let is_valid_section = - section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n)); + let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n)); if !is_valid_section { continue; }