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:
parent
7da5076191
commit
48b0fac76b
1 changed files with 5 additions and 11 deletions
|
@ -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()),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue