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"
@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

View File

@ -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

View File

@ -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

View File

@ -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!

View File

@ -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"