Skip to content

Commit 875a09e

Browse files
committed
Prefer literal -> lambdas over Kernel#lambda
* I'll take care of fixing the style for new specs.
1 parent 7cd019f commit 875a09e

File tree

1,226 files changed

+4968
-4953
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,226 files changed

+4968
-4953
lines changed

.rubocop.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,18 @@ Lint/UriRegexp:
100100
Lint/Debugger:
101101
Exclude:
102102
- 'core/binding/fixtures/irb.rb'
103+
104+
Style/Lambda:
105+
Enabled: true
106+
EnforcedStyle: literal
107+
Exclude:
108+
- 'language/lambda_spec.rb'
109+
- 'language/proc_spec.rb'
110+
- 'core/kernel/lambda_spec.rb'
111+
112+
Style/EmptyLambdaParameter:
113+
Enabled: true
114+
115+
Style/StabbyLambdaParentheses:
116+
Enabled: true
117+
EnforcedStyle: require_no_parentheses

core/argf/close_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
it "doesn't raise an IOError if called on a closed stream" do
2424
argf [@file1_name] do
25-
lambda { @argf.close }.should_not raise_error
26-
lambda { @argf.close }.should_not raise_error
25+
-> { @argf.close }.should_not raise_error
26+
-> { @argf.close }.should_not raise_error
2727
end
2828
end
2929
end

core/argf/read_nonblock_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
it 'raises IO::EAGAINWaitReadable when empty' do
6666
argf ['-'] do
67-
lambda {
67+
-> {
6868
@argf.read_nonblock(4)
6969
}.should raise_error(IO::EAGAINWaitReadable)
7070
end

core/argf/readchar_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
it "raises EOFError when end of stream reached" do
1515
argf [@file1, @file2] do
16-
lambda { while @argf.readchar; end }.should raise_error(EOFError)
16+
-> { while @argf.readchar; end }.should raise_error(EOFError)
1717
end
1818
end
1919
end

core/argf/readline_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
it "raises an EOFError when reaching end of files" do
1919
argf [@file1, @file2] do
20-
lambda { while @argf.readline; end }.should raise_error(EOFError)
20+
-> { while @argf.readline; end }.should raise_error(EOFError)
2121
end
2222
end
2323
end

core/argf/readpartial_spec.rb

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

1717
it "raises an ArgumentError if called without a maximum read length" do
1818
argf [@file1_name] do
19-
lambda { @argf.readpartial }.should raise_error(ArgumentError)
19+
-> { @argf.readpartial }.should raise_error(ArgumentError)
2020
end
2121
end
2222

@@ -59,8 +59,8 @@
5959
@argf.readpartial(@file1.size)
6060
@argf.readpartial(1)
6161
@argf.readpartial(@file2.size)
62-
lambda { @argf.readpartial(1) }.should raise_error(EOFError)
63-
lambda { @argf.readpartial(1) }.should raise_error(EOFError)
62+
-> { @argf.readpartial(1) }.should raise_error(EOFError)
63+
-> { @argf.readpartial(1) }.should raise_error(EOFError)
6464
end
6565
end
6666

core/argf/rewind_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
it "raises an ArgumentError when end of stream reached" do
3434
argf [@file1_name, @file2_name] do
3535
@argf.read
36-
lambda { @argf.rewind }.should raise_error(ArgumentError)
36+
-> { @argf.rewind }.should raise_error(ArgumentError)
3737
end
3838
end
3939
end

core/argf/seek_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
it "takes at least one argument (offset)" do
5959
argf [@file1_name] do
60-
lambda { @argf.seek }.should raise_error(ArgumentError)
60+
-> { @argf.seek }.should raise_error(ArgumentError)
6161
end
6262
end
6363
end

core/argf/shared/eof.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
it "raises IOError when called on a closed stream" do
1919
argf [@file1] do
2020
@argf.read
21-
lambda { @argf.send(@method) }.should raise_error(IOError)
21+
-> { @argf.send(@method) }.should raise_error(IOError)
2222
end
2323
end
2424
end

core/argf/shared/fileno.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
it "raises an ArgumentError when called on a closed stream" do
1919
argf [@file1] do
2020
@argf.read
21-
lambda { @argf.send(@method) }.should raise_error(ArgumentError)
21+
-> { @argf.send(@method) }.should raise_error(ArgumentError)
2222
end
2323
end
2424
end

0 commit comments

Comments
 (0)