Skip to content

Commit a033440

Browse files
committed
chore: fix clippy warnings
1 parent caa7e59 commit a033440

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

examples/generate_headers.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ use sframe::{
55
header::Header,
66
header::{Deserialization, Serialization},
77
};
8+
use std::fmt::Write;
89

910
fn bin2string(bin: &[u8]) -> String {
10-
bin.iter().map(|x| format!("{x:08b} ")).collect()
11+
bin.iter().fold(String::new(), |mut output, x| {
12+
let _ = write!(output, "{x:08b} ");
13+
output
14+
})
1115
}
1216

1317
fn main() {

src/util.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
// Copyright (c) 2023 GoTo Group, Inc
22
// SPDX-License-Identifier: Apache-2.0 AND MIT
33

4+
#[cfg(test)]
5+
use std::fmt::Write;
6+
47
#[cfg(test)]
58
pub(crate) fn bin2string(bin: &[u8]) -> String {
6-
bin.iter().map(|x| format!("{x:08b} ")).collect()
9+
bin.iter().fold(String::new(), |mut output, x| {
10+
let _ = write!(output, "{x:08b} ");
11+
output
12+
})
713
}
814

915
#[cfg(test)]

0 commit comments

Comments
 (0)