mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 00:51:56 +00:00 
			
		
		
		
	Simplify Optional handling
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/dirs.rs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/dirs.rs
									
									
									
									
									
								
							@@ -25,10 +25,7 @@ impl BatProjectDirs {
 | 
			
		||||
        #[cfg(not(target_os = "macos"))]
 | 
			
		||||
        let cache_dir_op = dirs_rs::cache_dir();
 | 
			
		||||
 | 
			
		||||
        let cache_dir = match cache_dir_op {
 | 
			
		||||
            Some(d) => d.join("bat"),
 | 
			
		||||
            None => return None,
 | 
			
		||||
        };
 | 
			
		||||
        let cache_dir = cache_dir_op.map(|d| d.join("bat"))?;
 | 
			
		||||
 | 
			
		||||
        #[cfg(target_os = "macos")]
 | 
			
		||||
        let config_dir_op = env::var_os("XDG_CONFIG_HOME")
 | 
			
		||||
@@ -39,10 +36,7 @@ impl BatProjectDirs {
 | 
			
		||||
        #[cfg(not(target_os = "macos"))]
 | 
			
		||||
        let config_dir_op = dirs_rs::config_dir();
 | 
			
		||||
 | 
			
		||||
        let config_dir = match config_dir_op {
 | 
			
		||||
            Some(d) => d.join("bat"),
 | 
			
		||||
            None => return None,
 | 
			
		||||
        };
 | 
			
		||||
        let config_dir = config_dir_op.map(|d| d.join("bat"))?;
 | 
			
		||||
 | 
			
		||||
        Some(BatProjectDirs {
 | 
			
		||||
            cache_dir,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user