Merge pull request #20648 from Homebrew/dug/type-safe-blocks

Use type-safe blocks
This commit is contained in:
Douglas Eichelberger 2025-09-07 20:49:32 +00:00 committed by GitHub
commit 31fb2adc84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 5 deletions

View File

@ -183,7 +183,7 @@ module Homebrew
require "bundle/tap_dumper" require "bundle/tap_dumper"
@dsl ||= Brewfile.read(global:, file:) @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 = @dsl.entries.select { |e| e.type == :tap }.map(&:name)
kept_taps += kept_formulae.filter_map(&:tap).map(&:name) kept_taps += kept_formulae.filter_map(&:tap).map(&:name)
current_taps = Homebrew::Bundle::TapDumper.tap_names current_taps = Homebrew::Bundle::TapDumper.tap_names

View File

@ -40,7 +40,7 @@ module Homebrew
@formulae_by_full_name ||= {} @formulae_by_full_name ||= {}
if name.nil? if name.nil?
formulae = Formula.installed.map(&method(:add_formula)) formulae = Formula.installed.map { add_formula(_1) }
sort!(formulae) sort!(formulae)
return @formulae_by_full_name return @formulae_by_full_name
end end

View File

@ -128,7 +128,7 @@ module Commands
OFFICIAL_CMD_TAPS.flat_map do |tap_name, cmds| OFFICIAL_CMD_TAPS.flat_map do |tap_name, cmds|
tap = Tap.fetch(tap_name) tap = Tap.fetch(tap_name)
tap.install(quiet:) unless tap.installed? 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
end end

View File

@ -83,7 +83,7 @@ class DescriptionCacheStore < CacheStore
def delete_from_formula_names!(formula_names) def delete_from_formula_names!(formula_names)
return if database.empty? return if database.empty?
formula_names.each(&method(:delete!)) formula_names.each { delete!(_1) }
end end
alias delete_from_cask_tokens! delete_from_formula_names! alias delete_from_cask_tokens! delete_from_formula_names!

View File

@ -49,7 +49,7 @@ module Homebrew
ruby_files = T.let([], T::Array[Pathname]) ruby_files = T.let([], T::Array[Pathname])
shell_files = T.let([], T::Array[Pathname]) shell_files = T.let([], T::Array[Pathname])
actionlint_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| .each do |path|
case path.extname case path.extname
when ".rb" when ".rb"