mirror of
				https://github.com/astral-sh/uv.git
				synced 2025-10-31 12:06:13 +00:00 
			
		
		
		
	 3f83390e34
			
		
	
	
		3f83390e34
		
			
		
	
	
	
	
		
			
			## Summary Make the use of `Self` consistent. Mostly done by running `cargo clippy --fix -- -A clippy::all -W clippy::use_self`. ## Test Plan <!-- How was it tested? --> No need.
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			760 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			760 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
 | |
| pub enum DryRun {
 | |
|     /// The operation should execute in dry run mode.
 | |
|     Enabled,
 | |
|     /// The operation should execute in dry run mode and check if the current environment is
 | |
|     /// synced.
 | |
|     Check,
 | |
|     /// The operation should execute in normal mode.
 | |
|     #[default]
 | |
|     Disabled,
 | |
| }
 | |
| 
 | |
| impl DryRun {
 | |
|     /// Determine the [`DryRun`] setting based on the command-line arguments.
 | |
|     pub fn from_args(dry_run: bool) -> Self {
 | |
|         if dry_run {
 | |
|             Self::Enabled
 | |
|         } else {
 | |
|             Self::Disabled
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     /// Returns `true` if dry run mode is enabled.
 | |
|     pub const fn enabled(&self) -> bool {
 | |
|         matches!(self, Self::Enabled) || matches!(self, Self::Check)
 | |
|     }
 | |
| }
 |