clippy fixes

This commit is contained in:
Luke Street 2025-03-21 16:14:44 -06:00
parent a064ddfd68
commit ddd9dbb0ba
3 changed files with 5 additions and 7 deletions

View File

@ -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<usize> {
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[..],

View File

@ -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);
}

View File

@ -204,8 +204,7 @@ fn make_rso(
let mut rso_sections: Vec<RsoSectionHeader> =
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<RsoRelocation> = 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;
}