Skip to content

Commit

Permalink
collapsed match per feedback to make more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
nahla-nee committed Nov 23, 2024
1 parent 2c7ccd5 commit cb0f04b
Showing 1 changed file with 25 additions and 40 deletions.
65 changes: 25 additions & 40 deletions rp235x-hal-examples/src/bin/rom_funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,11 @@ fn get_sys_info_chip_info<T>(uart: &mut T)
where
T: core::fmt::Write,
{
let result = hal::rom_data::sys_info_api::chip_info();
let result = match result {
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "chip_info() not supported");
return;
}
let result = match hal::rom_data::sys_info_api::chip_info() {
Ok(Some(result)) => result,
Ok(None) => {
_ = writeln!(uart, "chip_info() not supported");
return;
},
Err(e) => {
_ = writeln!(uart, "Failed to get chip info : {:?}", e);
Expand All @@ -261,14 +258,11 @@ fn get_sys_info_cpu_info<T>(uart: &mut T)
where
T: core::fmt::Write,
{
let result = hal::rom_data::sys_info_api::cpu_info();
let result = match result {
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "cpu_info() not supported");
return;
}
let result = match hal::rom_data::sys_info_api::cpu_info() {
Ok(Some(result)) => result,
Ok(None) => {
_ = writeln!(uart, "cpu_info() not supported");
return;
},
Err(e) => {
_ = writeln!(uart, "Failed to get cpu info: {:?}", e);
Expand All @@ -292,14 +286,11 @@ fn get_sys_info_flash_dev_info<T>(uart: &mut T)
where
T: core::fmt::Write,
{
let result = hal::rom_data::sys_info_api::flash_dev_info();
let result = match result {
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "flash_dev_info() not supported");
return;
}
let result = match hal::rom_data::sys_info_api::flash_dev_info() {
Ok(Some(result)) => result,
Ok(None) => {
_ = writeln!(uart, "flash_dev_info() not supported");
return;
},
Err(e) => {
_ = writeln!(uart, "Failed to get flash device info: {:?}", e);
Expand Down Expand Up @@ -339,14 +330,11 @@ fn get_sys_info_boot_random<T>(uart: &mut T)
where
T: core::fmt::Write,
{
let result = hal::rom_data::sys_info_api::boot_random();
let result = match result {
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "boot_random() not supported");
return;
}
let result = match hal::rom_data::sys_info_api::boot_random() {
Ok(Some(result)) => result,
Ok(None) => {
_ = writeln!(uart, "boot_random() not supported");
return;
},
Err(e) => {
_ = writeln!(uart, "Failed to get random boot integer: {:?}", e);
Expand All @@ -363,14 +351,11 @@ fn get_sys_info_start_block<T>(uart: &mut T)
where
T: core::fmt::Write,
{
let result = hal::rom_data::sys_info_api::boot_info();
let result = match result {
Ok(result) => match result {
Some(result) => result,
None => {
_ = writeln!(uart, "boot_info() not supported");
return;
}
let result = match hal::rom_data::sys_info_api::boot_info() {
Ok(Some(result)) => result,
Ok(None) => {
_ = writeln!(uart, "boot_info() not supported");
return;
},
Err(e) => {
_ = writeln!(uart, "Failed to get boot info: {:?}", e);
Expand Down

0 comments on commit cb0f04b

Please sign in to comment.