Skip to content

Commit 0e9ce6e

Browse files
Format Rust code using rustfmt
1 parent ceaebb3 commit 0e9ce6e

File tree

1 file changed

+56
-35
lines changed

1 file changed

+56
-35
lines changed

src/main.rs

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,66 +1234,87 @@ fn prepare_bhd_directory_contents<'a>(
12341234
}
12351235
let source = entry.source;
12361236
let blob_slot_settings = entry.target.blob;
1237-
let flash_location =
1238-
blob_slot_settings.as_ref().and_then(|x| x.flash_location)
1237+
let flash_location = blob_slot_settings
1238+
.as_ref()
1239+
.and_then(|x| x.flash_location)
12391240
// AMD sometimes uses target.flash_location=Some(0) together
12401241
// with Implied to mean "No flash location".
12411242
// Ignore that (definitely do not allocate that on the flash).
1242-
.filter(|&loc| !(matches!(source, SerdeBhdSource::Implied) && loc == 0));
1243+
.filter(|&loc| {
1244+
!(matches!(source, SerdeBhdSource::Implied) && loc == 0)
1245+
});
12431246

12441247
// done by try_from: raw_entry.set_destination_location(ram_destination_address);
12451248
// done by try_from: raw_entry.set_size(size);
12461249
match source {
1247-
SerdeBhdSource::Implied => {
1248-
match entry.target.attrs.type_ {
1249-
BhdDirectoryEntryType::Apob => {
1250-
assert!(flash_location.is_none(), "You specified a
1250+
SerdeBhdSource::Implied => match entry.target.attrs.type_ {
1251+
BhdDirectoryEntryType::Apob => {
1252+
assert!(
1253+
flash_location.is_none(),
1254+
"You specified a
12511255
fixed flash location for {typ} but it has
12521256
an Implied source. What does that mean?",
1253-
typ = entry.target.attrs.type_);
1254-
custom_apob = Some(raw_entry.destination_location()
1255-
.expect("destination address"));
1256-
raw_entry.set_size(Some(0));
1257-
vec![(raw_entry, None, None)]
1258-
}
1259-
BhdDirectoryEntryType::ApobNvCopy => {
1260-
assert!(raw_entry.destination_location().is_none(),
1261-
"You specified a fixed RAM location for
1257+
typ = entry.target.attrs.type_
1258+
);
1259+
custom_apob = Some(
1260+
raw_entry
1261+
.destination_location()
1262+
.expect("destination address"),
1263+
);
1264+
raw_entry.set_size(Some(0));
1265+
vec![(raw_entry, None, None)]
1266+
}
1267+
BhdDirectoryEntryType::ApobNvCopy => {
1268+
assert!(
1269+
raw_entry.destination_location().is_none(),
1270+
"You specified a fixed RAM location for
12621271
{typ}. What does that mean?",
1263-
typ = entry.target.attrs.type_);
1264-
assert!(flash_location.is_some(), "You did not
1272+
typ = entry.target.attrs.type_
1273+
);
1274+
assert!(
1275+
flash_location.is_some(),
1276+
"You did not
12651277
specify a flash location for {typ}.",
1266-
typ = entry.target.attrs.type_);
1267-
assert_ne!(raw_entry.size(), Some(0), "You did not
1278+
typ = entry.target.attrs.type_
1279+
);
1280+
assert_ne!(
1281+
raw_entry.size(),
1282+
Some(0),
1283+
"You did not
12681284
specify a size for {typ}.",
1269-
typ = entry.target.attrs.type_);
1270-
vec![(raw_entry, None, None)]
1271-
}
1272-
_ => {
1273-
panic!("Implied source is only supported for Apob
1285+
typ = entry.target.attrs.type_
1286+
);
1287+
vec![(raw_entry, None, None)]
1288+
}
1289+
_ => {
1290+
panic!(
1291+
"Implied source is only supported for Apob
12741292
and ApobNvCopy, not {typ}. Are you sure you
12751293
want to do that?",
1276-
typ = entry.target.attrs.type_);
1277-
}
1294+
typ = entry.target.attrs.type_
1295+
);
12781296
}
1279-
1280-
}
1297+
},
12811298
SerdeBhdSource::BlobFile(blob_filename) => {
1282-
assert_ne!(entry.target.attrs.type_, BhdDirectoryEntryType::Apob,
1283-
"You specified a Blob for Apob? What does that mean?");
1299+
assert_ne!(
1300+
entry.target.attrs.type_,
1301+
BhdDirectoryEntryType::Apob,
1302+
"You specified a Blob for Apob? What does that mean?"
1303+
);
12841304
let blob_filename = resolve_blob(blob_filename).unwrap();
12851305
let body = std::fs::read(blob_filename).unwrap();
12861306
raw_entry.set_size(Some(body.len().try_into().unwrap()));
12871307
vec![(raw_entry, flash_location, Some(body))]
12881308
}
12891309
SerdeBhdSource::ApcbJson(apcb) => {
1290-
assert!(generate_is_context_valid(processor_generation, &apcb));
1310+
assert!(generate_is_context_valid(
1311+
processor_generation,
1312+
&apcb
1313+
));
12911314
// Note: We need to do this
12921315
// manually because validation
12931316
// needs ABL_VERSION.
1294-
apcb.validate(None)
1295-
.map_err(apcb_to_io_error)
1296-
.unwrap();
1317+
apcb.validate(None).map_err(apcb_to_io_error).unwrap();
12971318
let buf =
12981319
apcb.save_no_inc().map_err(apcb_to_io_error).unwrap();
12991320
let bufref = buf.as_ref();

0 commit comments

Comments
 (0)