Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Verified Commit 26ea5825 authored by Ayush Singh's avatar Ayush Singh
Browse files

cli: Replace use of unwrap


- Replace unwraps with expect

Signed-off-by: Ayush Singh's avatarAyush Singh <ayush@beagleboard.org>
parent 857e8174
1 merge request!31bb-imager: Remove use of unwrap
...@@ -85,7 +85,9 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri ...@@ -85,7 +85,9 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri
let dst = match target { let dst = match target {
FlashTarget::Bcf => bb_imager::Destination::port(dst), FlashTarget::Bcf => bb_imager::Destination::port(dst),
FlashTarget::Sd => bb_imager::Destination::sd_card(dst.clone(), 0, dst), FlashTarget::Sd => bb_imager::Destination::sd_card(dst.clone(), 0, dst),
FlashTarget::Msp430 => bb_imager::Destination::hidraw(CString::new(dst).unwrap()), FlashTarget::Msp430 => {
bb_imager::Destination::hidraw(CString::new(dst).expect("Failed to parse destination"))
}
}; };
if !quite { if !quite {
...@@ -113,7 +115,7 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri ...@@ -113,7 +115,7 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri
indicatif::ProgressStyle::with_template( indicatif::ProgressStyle::with_template(
"[2/3] {msg} [{wide_bar}] [{percent} %]", "[2/3] {msg} [{wide_bar}] [{percent} %]",
) )
.unwrap(), .expect("Failed to create progress bar"),
); );
bar.set_message("Flashing"); bar.set_message("Flashing");
bar bar
...@@ -145,7 +147,7 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri ...@@ -145,7 +147,7 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri
indicatif::ProgressStyle::with_template( indicatif::ProgressStyle::with_template(
"[3/3] {msg} [{wide_bar}] [{percent} %]", "[3/3] {msg} [{wide_bar}] [{percent} %]",
) )
.unwrap(), .expect("Failed to create progress bar"),
); );
bar.set_message("Verifying"); bar.set_message("Verifying");
bar bar
...@@ -189,5 +191,8 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri ...@@ -189,5 +191,8 @@ async fn flash(img: PathBuf, dst: String, target: FlashTarget, quite: bool, veri
), ),
}; };
flasher.download_flash_customize().await.unwrap(); flasher
.download_flash_customize()
.await
.expect("Failed to flash");
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment