Skip to content

Commit ddd9dbb

Browse files
committed
clippy fixes
1 parent a064ddf commit ddd9dbb

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/cmd/dwarf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ fn blend_fg_color(fg: Color, bg: Color) -> Color {
360360

361361
impl Write for HighlightWriter<'_> {
362362
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
363-
let str = from_utf8(buf).map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
363+
let str = from_utf8(buf).map_err(std::io::Error::other)?;
364364
for s in str.split_inclusive('\n') {
365365
self.line.push_str(s);
366366
if self.line.ends_with('\n') {
@@ -377,7 +377,7 @@ impl Write for HighlightWriter<'_> {
377377
let ops = self
378378
.parse_state
379379
.parse_line(&self.line, &self.syntax_set)
380-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
380+
.map_err(std::io::Error::other)?;
381381
let iter = HighlightIterator::new(
382382
&mut self.highlight_state,
383383
&ops[..],

src/cmd/elf2dol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const MAX_DATA_SECTIONS: usize = 11;
5050
pub fn run(args: Args) -> Result<()> {
5151
let mut file = open_file(&args.elf_file, true)?;
5252
let data = file.map()?;
53-
if data.len() >= 4 && &data[0..4] == ALF_MAGIC {
53+
if data.len() >= 4 && data[0..4] == ALF_MAGIC {
5454
return convert_alf(args, data);
5555
}
5656

src/cmd/rso.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ fn make_rso(
204204
let mut rso_sections: Vec<RsoSectionHeader> =
205205
vec![RsoSectionHeader::default() /* ELF null section */];
206206
for section in file.sections() {
207-
let is_valid_section =
208-
section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n));
207+
let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n));
209208
let section_size = section.size();
210209

211210
if !is_valid_section || section_size == 0 {
@@ -321,8 +320,7 @@ fn make_rso(
321320
let mut exported_relocations: Vec<RsoRelocation> = vec![];
322321

323322
for section in file.sections() {
324-
let is_valid_section =
325-
section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n));
323+
let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n));
326324
if !is_valid_section {
327325
continue;
328326
}

0 commit comments

Comments
 (0)