Skip to content

Commit 30eecb6

Browse files
committed
build: cargo fmt for 2024 edition
1 parent f46faad commit 30eecb6

File tree

6 files changed

+33
-31
lines changed

6 files changed

+33
-31
lines changed

src/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use std::io::{stdout, IsTerminal, Write};
1+
use std::io::{IsTerminal, Write, stdout};
22

3-
use prettytable::{format, Cell, Row, Table};
3+
use prettytable::{Cell, Row, Table, format};
44
use termcolor::Color::*;
55
use termcolor::{Buffer, BufferWriter, WriteColor};
66

src/format_archive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use anyhow::Error;
22
use metagoblin::archive;
3-
use prettytable::{row, Cell, Row};
3+
use prettytable::{Cell, Row, row};
44

5-
use crate::format::*;
65
use crate::Opt;
6+
use crate::format::*;
77

88
pub struct Archive<'archive> {
99
archive: archive::Archive<'archive>,

src/format_elf.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
use std::io::{stdout, IsTerminal, Write};
1+
use std::io::{IsTerminal, Write, stdout};
22

33
use anyhow::Error;
44
use metagoblin::elf;
55
use metagoblin::elf::{
6-
dynamic, header, program_header, reloc, section_header, sym, Dynamic, RelocSection,
6+
Dynamic, RelocSection, dynamic, header, program_header, reloc, section_header, sym,
77
};
88
use metagoblin::strtab::Strtab;
9-
use prettytable::{row, Cell, Row, Table};
10-
use scroll::ctx::StrCtx;
9+
use prettytable::{Cell, Row, Table, row};
1110
use scroll::Pread;
11+
use scroll::ctx::StrCtx;
1212
use termcolor::Color::*;
1313
use termcolor::{Buffer, BufferWriter, ColorChoice, ColorSpec, WriteColor};
1414

15-
use crate::format::*;
1615
use crate::Opt;
16+
use crate::format::*;
1717

1818
type Syms = Vec<sym::Sym>;
1919

@@ -155,7 +155,7 @@ impl<'bytes> Elf<'bytes> {
155155
}
156156

157157
fn ph_name_table(phdr: &elf::ProgramHeader) -> Cell {
158-
use program_header::{pt_to_str, PT_DYNAMIC, PT_INTERP, PT_LOAD};
158+
use program_header::{PT_DYNAMIC, PT_INTERP, PT_LOAD, pt_to_str};
159159

160160
let name = pt_to_str(phdr.p_type);
161161
match phdr.p_type {
@@ -430,9 +430,9 @@ impl<'bytes> Elf<'bytes> {
430430

431431
fn print_dynamic_symbol(&self, fmt: &mut Buffer, dyn_sym: &elf::Dyn) -> Result<(), Error> {
432432
use dynamic::{
433-
tag_to_str, DT_FINI, DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_GNU_HASH, DT_INIT,
434-
DT_INIT_ARRAY, DT_INIT_ARRAYSZ, DT_JMPREL, DT_NEEDED, DT_PLTGOT, DT_PLTRELSZ, DT_RELA,
435-
DT_RELASZ, DT_RPATH, DT_STRSZ, DT_STRTAB, DT_SYMTAB, DT_VERNEED, DT_VERSYM,
433+
DT_FINI, DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_GNU_HASH, DT_INIT, DT_INIT_ARRAY,
434+
DT_INIT_ARRAYSZ, DT_JMPREL, DT_NEEDED, DT_PLTGOT, DT_PLTRELSZ, DT_RELA, DT_RELASZ,
435+
DT_RPATH, DT_STRSZ, DT_STRTAB, DT_SYMTAB, DT_VERNEED, DT_VERSYM, tag_to_str,
436436
};
437437

438438
fmt_cyan(fmt, &format!("{:>16} ", tag_to_str(dyn_sym.d_tag)))?;
@@ -491,14 +491,16 @@ impl<'bytes> Elf<'bytes> {
491491
fmt_off(fmt, header.e_phoff)?;
492492
write!(fmt, " e_shoff: ")?;
493493
fmt_off(fmt, header.e_shoff)?;
494-
writeln!(fmt, " e_flags: {:#x} e_ehsize: {} e_phentsize: {} e_phnum: {} e_shentsize: {} e_shnum: {} e_shstrndx: {}",
495-
header.e_flags,
496-
header.e_ehsize,
497-
header.e_phentsize,
498-
header.e_phnum,
499-
header.e_shentsize,
500-
header.e_shnum,
501-
header.e_shstrndx,
494+
writeln!(
495+
fmt,
496+
" e_flags: {:#x} e_ehsize: {} e_phentsize: {} e_phnum: {} e_shentsize: {} e_shnum: {} e_shstrndx: {}",
497+
header.e_flags,
498+
header.e_ehsize,
499+
header.e_phentsize,
500+
header.e_phnum,
501+
header.e_shentsize,
502+
header.e_shnum,
503+
header.e_shstrndx,
502504
)?;
503505
writeln!(fmt)?;
504506

src/format_mach.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use std::io::{stdout, IsTerminal, Write};
1+
use std::io::{IsTerminal, Write, stdout};
22

33
use anyhow::Result;
44
use metagoblin::mach;
55
use metagoblin::mach::exports::Export;
66
use metagoblin::mach::header;
77
use metagoblin::mach::load_command;
8-
use prettytable::{row, Cell, Row, Table};
8+
use prettytable::{Cell, Row, Table, row};
99
use termcolor::Color::*;
1010
use termcolor::{Buffer, BufferWriter, ColorChoice, ColorSpec, WriteColor};
1111

12-
use crate::format::*;
1312
use crate::Opt;
13+
use crate::format::*;
1414

1515
pub struct Mach<'macho>(pub mach::MachO<'macho>, pub Opt);
1616

src/format_pe.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::collections::BTreeSet;
2-
use std::io::{stdout, IsTerminal, Write};
2+
use std::io::{IsTerminal, Write, stdout};
33
use std::num::NonZeroUsize;
44

55
use anyhow::Error;
@@ -10,14 +10,14 @@ use metagoblin::pe::export::{Export, Reexport};
1010
use metagoblin::pe::header::*;
1111
use metagoblin::pe::import::Import;
1212
use metagoblin::pe::optional_header::OptionalHeader;
13-
use metagoblin::pe::section_table::{SectionTable, IMAGE_SCN_ALIGN_MASK};
14-
use prettytable::{row, Cell, Row};
15-
use scroll::ctx::StrCtx;
13+
use metagoblin::pe::section_table::{IMAGE_SCN_ALIGN_MASK, SectionTable};
14+
use prettytable::{Cell, Row, row};
1615
use scroll::Pread;
16+
use scroll::ctx::StrCtx;
1717
use termcolor::{Buffer, BufferWriter, Color, ColorChoice, ColorSpec, WriteColor};
1818

19-
use crate::format::*;
2019
use crate::Opt;
20+
use crate::format::*;
2121

2222
/// Device drivers and native Windows processes.
2323
const IMAGE_SUBSYSTEM_NATIVE: u16 = 1;

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ use std::path::Path;
1111

1212
use anyhow::Error;
1313
use clap::Parser;
14-
use metagoblin::{archive, elf, mach, pe, Hint, Object};
14+
use metagoblin::{Hint, Object, archive, elf, mach, pe};
1515

1616
use crate::format_archive::Archive;
1717
use crate::format_elf::Elf;
1818
use crate::format_mach::Mach;
1919
use crate::format_meta::Meta;
20-
use crate::format_pe::{is_pe_object_file_header, PEObjectFile, PortableExecutable};
20+
use crate::format_pe::{PEObjectFile, PortableExecutable, is_pe_object_file_header};
2121

2222
#[derive(Parser, Debug, Clone)]
2323
#[clap(

0 commit comments

Comments
 (0)