mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 05:38:19 +00:00
Use anyhow::ensure
This commit is contained in:
@@ -448,9 +448,11 @@ fn split_version(s: &str) -> Result<SplitVersion, anyhow::Error> {
|
||||
command: captures.get(4).cloned(),
|
||||
};
|
||||
|
||||
if prohibited_package_names.any(|s| s == sv.package.trim()) {
|
||||
return Err(anyhow::anyhow!("Invalid package name {:?}", sv.package));
|
||||
}
|
||||
let svp = sv.package.clone();
|
||||
anyhow::ensure!(
|
||||
!prohibited_package_names.any(|s| s == sv.package.trim()),
|
||||
"Invalid package name {svp:?}"
|
||||
);
|
||||
|
||||
Ok(sv)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user