Skip to content

Commit

Permalink
remove if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
hyuraku committed Mar 28, 2022
1 parent 94625d5 commit 0758631
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Library/Homebrew/extend/os/mac/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ def search_casks(string_or_regex)
results = cask_tokens.extend(Searchable)
.search(string_or_regex)

if results.empty?
cask_names = Cask::Cask.all.map(&:full_name)
results = DidYouMean::SpellChecker.new(dictionary: cask_names).correct(string_or_regex)
end
cask_names = Cask::Cask.all.map(&:full_name)
results |= DidYouMean::SpellChecker.new(dictionary: cask_names)
.correct(string_or_regex)

results.sort.map do |name|
cask = Cask::CaskLoader.load(name)
Expand All @@ -48,7 +47,7 @@ def search_casks(string_or_regex)
else
cask.token
end
end
end.uniq
end
end

Expand Down

0 comments on commit 0758631

Please sign in to comment.