refactor(tvix/eval): slightly more readable AttrsRep::select

Suggestion from grfn in cl/6158.

Change-Id: I16dcf2296a5ec5d299d5a080ca099b8eda6c254e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6278
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-08-26 18:47:46 +03:00 committed by tazjin
parent 7da5076191
commit 48b0fac76b

View file

@ -51,17 +51,11 @@ impl AttrsRep {
match self {
AttrsRep::Empty => None,
AttrsRep::KV { name, value } => {
if key == "name" {
return Some(name);
}
if key == "value" {
return Some(value);
}
None
}
AttrsRep::KV { name, value } => match key {
"name" => Some(name),
"value" => Some(value),
_ => None,
},
AttrsRep::Map(map) => map.get(&key.into()),
}