build-support/rust: remove assertMsg usage

This commit is contained in:
Eman Resu
2026-05-26 14:14:55 -04:00
parent 4ea187a783
commit fded120b25
3 changed files with 9 additions and 6 deletions
@@ -4669,7 +4669,7 @@ rec {
# Not rate-limited, CDN URL.
url = "https://static.crates.io/crates/${crateConfig.crateName}/${crateConfig.crateName}-${crateConfig.version}.crate";
sha256 =
assert (lib.assertMsg (crateConfig ? sha256) "Missing sha256 for ${name}");
assert crateConfig ? sha256 || throw "Missing sha256 for ${name}";
crateConfig.sha256;
});
extraRustcOpts =
@@ -78,8 +78,9 @@ lib.extendMkDerivation {
...
}@args:
assert lib.assertMsg useFetchCargoVendor
"buildRustPackage: `useFetchCargoVendor` is nonoptional and enabled by default as of 25.05, remove it";
assert
useFetchCargoVendor
|| throw "buildRustPackage: `useFetchCargoVendor` is nonoptional and enabled by default as of 25.05, remove it";
assert lib.warnIf (args ? useFetchCargoVendor)
"buildRustPackage: `useFetchCargoVendor` is nonoptional and enabled by default as of 25.05, remove it"
@@ -120,9 +120,11 @@ let
checksum =
pkg.checksum or parsedLockFile.metadata."checksum ${pkg.name} ${pkg.version} (${pkg.source})";
in
assert lib.assertMsg (checksum != null) ''
Package ${pkg.name} does not have a checksum.
'';
assert
checksum != null
|| throw ''
Package ${pkg.name} does not have a checksum.
'';
fetchurl {
name = "crate-${pkg.name}-${pkg.version}.tar.gz";
url = "${downloadUrl}/${pkg.name}/${pkg.version}/download";