refactor(nix-compat/store_path): use AsRef<str>
Implement PartialEq/Eq ourselves instead of deriving, by proxying to name.as_ref() (and digest of course). Also implement Hash on our own, clippy doesn't like this to be derived, while Eq/PartialEq is not. Change-Id: Idbe289a23ba3bc8dabf893d4d8752792ae2778c3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12744 Tested-by: BuildkiteCI Reviewed-by: edef <edef@edef.eu> Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
1474471327
commit
1428ea4e19
5 changed files with 48 additions and 34 deletions
|
|
@ -50,7 +50,7 @@ pub fn build_text_path<'a, S, SP, I, C>(
|
|||
) -> Result<StorePath<SP>, BuildStorePathError>
|
||||
where
|
||||
S: AsRef<str>,
|
||||
SP: std::cmp::Eq + std::ops::Deref<Target = str> + std::convert::From<&'a str>,
|
||||
SP: AsRef<str> + std::convert::From<&'a str>,
|
||||
I: IntoIterator<Item = S>,
|
||||
C: AsRef<[u8]>,
|
||||
{
|
||||
|
|
@ -69,7 +69,7 @@ pub fn build_ca_path<'a, S, SP, I>(
|
|||
) -> Result<StorePath<SP>, BuildStorePathError>
|
||||
where
|
||||
S: AsRef<str>,
|
||||
SP: std::cmp::Eq + std::ops::Deref<Target = str> + std::convert::From<&'a str>,
|
||||
SP: AsRef<str> + std::convert::From<&'a str>,
|
||||
I: IntoIterator<Item = S>,
|
||||
{
|
||||
// self references are only allowed for CAHash::Nar(NixHash::Sha256(_)).
|
||||
|
|
@ -129,7 +129,7 @@ pub fn build_output_path<'a, SP>(
|
|||
output_path_name: &'a str,
|
||||
) -> Result<StorePath<SP>, Error>
|
||||
where
|
||||
SP: std::cmp::Eq + std::ops::Deref<Target = str> + std::convert::From<&'a str>,
|
||||
SP: AsRef<str> + std::convert::From<&'a str>,
|
||||
{
|
||||
build_store_path_from_fingerprint_parts(
|
||||
&(String::from("output:") + output_name),
|
||||
|
|
@ -154,7 +154,7 @@ fn build_store_path_from_fingerprint_parts<'a, SP>(
|
|||
name: &'a str,
|
||||
) -> Result<StorePath<SP>, Error>
|
||||
where
|
||||
SP: std::cmp::Eq + std::ops::Deref<Target = str> + std::convert::From<&'a str>,
|
||||
SP: AsRef<str> + std::convert::From<&'a str>,
|
||||
{
|
||||
let fingerprint = format!(
|
||||
"{ty}:sha256:{}:{STORE_DIR}:{name}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue