Fix `brew leaves` when using taps

`brew leaves` will return incorrect output when a formula in a tap takes a dependency on another formula in that tap. The name of the dependency might be "mpv-player/mpv/waf", but the formula will be "waf". To make the filtering work, it's necessary to treat the name of the formula rather than the name of the dependency.

# Steps to reproduce:

- `brew tap mpv-player/mpv`
- `brew install mpv`
- `brew leaves` will include three entries; "libass-ct", "mpv" and "waf"