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:
Florian Klink 2024-10-16 02:51:35 +03:00 committed by flokli
parent 1474471327
commit 1428ea4e19
5 changed files with 48 additions and 34 deletions

View file

@ -203,11 +203,7 @@ fn string_to_store_path<'a, 'i, S>(
path_str: &'a str,
) -> Result<StorePath<S>, nom::Err<NomError<&'i [u8]>>>
where
S: std::cmp::Eq
+ std::fmt::Display
+ std::clone::Clone
+ std::ops::Deref<Target = str>
+ std::convert::From<&'a str>,
S: std::clone::Clone + AsRef<str> + std::convert::From<&'a str>,
{
let path =
StorePath::from_absolute_path(path_str.as_bytes()).map_err(|e: store_path::Error| {