While idioms are more common in informal settings, they can be used judiciously in certain types of formal writing to add flavor to the language.