From 72e4ac8fe95ddab72b21481f010c45c978ee8b8c Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 16 Nov 2019 08:17:46 -0700 Subject: [PATCH] Remove unnecessary free variables --- src/spectator/dsl/mocks.cr | 2 +- src/spectator/formatting/comment.cr | 2 +- src/spectator/matchers/change_from_matcher.cr | 4 ++-- src/spectator/matchers/change_matcher.cr | 10 +++++----- src/spectator/matchers/change_to_matcher.cr | 4 ++-- src/spectator/matchers/truthy_matcher.cr | 12 ++++++------ src/spectator/mocks/nil_method_stub.cr | 2 +- src/spectator/test_values.cr | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/spectator/dsl/mocks.cr b/src/spectator/dsl/mocks.cr index a398059..e155960 100644 --- a/src/spectator/dsl/mocks.cr +++ b/src/spectator/dsl/mocks.cr @@ -113,7 +113,7 @@ module Spectator::DSL {% end %} end - def allow(thing : T) forall T + def allow(thing) Mocks::Allow.new(thing) end diff --git a/src/spectator/formatting/comment.cr b/src/spectator/formatting/comment.cr index cbe6919..6a42685 100644 --- a/src/spectator/formatting/comment.cr +++ b/src/spectator/formatting/comment.cr @@ -13,7 +13,7 @@ module Spectator::Formatting end # Creates a colorized version of the comment. - def self.color(text : T) forall T + def self.color(text) Color.comment(new(text)) end end diff --git a/src/spectator/matchers/change_from_matcher.cr b/src/spectator/matchers/change_from_matcher.cr index cafb51d..fa3504b 100644 --- a/src/spectator/matchers/change_from_matcher.cr +++ b/src/spectator/matchers/change_from_matcher.cr @@ -63,12 +63,12 @@ module Spectator::Matchers end # Specifies what the resulting value of the expression must be. - def to(value : T) forall T + def to(value) ChangeExactMatcher.new(@expression, @expected, value) end # Specifies what the resulting value of the expression should change by. - def by(amount : T) forall T + def by(amount) ChangeExactMatcher.new(@expression, @expected, @expected + value) end diff --git a/src/spectator/matchers/change_matcher.cr b/src/spectator/matchers/change_matcher.cr index 2b016d5..5de2415 100644 --- a/src/spectator/matchers/change_matcher.cr +++ b/src/spectator/matchers/change_matcher.cr @@ -49,27 +49,27 @@ module Spectator::Matchers end # Specifies what the initial value of the expression must be. - def from(value : T) forall T + def from(value) ChangeFromMatcher.new(@expression, value) end # Specifies what the resulting value of the expression must be. - def to(value : T) forall T + def to(value) ChangeToMatcher.new(@expression, value) end # Specifies that t he resulting value must be some amount different. - def by(amount : T) forall T + def by(amount) ChangeRelativeMatcher.new(@expression, "by #{amount}") { |before, after| amount == after - before } end # Specifies that the resulting value must be at least some amount different. - def by_at_least(minimum : T) forall T + def by_at_least(minimum) ChangeRelativeMatcher.new(@expression, "by at least #{minimum}") { |before, after| minimum <= after - before } end # Specifies that the resulting value must be at most some amount different. - def by_at_most(maximum : T) forall T + def by_at_most(maximum) ChangeRelativeMatcher.new(@expression, "by at most #{maximum}") { |before, after| maximum >= after - before } end diff --git a/src/spectator/matchers/change_to_matcher.cr b/src/spectator/matchers/change_to_matcher.cr index a05587a..e29d23b 100644 --- a/src/spectator/matchers/change_to_matcher.cr +++ b/src/spectator/matchers/change_to_matcher.cr @@ -57,12 +57,12 @@ module Spectator::Matchers end # Specifies what the initial value of the expression must be. - def from(value : T) forall T + def from(value) ChangeExactMatcher.new(@expression, value, @expected) end # Specifies how much the initial value should change by. - def by(amount : T) forall T + def by(amount) ChangeExactMatcher.new(@expression, @expected - amount, @expected) end diff --git a/src/spectator/matchers/truthy_matcher.cr b/src/spectator/matchers/truthy_matcher.cr index df21d8c..09230b8 100644 --- a/src/spectator/matchers/truthy_matcher.cr +++ b/src/spectator/matchers/truthy_matcher.cr @@ -27,7 +27,7 @@ module Spectator::Matchers # ``` # expect(0).to be < 1 # ``` - def <(value : ExpectedType) forall ExpectedType + def <(value) expected = TestValue.new(value) LessThanMatcher.new(expected) end @@ -37,7 +37,7 @@ module Spectator::Matchers # ``` # expect(0).to be <= 1 # ``` - def <=(value : ExpectedType) forall ExpectedType + def <=(value) expected = TestValue.new(value) LessThanEqualMatcher.new(expected) end @@ -47,7 +47,7 @@ module Spectator::Matchers # ``` # expect(2).to be > 1 # ``` - def >(value : ExpectedType) forall ExpectedType + def >(value) expected = TestValue.new(value) GreaterThanMatcher.new(expected) end @@ -57,7 +57,7 @@ module Spectator::Matchers # ``` # expect(2).to be >= 1 # ``` - def >=(value : ExpectedType) forall ExpectedType + def >=(value) expected = TestValue.new(value) GreaterThanEqualMatcher.new(expected) end @@ -67,7 +67,7 @@ module Spectator::Matchers # ``` # expect(0).to be == 0 # ``` - def ==(value : ExpectedType) forall ExpectedType + def ==(value) expected = TestValue.new(value) EqualityMatcher.new(expected) end @@ -77,7 +77,7 @@ module Spectator::Matchers # ``` # expect(0).to be != 1 # ``` - def !=(value : ExpectedType) forall ExpectedType + def !=(value) expected = TestValue.new(value) InequalityMatcher.new(expected) end diff --git a/src/spectator/mocks/nil_method_stub.cr b/src/spectator/mocks/nil_method_stub.cr index 64e10bb..04b203a 100644 --- a/src/spectator/mocks/nil_method_stub.cr +++ b/src/spectator/mocks/nil_method_stub.cr @@ -8,7 +8,7 @@ module Spectator::Mocks nil end - def and_return(value : T) forall T + def and_return(value) ValueMethodStub.new(@name, @source, value, @args) end diff --git a/src/spectator/test_values.cr b/src/spectator/test_values.cr index d07da71..8503ca8 100644 --- a/src/spectator/test_values.cr +++ b/src/spectator/test_values.cr @@ -18,8 +18,8 @@ module Spectator # Adds a new value by duplicating the current set and adding to it. # The new sample values with the additional value is returned. # The original set of sample values is not modified. - def add(id : Symbol, name : String, value : T) : TestValues forall T - wrapper = TypedValueWrapper(T).new(value) + def add(id : Symbol, name : String, value) : TestValues + wrapper = TypedValueWrapper.new(value) TestValues.new(@values.merge({ id => Entry.new(name, wrapper), }))