refactor(tvix/eval): get rid of Value::Blackhole variant
This is no longer needed for anything and the extra clone here is not really more costly than constructing a blackhole value in a different place. Change-Id: I5c63085b1b4418b629ea58a42e3bfe9a9b586d76 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6275 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									d761d934ed
								
							
						
					
					
						commit
						bc9351f811
					
				
					 2 changed files with 3 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -315,8 +315,8 @@ fn attempt_optimise_kv(slice: &mut [Value]) -> Option<NixAttrs> {
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    Some(NixAttrs(AttrsRep::KV {
 | 
			
		||||
        name: std::mem::replace(&mut slice[name_idx], Value::Blackhole),
 | 
			
		||||
        value: std::mem::replace(&mut slice[value_idx], Value::Blackhole),
 | 
			
		||||
        name: slice[name_idx].clone(),
 | 
			
		||||
        value: slice[value_idx].clone(),
 | 
			
		||||
    }))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,6 @@ pub enum Value {
 | 
			
		|||
    // Internal values that, while they technically exist at runtime,
 | 
			
		||||
    // are never returned to or created directly by users.
 | 
			
		||||
    AttrPath(Vec<NixString>),
 | 
			
		||||
    Blackhole,
 | 
			
		||||
    NotFound,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +54,7 @@ impl Value {
 | 
			
		|||
            Value::Closure(_) | Value::Builtin(_) => "lambda",
 | 
			
		||||
 | 
			
		||||
            // Internal types
 | 
			
		||||
            Value::AttrPath(_) | Value::Blackhole | Value::NotFound => "internal",
 | 
			
		||||
            Value::AttrPath(_) | Value::NotFound => "internal",
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +140,6 @@ impl Display for Value {
 | 
			
		|||
 | 
			
		||||
            // internal types
 | 
			
		||||
            Value::AttrPath(path) => write!(f, "internal[attrpath({})]", path.len()),
 | 
			
		||||
            Value::Blackhole => f.write_str("internal[blackhole]"),
 | 
			
		||||
            Value::NotFound => f.write_str("internal[not found]"),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue