Fix "make lint"

This commit is contained in:
Felix Schütt
2022-10-18 09:25:50 +02:00
parent 7c05da022a
commit 0f59d59eab
2 changed files with 4 additions and 8 deletions

View File

@@ -285,7 +285,7 @@ fn try_run_package_or_file(args: &[String], r: &Run) -> Result<(), anyhow::Error
} }
if sv.command.is_none() && is_fake_sv { if sv.command.is_none() && is_fake_sv {
sv.command = Some(package.to_string()); sv.command = Some(package);
} }
let mut package_download_info = None; let mut package_download_info = None;
@@ -333,7 +333,7 @@ fn try_execute_local_package(args: &[String], sv: &SplitVersion) -> Result<(), a
&package.registry, &package.registry,
&package.name, &package.name,
&package.version, &package.version,
sv.command.as_ref().map(|s| s.as_str()), sv.command.as_deref(),
) )
.map_err(|e| anyhow!("{e}"))?; .map_err(|e| anyhow!("{e}"))?;
@@ -406,11 +406,7 @@ struct SplitVersion {
impl fmt::Display for SplitVersion { impl fmt::Display for SplitVersion {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let version = self let version = self.version.as_deref().unwrap_or("latest");
.version
.as_ref()
.map(|s| s.as_str())
.unwrap_or("latest");
let command = self let command = self
.command .command
.as_ref() .as_ref()

View File

@@ -161,7 +161,7 @@ impl RunWithoutFile {
}; };
let mut wasi_map = BTreeMap::new(); let mut wasi_map = BTreeMap::new();
for (k, v) in wasi_map_dir { for (k, v) in wasi_map_dir {
let path_v = v.canonicalize().unwrap_or(v.clone()); let path_v = v.canonicalize().unwrap_or_else(|_| v.clone());
let mut k_path = std::path::Path::new(&k).to_path_buf(); let mut k_path = std::path::Path::new(&k).to_path_buf();
if k_path.is_relative() { if k_path.is_relative() {
k_path = parent.join(&k); k_path = parent.join(&k);