MAINT: optimize: remove dead code

`ndim` ("rank") of arrays that were previously flattened were being checked. The `ndim` of these is always one:

```python
>>> array(1).flatten()
array([1])
>>> type(array([1])[0])
<type 'numpy.int64'>
>>> array([1])[0].flatten()
array([1])
```

(The check and flatten could be swapped, but that would change current behavior.)