Skip to content

Commit df0e489

Browse files
committed
Do not use a second lookup for the contract in StrictHash assertion
`all?` iterator already provides contract for the `valid?` check. Use it instead of accessing `contract_hash` again.
1 parent 37201ba commit df0e489

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/contracts/builtin_contracts.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ def valid?(arg)
407407
return false unless arg.is_a?(Hash)
408408
return false unless arg.keys.sort.eql?(contract_hash.keys.sort)
409409

410-
contract_hash.all? do |key, _v|
411-
contract_hash.key?(key) && Contract.valid?(arg[key], contract_hash[key])
410+
contract_hash.all? do |key, contract|
411+
contract_hash.key?(key) && Contract.valid?(arg[key], contract)
412412
end
413413
end
414414
end

0 commit comments

Comments
 (0)