Skip to content

Commit c9d5a12

Browse files
committed
show: fix Clippy issues, skip FTUP
FTUP already contains other partitions. To avoid duplicate printing, skip it. Signed-off-by: Daniel Maslowski <[email protected]>
1 parent 1626331 commit c9d5a12

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/show.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use intel_fw::{
66
fit::Fit,
77
ifd::{FlashMasterV1, FlashMasterV2, IFD},
88
me::{Generation, ME},
9-
part::{gen2::Gen2Partition, gen3::Gen3Partition, partitions::Partitions},
9+
part::{fpt::FTUP, gen2::Gen2Partition, gen3::Gen3Partition, partitions::Partitions},
1010
};
1111

1212
fn print_gen2_dir(dir: &Gen2Dir) {
@@ -73,24 +73,23 @@ fn print_me(me: &ME) {
7373
println!("Partitions and directories:");
7474
println!();
7575
for p in parts {
76-
match p {
77-
Gen2Partition::Dir(dir) => {
78-
print_gen2_dir(&dir.dir);
79-
}
80-
_ => {}
76+
if let Gen2Partition::Dir(dir) = p {
77+
print_gen2_dir(&dir.dir);
8178
}
8279
}
8380
}
8481
Partitions::Gen3(parts) => {
8582
println!("Partitions and directories:");
8683
println!();
8784
for p in parts {
88-
match p {
89-
Gen3Partition::Dir(dir) => {
90-
let d = &dir.cpd;
91-
println!("{d}");
85+
if let Gen3Partition::Dir(dir) = p {
86+
let d = &dir.cpd;
87+
if d.name == FTUP {
88+
// FTUP contains NFTP and potentially WCOD and LOCL.
89+
// Skip it to avoid redundant printing.
90+
continue;
9291
}
93-
_ => {}
92+
println!("{d}");
9493
}
9594
}
9695
}
@@ -148,18 +147,18 @@ pub fn show(fw: &Firmware, verbose: bool) {
148147
match &fw.ifd {
149148
Ok(ifd) => {
150149
let ver = get_ifd_ver(&fw.me);
151-
print_ifd(&ifd, ver);
150+
print_ifd(ifd, ver);
152151
}
153152
Err(e) => warn!("Could not parse IFD: {e:?}"),
154153
}
155154
if let Some(me_res) = &fw.me {
156155
match me_res {
157156
Ok(me) => {
158157
if let Ok(ifd) = &fw.ifd {
159-
print_me_soft_config(&me, &ifd);
158+
print_me_soft_config(me, ifd);
160159
println!();
161160
}
162-
print_me(&me);
161+
print_me(me);
163162
}
164163
Err(e) => error!("ME firmware could not be parsed: {e:?}"),
165164
}
@@ -168,7 +167,7 @@ pub fn show(fw: &Firmware, verbose: bool) {
168167
}
169168
println!();
170169
match &fw.fit {
171-
Ok(fit) => print_fit(&fit),
170+
Ok(fit) => print_fit(fit),
172171
Err(e) => warn!("Could not parse FIT: {e:?}"),
173172
}
174173
println!();

0 commit comments

Comments
 (0)