diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb
index 68d725755774a0bade09ce0f5efdcdee1c97f34a..992aca583d56233427ea5e14c2e68e56e192abb3 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/search.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb
@@ -49,15 +49,12 @@ module Hbc
         else
           ohai "Partial matches"
         end
-        highlighted = partial_matches.map { |match| highlight_installed match }
-        puts Formatter.columns(highlighted)
+        puts Formatter.columns(partial_matches.map(&method(:highlight_installed)))
       end
 
       def self.highlight_installed(token)
-        if Cask.new(token).installed?
-          token = pretty_installed token
-        end
-        token
+        return token unless Cask.new(token).installed?
+        pretty_installed token
       end
 
       def self.help
diff --git a/Library/Homebrew/test/cask/cli/search_spec.rb b/Library/Homebrew/test/cask/cli/search_spec.rb
index 0bcff809afaa1f4809f2cf93c08e2b411d2bed6f..cc4e0ae63ef3fbe06a17d3ea105a3eaaee8acaf1 100644
--- a/Library/Homebrew/test/cask/cli/search_spec.rb
+++ b/Library/Homebrew/test/cask/cli/search_spec.rb
@@ -56,4 +56,16 @@ describe Hbc::CLI::Search, :cask do
       Hbc::CLI::Search.run("caskroom")
     }.to output(/^No Cask found for "caskroom"\.\n/).to_stdout
   end
+
+  it "doesn't highlight not installed packages" do
+    expect(Hbc::CLI::Search.highlight_installed "local-caffeine").to eq("local-caffeine")
+  end
+
+  it "highlights installed packages" do
+    shutup do
+        Hbc::CLI::Install.run("local-caffeine")
+    end
+
+    expect(Hbc::CLI::Search.highlight_installed "local-caffeine").to eq(pretty_installed "local-caffeine")
+  end
 end