Skip to content

Commit 77343b3

Browse files
committed
Fix clippy warnings: inline arguments in println!/format!
1 parent aa0a10d commit 77343b3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/pcap-info.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ fn main() {
1010
}
1111

1212
fn print_pcap_info(arg: &str) -> Result<(), Box<dyn Error>> {
13-
println!("Name: {}", arg);
13+
println!("Name: {arg}");
1414

1515
let file = File::open(arg)?;
1616
let file_size = file.metadata()?.len();
17-
println!("\tfile size: {}", file_size);
17+
println!("\tfile size: {file_size}");
1818

1919
let mut reader = create_reader(10 * 1024, file)?;
2020

@@ -59,7 +59,7 @@ fn print_pcap_info(arg: &str) -> Result<(), Box<dyn Error>> {
5959
}
6060
}
6161

62-
println!("\tnum_blocks: {}", num_blocks);
62+
println!("\tnum_blocks: {num_blocks}");
6363

6464
Ok(())
6565
}
@@ -110,7 +110,7 @@ fn print_block_info_ng(block: &Block) {
110110
println!("\t\tStatistics:");
111111
if let Some(option) = isb.isb_starttime() {
112112
let (ts_high, ts_low) = option.unwrap_or((0, 0));
113-
println!("\t\t\tisb_starttime: 0x{:x}:0x{:x}", ts_high, ts_low);
113+
println!("\t\t\tisb_starttime: 0x{ts_high:x}:0x{ts_low:x}");
114114
// to decode, this require the ts_offset and resolution from the matching IDB block
115115
// for ex:
116116
// let resolution = build_ts_resolution(6).unwrap();

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ where
7272
PcapError::BufferTooSmall => write!(f, "Buffer is too small"),
7373
PcapError::UnexpectedEof => write!(f, "Unexpected end of file"),
7474
PcapError::ReadError => write!(f, "Read error"),
75-
PcapError::Incomplete(n) => write!(f, "Incomplete read: {}", n),
75+
PcapError::Incomplete(n) => write!(f, "Incomplete read: {n}"),
7676
PcapError::HeaderNotRecognized => write!(f, "Header not recognized as PCAP or PCAPNG"),
77-
PcapError::NomError(i, e) => write!(f, "Internal parser error {:?}, input {:?}", e, i),
77+
PcapError::NomError(i, e) => write!(f, "Internal parser error {e:?}, input {i:?}"),
7878
PcapError::OwnedNomError(i, e) => {
7979
write!(f, "Internal parser error {:?}, input {:?}", e, &i)
8080
}

0 commit comments

Comments
 (0)