If we can't formula, `tap_dir.find_formula do |child|` returns `nil`.
I could modify like that:

```ruby
        # result is a formula name or nil
        result = if query
          tap_dir.find_formula do |child|
            if child.basename(".rb").to_s == query
              break child.basename(".rb").to_s
            end
          end
        end
        result ||= ""
```
but @mikemcquaid didn't seem to prefer that.

Therefore, I modified like https://github.com/Homebrew/homebrew/pull/28203/files#diff-cef16ceb727f1d5a841e0295b083611fR152.