fix(tvix/eval): len_without_is_empty clippy warn
This CL addresses clippy warning len_without_is_empty which expects `.is_empty()` method to be present when implementing `.len()` method for an item. Change-Id: I8878db630b9ef5853649a906b764a33299bb5dc8 Signed-off-by: Aaqa Ishtyaq <aaqaishtyaq@gmail.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7806 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									09654ffb80
								
							
						
					
					
						commit
						158f4d1d69
					
				
					 3 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -898,7 +898,7 @@ mod pure_builtins {
 | 
			
		|||
    fn builtin_tail(_: &mut VM, list: Value) -> Result<Value, ErrorKind> {
 | 
			
		||||
        let xs = list.to_list()?;
 | 
			
		||||
 | 
			
		||||
        if xs.len() == 0 {
 | 
			
		||||
        if xs.is_empty() {
 | 
			
		||||
            Err(ErrorKind::TailEmptyList)
 | 
			
		||||
        } else {
 | 
			
		||||
            let output = xs.into_iter().skip(1).collect::<Vec<_>>();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -301,6 +301,14 @@ impl NixAttrs {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn is_empty(&self) -> bool {
 | 
			
		||||
        match &self.0 {
 | 
			
		||||
            AttrsRep::Im(map) => map.is_empty(),
 | 
			
		||||
            AttrsRep::Empty => true,
 | 
			
		||||
            AttrsRep::KV { .. } => false,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Select a value from an attribute set by key.
 | 
			
		||||
    pub fn select(&self, key: &str) -> Option<&Value> {
 | 
			
		||||
        self.0.select(key)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,6 +67,10 @@ impl NixList {
 | 
			
		|||
        self.0.get(i)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn is_empty(&self) -> bool {
 | 
			
		||||
        self.0.is_empty()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn construct(count: usize, stack_slice: Vec<Value>) -> Self {
 | 
			
		||||
        debug_assert!(
 | 
			
		||||
            count == stack_slice.len(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue