refactor(nix-compat/store_path): consistently use SP as type param

We also use S in other places in the same file, but that's for the
string-like references.

SP is now consistently used as the type parameter for StorePath<_> (and
build_output_path) gets support for it).

By being a bit more careful in the order of assignments in nix-compat/
src/derivation, we can nudge the compiler to use the type we want.

Change-Id: Ia7c298e110dff98d3b113d2388674ce9e22b80e8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12590
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: Marijan Petričević <marijan.petricevic94@gmail.com>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-10-11 00:45:34 +03:00 committed by flokli
parent e8040ec61f
commit 48fa320cf4
3 changed files with 13 additions and 10 deletions

View file

@ -257,8 +257,8 @@ impl Derivation {
// For fixed output derivation we use [build_ca_path], otherwise we
// use [build_output_path] with [hash_derivation_modulo].
let abs_store_path = if let Some(ref hwm) = output.ca_hash {
build_ca_path(&path_name, hwm, Vec::<String>::new(), false).map_err(|e| {
let store_path = if let Some(ref hwm) = output.ca_hash {
build_ca_path(&path_name, hwm, Vec::<&str>::new(), false).map_err(|e| {
DerivationError::InvalidOutputDerivationPath(output_name.to_string(), e)
})?
} else {
@ -270,11 +270,11 @@ impl Derivation {
})?
};
output.path = Some(abs_store_path.to_owned());
self.environment.insert(
output_name.to_string(),
abs_store_path.to_absolute_path().into(),
store_path.to_absolute_path().into(),
);
output.path = Some(store_path);
}
Ok(())