Use ::compat for failure -> anyhow translation
-use anyhow::{anyhow, Result};
+use anyhow::Result;
use cmsis_pack::{pack_index::Vidx, utils::FromElem};
/// Fetches the master VIDX/PIDX file from the ARM server and returns the parsed file.
@@ -8,10 +8,7 @@ pub(crate) fn get_vidx() -> Result<Vidx> {
.send()?
.text()?;
- let vidx = match Vidx::from_string(&reader) {
- Ok(vidx) => vidx,
- Err(e) => return Err(anyhow!(e.to_string())),
- };
+ let vidx = Vidx::from_string(&reader).map_err(|e| e.compat())?;
Ok(vidx)
}
