Merge pull request #16624 from reitermarkus/avoid-t-must

Avoid `T.must`.
This commit is contained in:
Markus Reiter 2024-02-10 12:38:43 +01:00 committed by GitHub
commit 73f1629fa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -540,23 +540,13 @@ class Formula
# Old names for the formula. # Old names for the formula.
sig { returns(T::Array[String]) } sig { returns(T::Array[String]) }
def oldnames def oldnames
@oldnames ||= if tap @oldnames ||= tap&.formula_oldnames&.dig(name) || []
T.must(tap).formula_oldnames.fetch(name, [])
else
[]
end
end end
# All aliases for the formula. # All aliases for the formula.
sig { returns(T::Array[String]) } sig { returns(T::Array[String]) }
def aliases def aliases
@aliases ||= if tap @aliases ||= tap&.alias_reverse_table&.dig(full_name)&.map { _1.split("/").last } || []
T.must(tap).alias_reverse_table[full_name].to_a.map do |a|
a.split("/").last
end
else
[]
end
end end
# The {Resource}s for the currently active {SoftwareSpec}. # The {Resource}s for the currently active {SoftwareSpec}.