Non-vanishing of $L$-functions over function fields