On the Optimality of Affine Decision Rules in Robust and Distributionally Robust Optimization