A federal judge in Brooklyn formally rejected a $30 billion settlement between Visa, Mastercard and retailers to cap credit-card swipe fees after telegraphing earlier this month that such a setback in the two-decade long litigation could be expected.