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 {
 | 
					        match self {
 | 
				
			||||||
            AttrsRep::Empty => None,
 | 
					            AttrsRep::Empty => None,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            AttrsRep::KV { name, value } => {
 | 
					            AttrsRep::KV { name, value } => match key {
 | 
				
			||||||
                if key == "name" {
 | 
					                "name" => Some(name),
 | 
				
			||||||
                    return Some(name);
 | 
					                "value" => Some(value),
 | 
				
			||||||
                }
 | 
					                _ => None,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
                if key == "value" {
 | 
					 | 
				
			||||||
                    return Some(value);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                None
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            AttrsRep::Map(map) => map.get(&key.into()),
 | 
					            AttrsRep::Map(map) => map.get(&key.into()),
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue