The Supreme Court ends a looming legal threat to state clean energy laws