From 73fed9700f130ce46caffd954afbb949bf72573a Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 7 Jun 2024 13:13:05 -0700 Subject: [PATCH] Remove unused local variables These were found by running the specs with --parser=prism in Ruby 3.4.0-preview1. --- lib/sequel/adapters/shared/postgres.rb | 2 +- lib/sequel/plugins/association_pks.rb | 2 +- lib/sequel/plugins/validate_associated.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sequel/adapters/shared/postgres.rb b/lib/sequel/adapters/shared/postgres.rb index c147d7de8c..f127fa069a 100644 --- a/lib/sequel/adapters/shared/postgres.rb +++ b/lib/sequel/adapters/shared/postgres.rb @@ -2097,7 +2097,7 @@ def merge_do_nothing_when_not_matched(&block) # Support OVERRIDING USER|SYSTEM VALUE for MERGE INSERT. def merge_insert(*values, &block) h = {:type=>:insert, :values=>values} - if override = @opts[:override] + if @opts[:override] h[:override] = insert_override_sql(String.new) end _merge_when(h, &block) diff --git a/lib/sequel/plugins/association_pks.rb b/lib/sequel/plugins/association_pks.rb index fd66aa4fb7..76054fa6ff 100644 --- a/lib/sequel/plugins/association_pks.rb +++ b/lib/sequel/plugins/association_pks.rb @@ -294,7 +294,7 @@ def convert_pk_array(opts, pks) sch = klass.db_schema if primary_key.is_a?(Array) - if (cols = sch.values_at(*klass.primary_key)).all? && (convs = cols.map{|c| c[:type] == :integer}).all? + if (cols = sch.values_at(*klass.primary_key)).all? && (cols.map{|c| c[:type] == :integer}).all? db = model.db pks.map do |cpk| cpk.map do |pk| diff --git a/lib/sequel/plugins/validate_associated.rb b/lib/sequel/plugins/validate_associated.rb index defe08f5b2..be21857a6e 100644 --- a/lib/sequel/plugins/validate_associated.rb +++ b/lib/sequel/plugins/validate_associated.rb @@ -53,7 +53,7 @@ def delay_validate_associated_object(reflection, obj) def validate_associated_object(reflection, obj) return if reflection[:validate] == false association = reflection[:name] - if (reflection[:type] == :one_to_many || reflection[:type] == :one_to_one) && (key = reflection[:key]).is_a?(Symbol) && !(pk_val = obj.values[key]) + if (reflection[:type] == :one_to_many || reflection[:type] == :one_to_one) && (key = reflection[:key]).is_a?(Symbol) && !(obj.values[key]) p_key = pk unless pk.is_a?(Array) if p_key obj.values[key] = p_key