Merge pull request #17405 from Homebrew/fewer-casts
Remove unnecessary use of `T.cast`
This commit is contained in:
commit
c9acd4e372
@ -155,9 +155,9 @@ module Cask
|
|||||||
sig { returns(T::Array[String]) }
|
sig { returns(T::Array[String]) }
|
||||||
def languages
|
def languages
|
||||||
[
|
[
|
||||||
*T.cast(explicit.fetch(:languages, []), T::Array[String]),
|
*explicit.fetch(:languages, []),
|
||||||
*T.cast(env.fetch(:languages, []), T::Array[String]),
|
*env.fetch(:languages, []),
|
||||||
*T.cast(default.fetch(:languages, []), T::Array[String]),
|
*default.fetch(:languages, []),
|
||||||
].uniq.select do |lang|
|
].uniq.select do |lang|
|
||||||
# Ensure all languages are valid.
|
# Ensure all languages are valid.
|
||||||
Locale.parse(lang)
|
Locale.parse(lang)
|
||||||
|
@ -1829,15 +1829,13 @@ class Formula
|
|||||||
# Standard parameters for cabal-v2 builds.
|
# Standard parameters for cabal-v2 builds.
|
||||||
sig { returns(T::Array[String]) }
|
sig { returns(T::Array[String]) }
|
||||||
def std_cabal_v2_args
|
def std_cabal_v2_args
|
||||||
env = T.cast(ENV, T.any(Stdenv, Superenv))
|
|
||||||
|
|
||||||
# cabal-install's dependency-resolution backtracking strategy can
|
# cabal-install's dependency-resolution backtracking strategy can
|
||||||
# easily need more than the default 2,000 maximum number of
|
# easily need more than the default 2,000 maximum number of
|
||||||
# "backjumps," since Hackage is a fast-moving, rolling-release
|
# "backjumps," since Hackage is a fast-moving, rolling-release
|
||||||
# target. The highest known needed value by a formula was 43,478
|
# target. The highest known needed value by a formula was 43,478
|
||||||
# for git-annex, so 100,000 should be enough to avoid most
|
# for git-annex, so 100,000 should be enough to avoid most
|
||||||
# gratuitous backjumps build failures.
|
# gratuitous backjumps build failures.
|
||||||
["--jobs=#{env.make_jobs}", "--max-backjumps=100000", "--install-method=copy", "--installdir=#{bin}"]
|
["--jobs=#{ENV.make_jobs}", "--max-backjumps=100000", "--install-method=copy", "--installdir=#{bin}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Standard parameters for meson builds.
|
# Standard parameters for meson builds.
|
||||||
@ -3156,8 +3154,7 @@ class Formula
|
|||||||
if cmd == "python"
|
if cmd == "python"
|
||||||
setup_py_in_args = %w[setup.py build.py].include?(args.first)
|
setup_py_in_args = %w[setup.py build.py].include?(args.first)
|
||||||
setuptools_shim_in_args = args.any? { |a| a.to_s.start_with? "import setuptools" }
|
setuptools_shim_in_args = args.any? { |a| a.to_s.start_with? "import setuptools" }
|
||||||
env = T.cast(ENV, T.any(Stdenv, Superenv))
|
ENV.refurbish_args if setup_py_in_args || setuptools_shim_in_args
|
||||||
env.refurbish_args if setup_py_in_args || setuptools_shim_in_args
|
|
||||||
end
|
end
|
||||||
|
|
||||||
$stdout.reopen(out)
|
$stdout.reopen(out)
|
||||||
|
@ -462,7 +462,6 @@ module Formulary
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
klass = T.cast(klass, T.class_of(Formula))
|
|
||||||
mod.const_set(class_name, klass)
|
mod.const_set(class_name, klass)
|
||||||
|
|
||||||
platform_cache[:api] ||= {}
|
platform_cache[:api] ||= {}
|
||||||
|
@ -152,8 +152,7 @@ module Homebrew
|
|||||||
when true, false
|
when true, false
|
||||||
@keep_alive = { always: value }
|
@keep_alive = { always: value }
|
||||||
when Hash
|
when Hash
|
||||||
hash = T.cast(value, Hash)
|
unless (value.keys - KEEP_ALIVE_KEYS).empty?
|
||||||
unless (hash.keys - KEEP_ALIVE_KEYS).empty?
|
|
||||||
raise TypeError, "Service#keep_alive allows only #{KEEP_ALIVE_KEYS}"
|
raise TypeError, "Service#keep_alive allows only #{KEEP_ALIVE_KEYS}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user