Browse Source
			
			
			Revert "Add feature to enable use of `Option::or` in const context"
			
				This reverts commit fe8e043b8a.
We want to run on stable soon, where these features are not supported
			
			
				pull/2195/head
			
			
		 
		
			
				
					
						 Jake Howard
					
					4 years ago
						Jake Howard
					
					4 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 57AFB45680EDD477
						
					
				
			
		
		
		
	
		
			
				 1 changed files with 
9 additions and 
2 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/main.rs
				
				
				
					
						
							
								
									
	
		
		
			
				
					|  | @ -1,5 +1,4 @@ | 
			
		
	
		
		
			
				
					|  |  | #![forbid(unsafe_code)] |  |  | #![forbid(unsafe_code)] | 
			
		
	
		
		
			
				
					|  |  | #![feature(const_option_ext)] |  |  |  | 
			
		
	
		
		
			
				
					|  |  | #![cfg_attr(feature = "unstable", feature(ip))] |  |  | #![cfg_attr(feature = "unstable", feature(ip))] | 
			
		
	
		
		
			
				
					|  |  | // The recursion_limit is mainly triggered by the json!() macro.
 |  |  | // The recursion_limit is mainly triggered by the json!() macro.
 | 
			
		
	
		
		
			
				
					|  |  | // The more key/value pairs there are the more recursion occurs.
 |  |  | // The more key/value pairs there are the more recursion occurs.
 | 
			
		
	
	
		
		
			
				
					|  | @ -77,7 +76,15 @@ const HELP: &str = "\ | 
			
		
	
		
		
			
				
					|  |  |             -v, --version    Prints the app version |  |  |             -v, --version    Prints the app version | 
			
		
	
		
		
			
				
					|  |  | "; |  |  | "; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  | pub const VERSION: Option<&str> = option_env!("BWRS_VERSION").or(option_env!("VW_VERSION")); |  |  | // HACK: Option::or cannot be used in a constant context
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | const fn get_version() -> Option<&'static str> { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     let bwrs_version = option_env!("BWRS_VERSION"); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     match bwrs_version { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         Some(_) => bwrs_version, | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         None => option_env!("VW_VERSION"), | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | pub const VERSION: Option<&str> = get_version(); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | fn parse_args() { |  |  | fn parse_args() { | 
			
		
	
		
		
			
				
					|  |  |     let mut pargs = pico_args::Arguments::from_env(); |  |  |     let mut pargs = pico_args::Arguments::from_env(); | 
			
		
	
	
		
		
			
				
					|  | 
 |