Simplify `len()` comparisons (#14907)
This PR removes certain `len()` comparisons when it would be faster/more
succinct to do a truthy check instead, such as `len(x) == 0` vs `not x`.
This fixes the
[`FURB115`](https://github.com/dosisod/refurb/blob/master/docs/checks.md#furb115-no-len-compare)
errors in Refurb (see #14887).