Created
November 14, 2022 17:15
-
-
Save jessebraham/f0a1962338fe0ec0a8337b9a83371408 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main.rs b/src/main.rs | |
index 5a5df71..c320df1 100644 | |
--- a/src/main.rs | |
+++ b/src/main.rs | |
@@ -127,7 +127,7 @@ pub struct UninstallOpts { | |
} | |
/// Installs the Rust for ESP chips environment | |
-fn install(args: InstallOpts) -> Result<()> { | |
+fn install(args: InstallOpts) -> Result<(), Error> { | |
initialize_logger(&args.log_level); | |
info!("{} Installing esp-rs", emoji::DISC); | |
@@ -299,7 +299,7 @@ fn uninstall(args: UninstallOpts) -> Result<(), Error> { | |
} | |
/// Updates Xtensa Rust toolchain. | |
-fn update(args: UpdateOpts) -> Result<()> { | |
+fn update(args: UpdateOpts) -> Result<(), Error> { | |
initialize_logger(&args.log_level); | |
info!("{} Updating ESP Rust environment", emoji::DISC); | |
let host_triple = get_host_triple(args.default_host)?; | |
@@ -342,7 +342,7 @@ fn update(args: UpdateOpts) -> Result<()> { | |
Ok(()) | |
} | |
-fn main() -> Result<()> { | |
+fn main() -> Result<(), Error> { | |
match Cli::parse().subcommand { | |
SubCommand::Install(args) => install(*args), | |
SubCommand::Update(args) => update(args), | |
@@ -361,7 +361,7 @@ fn clear_dist_folder() -> Result<(), Error> { | |
} | |
/// Returns the absolute path to the export file, uses the DEFAULT_EXPORT_FILE if no arg is provided. | |
-fn get_export_file(export_file: Option<PathBuf>) -> Result<PathBuf> { | |
+fn get_export_file(export_file: Option<PathBuf>) -> Result<PathBuf, Error> { | |
if let Some(export_file) = export_file { | |
if export_file.is_absolute() { | |
Ok(export_file) | |
@@ -376,7 +376,7 @@ fn get_export_file(export_file: Option<PathBuf>) -> Result<PathBuf> { | |
} | |
/// Creates the export file with the necessary environment variables. | |
-fn export_environment(export_file: &PathBuf, exports: &[String]) -> Result<()> { | |
+fn export_environment(export_file: &PathBuf, exports: &[String]) -> Result<(), Error> { | |
info!("{} Creating export file", emoji::WRENCH); | |
let mut file = File::create(export_file)?; | |
for e in exports.iter() { | |
diff --git a/src/toolchain/espidf.rs b/src/toolchain/espidf.rs | |
index 5564cd0..18c3543 100644 | |
--- a/src/toolchain/espidf.rs | |
+++ b/src/toolchain/espidf.rs | |
@@ -129,9 +129,9 @@ impl EspIdfRepo { | |
let install = |esp_idf_origin: espidf::EspIdfOrigin| -> Result<espidf::EspIdf, Error> { | |
espidf::Installer::new(esp_idf_origin) | |
.install_dir(Some(self.install_path.clone())) | |
- .with_tools(make_tools.into()) | |
+ // .with_tools(make_tools) | |
.install() | |
- .map_err(|e| Error::FailedToInstallEspIdf) | |
+ .map_err(|_| Error::FailedToInstallEspIdf) | |
}; | |
let repo = espidf::EspIdfRemote { | |
@@ -141,7 +141,7 @@ impl EspIdfRepo { | |
let espidf_origin = espidf::EspIdfOrigin::Managed(repo.clone()); | |
#[cfg(unix)] | |
- let espidf = install(espidf_origin).map_err(|e| Error::FailedToInstallEspIdf)?; | |
+ let espidf = install(espidf_origin).map_err(|_| Error::FailedToInstallEspIdf)?; | |
#[cfg(windows)] | |
install(espidf_origin)?; | |
let espidf_dir = get_install_path(repo); | |
diff --git a/src/toolchain/gcc.rs b/src/toolchain/gcc.rs | |
index a8e8ee5..3b61543 100644 | |
--- a/src/toolchain/gcc.rs | |
+++ b/src/toolchain/gcc.rs | |
@@ -2,6 +2,7 @@ | |
use crate::{ | |
emoji, | |
+ error::Error, | |
host_triple::HostTriple, | |
targets::Target, | |
toolchain::{download_file, espidf::get_tool_path}, | |
@@ -43,7 +44,7 @@ impl Gcc { | |
} | |
/// Installs the gcc toolchain. | |
- pub fn install(&self) -> Result<()> { | |
+ pub fn install(&self) -> Result<(), Error> { | |
let target_dir = format!("{}/{}-{}", self.toolchain_name, self.release, self.version); | |
let gcc_path = get_tool_path(&target_dir); | |
let extension = get_artifact_extension(&self.host_triple); | |
@@ -140,7 +141,7 @@ pub fn get_ulp_toolchain_name(target: Target, version: Option<&EspIdfVersion>) - | |
pub fn install_gcc_targets( | |
targets: &HashSet<Target>, | |
host_triple: &HostTriple, | |
-) -> Result<Vec<String>> { | |
+) -> Result<Vec<String>, Error> { | |
info!("{} Installing gcc for build targets", emoji::WRENCH); | |
let mut exports: Vec<String> = Vec::new(); | |
for target in targets { | |
diff --git a/src/toolchain/llvm.rs b/src/toolchain/llvm.rs | |
index f5f53bd..e0e886a 100644 | |
--- a/src/toolchain/llvm.rs | |
+++ b/src/toolchain/llvm.rs | |
@@ -2,6 +2,7 @@ | |
use crate::{ | |
emoji, | |
+ error::Error, | |
host_triple::HostTriple, | |
toolchain::{download_file, espidf::get_tool_path}, | |
}; | |
@@ -48,7 +49,7 @@ impl Llvm { | |
} | |
/// Installs the LLVM toolchain. | |
- pub fn install(&self) -> Result<Vec<String>> { | |
+ pub fn install(&self) -> Result<Vec<String>, Error> { | |
let mut exports: Vec<String> = Vec::new(); | |
if Path::new(&self.path).exists() { | |
diff --git a/src/toolchain/rust.rs b/src/toolchain/rust.rs | |
index 6de4ea9..dbe9884 100644 | |
--- a/src/toolchain/rust.rs | |
+++ b/src/toolchain/rust.rs | |
@@ -230,7 +230,7 @@ impl Crate { | |
} | |
} | |
-pub fn install_extra_crates(crates: &HashSet<Crate>) -> Result<()> { | |
+pub fn install_extra_crates(crates: &HashSet<Crate>) -> Result<(), Error> { | |
debug!( | |
"{} Installing the following crates: {:#?}", | |
emoji::DEBUG, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment