Skip to content

Commit 1f052b2

Browse files
committed
Fix ruby warnings
1 parent 010e9f2 commit 1f052b2

File tree

11 files changed

+22
-27
lines changed

11 files changed

+22
-27
lines changed

lib-edge/concurrent/edge/erlang_actor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ module FunctionShortcuts
529529
# Optionally included shortcut method for {Functions#spawn_actor}
530530
# @return [Pid]
531531
def spawn(*args, &body)
532-
spawn_actor *args, &body
532+
spawn_actor(*args, &body)
533533
end
534534

535535
# Optionally included shortcut method for {Functions#terminate_actor}

spec/concurrent/agent_spec.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ module Concurrent
7575
end
7676

7777
specify 'upon validation the new value will be set to the block return value' do
78-
actual = nil
7978
expected = 42
80-
validator = ->(new_value) { true }
79+
validator = ->(_new_value) { true }
8180
subject = Agent.new(0, validator: validator)
8281
subject.send_via(immediate) { expected }
8382
expect(subject.value).to eq expected
@@ -323,8 +322,6 @@ def update(time, old_value, new_value)
323322
end
324323

325324
it 'does not block further action processing' do
326-
expected = 42
327-
actual = nil
328325
subject = Agent.new(0, error_mode: :continue)
329326
subject.send_via(immediate) { raise StandardError }
330327
subject.send_via(immediate) { 42 }

spec/concurrent/cancellation_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
specify 'basic' do
44
cancellation, origin = Concurrent::Cancellation.new
55
expect(cancellation.origin).to eq origin
6-
expect(cancellation.to_s).to match /Cancellation.*pending/
6+
expect(cancellation.to_s).to match(/Cancellation.*pending/)
77

88
futures1 = ::Array.new(2) do
99
Concurrent::Promises.future(cancellation) do |c|
@@ -20,7 +20,7 @@
2020

2121
sleep 0.01
2222
origin.resolve
23-
expect(cancellation.to_s).to match /Cancellation.*canceled/
23+
expect(cancellation.to_s).to match(/Cancellation.*canceled/)
2424

2525
futures1.each do |future|
2626
expect(future.value!).to eq :done

spec/concurrent/channel/tick_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class Channel
1818

1919
specify '#utc returns a Time object in UTC' do
2020
t = subject.utc
21-
expect(subject.utc).to be_a Time
22-
expect(subject.utc.zone).to eq 'UTC'
21+
expect(t).to be_a Time
22+
expect(t.zone).to eq 'UTC'
2323
end
2424

2525
specify '#epoch returns the UTC time as epoch seconds' do
@@ -45,7 +45,6 @@ class Channel
4545
end
4646

4747
it 'correctly compares to a Time' do
48-
present = Time.now
4948
past = Time.now - 42*60*60
5049
future = Time.now + 42*60*60
5150

spec/concurrent/edge/erlang_actor_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@
552552
expect(trapped_exit.from).to eq b
553553
expect(trapped_exit.reason).to eq b.terminated.reason
554554
expect(trapped_exit.reason).to be_a ArgumentError
555-
expect(trapped_exit.reason.message).to match /uncaught throw :uncaught/
555+
expect(trapped_exit.reason.message).to match(/uncaught throw :uncaught/)
556556
end
557557
end
558558

spec/concurrent/executor/safe_task_executor_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ module Concurrent
1010
subject { SafeTaskExecutor.new(task) }
1111

1212
it 'should return success' do
13-
success, value, reason = subject.execute
13+
success, _value, _reason = subject.execute
1414
expect(success).to be_truthy
1515
end
1616

1717
it 'should return task value' do
18-
success, value, reason = subject.execute
18+
_success, value, _reason = subject.execute
1919
expect(value).to eq 42
2020
end
2121

2222
it 'should return a nil reason' do
23-
success, value, reason = subject.execute
23+
_success, _value, reason = subject.execute
2424
expect(reason).to be_nil
2525
end
2626

@@ -43,17 +43,17 @@ module Concurrent
4343
subject { SafeTaskExecutor.new(task) }
4444

4545
it 'should return false success' do
46-
success, value, reason = subject.execute
46+
success, _value, _reason = subject.execute
4747
expect(success).to be_falsey
4848
end
4949

5050
it 'should return a nil value' do
51-
success, value, reason = subject.execute
51+
_success, value, _reason = subject.execute
5252
expect(value).to be_nil
5353
end
5454

5555
it 'should return the reason' do
56-
success, value, reason = subject.execute
56+
_success, _value, reason = subject.execute
5757
expect(reason).to be_a(StandardError)
5858
expect(reason.message).to eq 'an error'
5959
end

spec/concurrent/maybe_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module Concurrent
2121
it 'passes all arguments to the block' do
2222
expected = [1, 2, 3]
2323
actual = nil
24-
maybe = Maybe.from(*expected) do |*args|
24+
Maybe.from(*expected) do |*args|
2525
actual = args
2626
end
2727
expect(actual).to eq expected

spec/concurrent/mvar_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def dereferenceable_subject(value, opts = {})
5555
it 'waits for another thread to #put' do
5656
m = MVar.new
5757

58-
putter = in_thread {
58+
in_thread {
5959
sleep(0.1)
6060
m.put 14
6161
}
@@ -115,7 +115,7 @@ def dereferenceable_subject(value, opts = {})
115115
it 'waits for another thread to #take' do
116116
m = MVar.new(14)
117117

118-
putter = in_thread {
118+
in_thread {
119119
sleep(0.1)
120120
m.take
121121
}
@@ -184,7 +184,7 @@ def dereferenceable_subject(value, opts = {})
184184
it 'waits for another thread to #put' do
185185
m = MVar.new
186186

187-
putter = in_thread {
187+
in_thread {
188188
sleep(0.1)
189189
m.put 14
190190
}
@@ -198,7 +198,7 @@ def dereferenceable_subject(value, opts = {})
198198
# #modify conceptually does #take and #put - but it should be atomic.
199199
# Check that another #put can't sneak it during the #modify.
200200

201-
modifier = in_thread {
201+
in_thread {
202202
m.modify do |v|
203203
sleep(0.5)
204204
1

spec/concurrent/scheduled_task_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def trigger_observable(observable)
5656
it 'accepts a number of seconds (from now) as the schedule time' do
5757
expected = 60
5858
Timecop.freeze do
59-
now = Time.now
6059
task = ScheduledTask.new(expected){ nil }.execute
6160
expect(task.initial_delay).to be_within(0.1).of(expected)
6261
end

spec/concurrent/throttle_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
specify '#to_s' do
4343
throttle = Concurrent::Throttle.new 2
44-
expect(throttle.to_s).to match /Throttle.*available 2 of 2/
44+
expect(throttle.to_s).to match(/Throttle.*available 2 of 2/)
4545
end
4646

4747
specify '#on' do
@@ -76,8 +76,8 @@
7676
).value!
7777
expect(result.all? { |v| v <= limit }).to be_truthy, result.to_s
7878

79-
result = Array.new(20) do |i|
80-
Thread.new(i) { |i| throttle.acquire { testing.call i } }
79+
result = Array.new(20) do |i1|
80+
Thread.new(i1) { |i2| throttle.acquire { testing.call i2 } }
8181
end.map(&:value)
8282
expect(result.all? { |v| v <= limit }).to be_truthy, result.to_s
8383

0 commit comments

Comments
 (0)