refactor(tvix/cli): reference scanner owns all the strings

This gets very complex very quickly otherwise, as all the construction
paths for a reference scanner and all the access patterns for the
KnownPaths structure are not yet fully understood.

Change-Id: Ibadf1f18b476695f3c286fc6896ae557760edf63
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7827
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2023-01-14 01:45:06 +03:00 committed by tazjin
parent 940251b87f
commit 9cb3daee20
2 changed files with 29 additions and 50 deletions

View file

@ -107,8 +107,8 @@ impl KnownPaths {
}
/// Create a reference scanner from the current set of known paths.
pub fn reference_scanner<'a>(&'a self) -> ReferenceScanner<'a> {
let candidates: Vec<&'a str> = self.paths.keys().map(|s| s.as_str()).collect();
pub fn reference_scanner(&self) -> ReferenceScanner {
let candidates = self.paths.keys().map(Clone::clone).collect();
ReferenceScanner::new(candidates)
}
}