mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:52:45 +00:00 
			
		
		
		
	AK: Make the Optional formatter always available and tweak its format
There's no real reason to make this a debug-only formatter, on top of that, jakt has a optional formatter that prints None/foo instead of OptionalNone/Optional(foo), which is more concise anyway, so switch to that.
This commit is contained in:
		
							parent
							
								
									8ff6239d4f
								
							
						
					
					
						commit
						41cf52a623
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		|  | @ -717,13 +717,11 @@ struct Formatter<ErrorOr<T, ErrorType>> : Formatter<FormatString> { | |||
| 
 | ||||
| template<typename T> | ||||
| struct Formatter<Optional<T>> : Formatter<FormatString> { | ||||
|     static constexpr bool is_debug_only() { return true; } | ||||
| 
 | ||||
|     ErrorOr<void> format(FormatBuilder& builder, Optional<T> const& optional) | ||||
|     { | ||||
|         if (optional.has_value()) | ||||
|             return Formatter<FormatString>::format(builder, "Optional({})"sv, *optional); | ||||
|         return builder.put_literal("OptionalNone"sv); | ||||
|             return Formatter<FormatString>::format(builder, "{}"sv, *optional); | ||||
|         return builder.put_literal("None"sv); | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ali Mohammad Pur
						Ali Mohammad Pur