From bbca610601f70700368942a1ccd47461fb208fc8 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sun, 7 Sep 2025 12:13:36 -0700 Subject: [PATCH] Use type-safe blocks --- Library/Homebrew/bundle/commands/cleanup.rb | 2 +- Library/Homebrew/bundle/formula_dumper.rb | 2 +- Library/Homebrew/commands.rb | 2 +- Library/Homebrew/description_cache_store.rb | 2 +- Library/Homebrew/style.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/bundle/commands/cleanup.rb b/Library/Homebrew/bundle/commands/cleanup.rb index 9eb6847f44..2715fed00b 100644 --- a/Library/Homebrew/bundle/commands/cleanup.rb +++ b/Library/Homebrew/bundle/commands/cleanup.rb @@ -183,7 +183,7 @@ module Homebrew require "bundle/tap_dumper" @dsl ||= Brewfile.read(global:, file:) - kept_formulae = self.kept_formulae(global:, file:).filter_map(&method(:lookup_formula)) + kept_formulae = self.kept_formulae(global:, file:).filter_map { lookup_formula(_1) } kept_taps = @dsl.entries.select { |e| e.type == :tap }.map(&:name) kept_taps += kept_formulae.filter_map(&:tap).map(&:name) current_taps = Homebrew::Bundle::TapDumper.tap_names diff --git a/Library/Homebrew/bundle/formula_dumper.rb b/Library/Homebrew/bundle/formula_dumper.rb index 635ab09507..73762eb949 100644 --- a/Library/Homebrew/bundle/formula_dumper.rb +++ b/Library/Homebrew/bundle/formula_dumper.rb @@ -40,7 +40,7 @@ module Homebrew @formulae_by_full_name ||= {} if name.nil? - formulae = Formula.installed.map(&method(:add_formula)) + formulae = Formula.installed.map { add_formula(_1) } sort!(formulae) return @formulae_by_full_name end diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 7f948ab23b..421866524d 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -128,7 +128,7 @@ module Commands OFFICIAL_CMD_TAPS.flat_map do |tap_name, cmds| tap = Tap.fetch(tap_name) tap.install(quiet:) unless tap.installed? - cmds.map(&method(:external_ruby_v2_cmd_path)).compact + cmds.map { external_ruby_v2_cmd_path(_1) }.compact end end diff --git a/Library/Homebrew/description_cache_store.rb b/Library/Homebrew/description_cache_store.rb index 4804a2bfea..9d39e40c58 100644 --- a/Library/Homebrew/description_cache_store.rb +++ b/Library/Homebrew/description_cache_store.rb @@ -83,7 +83,7 @@ class DescriptionCacheStore < CacheStore def delete_from_formula_names!(formula_names) return if database.empty? - formula_names.each(&method(:delete!)) + formula_names.each { delete!(_1) } end alias delete_from_cask_tokens! delete_from_formula_names! diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 2a55175806..347c30a16a 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -49,7 +49,7 @@ module Homebrew ruby_files = T.let([], T::Array[Pathname]) shell_files = T.let([], T::Array[Pathname]) actionlint_files = T.let([], T::Array[Pathname]) - Array(files).map(&method(:Pathname)) + Array(files).map { Pathname(_1) } .each do |path| case path.extname when ".rb"