diff --git a/Library/Homebrew/PATH.rb b/Library/Homebrew/PATH.rb index 5730b2a11f6bd..16759a1b562e9 100644 --- a/Library/Homebrew/PATH.rb +++ b/Library/Homebrew/PATH.rb @@ -77,7 +77,7 @@ def empty? sig { returns(T.nilable(T.self_type)) } def existing - existing_path = select(&File.method(:directory?)) + existing_path = select { File.directory?(_1) } # return nil instead of empty PATH, to unset environment variables existing_path unless existing_path.empty? end diff --git a/Library/Homebrew/cask/dsl/version.rb b/Library/Homebrew/cask/dsl/version.rb index e6488c9c5c944..3b1887c0cda1b 100644 --- a/Library/Homebrew/cask/dsl/version.rb +++ b/Library/Homebrew/cask/dsl/version.rb @@ -135,7 +135,7 @@ def minor_patch # @api public sig { returns(T::Array[Version]) } # Only top-level T.self_type is supported https://sorbet.org/docs/self-type def csv - split(",").map(&self.class.method(:new)) + split(",").map { self.class.new(_1) } end # @api public diff --git a/Library/Homebrew/cask/pkg.rb b/Library/Homebrew/cask/pkg.rb index a71e0eb17b370..49dcade6b01c5 100644 --- a/Library/Homebrew/cask/pkg.rb +++ b/Library/Homebrew/cask/pkg.rb @@ -90,7 +90,7 @@ def pkgutil_bom_all .stdout .split("\n") .map { |path| root.join(path) } - .reject(&MacOS.public_method(:undeletable?)) + .reject { MacOS.undeletable?(_1) } end sig { returns(Pathname) } diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index ca51b66111012..b79de366c2ded 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -679,7 +679,7 @@ def initialize(arg1, arg2, missing: false) class OptionConflictError < UsageError def initialize(args) - args_list = args.map(&Formatter.public_method(:option)) + args_list = args.map { Formatter.option(_1) } .join(" and ") super "Options #{args_list} are mutually exclusive." end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 4d7a21cf960bd..5fb23489e2bc6 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -664,7 +664,7 @@ def install_dependencies(deps) puts "All dependencies for #{formula.full_name} are satisfied." elsif !deps.empty? oh1 "Installing dependencies for #{formula.full_name}: " \ - "#{deps.map(&:first).map(&Formatter.method(:identifier)).to_sentence}", + "#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}", truncate: false deps.each { |dep, options| install_dependency(dep, options) } end @@ -1184,7 +1184,7 @@ def fetch_dependencies return if deps.empty? oh1 "Fetching dependencies for #{formula.full_name}: " \ - "#{deps.map(&:first).map(&Formatter.method(:identifier)).to_sentence}", + "#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}", truncate: false deps.each { |(dep, _options)| fetch_dependency(dep) } diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 69809a5859f61..eb1252e6984cd 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -143,7 +143,7 @@ def replace_text_in_files(relocation, files: nil) files ||= text_files | libtool_files changed_files = T.let([], Array) - files.map(&path.method(:join)).group_by { |f| f.stat.ino }.each_value do |first, *rest| + files.map { path.join(_1) }.group_by { |f| f.stat.ino }.each_value do |first, *rest| s = first.open("rb", &:read) next unless relocation.replace_text(s) diff --git a/Library/Homebrew/system_command.rb b/Library/Homebrew/system_command.rb index d9935d007d41c..55ec51978990a 100644 --- a/Library/Homebrew/system_command.rb +++ b/Library/Homebrew/system_command.rb @@ -276,7 +276,7 @@ def each_output_line(&block) sig { params(raw_stdin: IO).void } def write_input_to(raw_stdin) - input.each(&raw_stdin.method(:write)) + input.each { raw_stdin.write(_1) } end sig { params(sources: T::Array[IO], _block: T.proc.params(type: Symbol, line: String).void).void } diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 44225a085bc4e..1431c8fdcdfd4 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -322,11 +322,11 @@ def versions end def stable_version - versions["stable"]&.then(&Version.method(:new)) + versions["stable"]&.then { Version.new(_1) } end def head_version - versions["head"]&.then(&Version.method(:new)) + versions["head"]&.then { Version.new(_1) } end def version_scheme diff --git a/Library/Homebrew/test/cask/list_spec.rb b/Library/Homebrew/test/cask/list_spec.rb index ff96c2cc2661c..6fea3f479806d 100644 --- a/Library/Homebrew/test/cask/list_spec.rb +++ b/Library/Homebrew/test/cask/list_spec.rb @@ -97,7 +97,7 @@ let(:casks) { [caffeine, transmission] } it "lists the installed files for those Casks" do - casks.each(&InstallHelper.method(:install_without_artifacts_with_caskfile)) + casks.each { InstallHelper.install_without_artifacts_with_caskfile(_1) } transmission.artifacts.select { |a| a.is_a?(Cask::Artifact::App) }.each do |artifact| artifact.install_phase(command: NeverSudoSystemCommand, force: false) diff --git a/Library/Homebrew/test/cask/uninstall_spec.rb b/Library/Homebrew/test/cask/uninstall_spec.rb index e281a6a1628f3..6fdf8b589871c 100644 --- a/Library/Homebrew/test/cask/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/uninstall_spec.rb @@ -124,7 +124,7 @@ before do app.tap(&:mkpath) .join("Contents").tap(&:mkpath) - .join("Info.plist").tap(&FileUtils.method(:touch)) + .join("Info.plist").tap { FileUtils.touch(_1) } caskroom_path.mkpath