Skip to content

Commit 9458af2

Browse files
committed
Apply ReplaceWithPrimitiveObjectEqual to lib/truffle as well
1 parent 6097e17 commit 9458af2

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ TruffleRuby/ReplaceWithPrimitiveObjectClass:
416416
TruffleRuby/ReplaceWithPrimitiveObjectEqual:
417417
Enabled: true
418418
Include: # inspect *only* these files
419+
- lib/truffle/**/*.rb
419420
- src/main/ruby/**/*.rb
420421

421422
# Supports --auto-correct

lib/truffle/stringio.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,12 @@ def readlines(sep = $/, limit = Undefined, chomp: false)
494494
end
495495

496496
def reopen(string = nil, mode = Undefined)
497-
if string and not string.kind_of? String and mode.equal? Undefined
497+
if string and not string.kind_of? String and Primitive.equal?(mode, Undefined)
498498
stringio = Truffle::Type.coerce_to(string, StringIO, :to_strio)
499499

500500
initialize_copy stringio
501501
else
502-
mode = nil if mode.equal? Undefined
502+
mode = nil if Primitive.equal?(mode, Undefined)
503503
string = '' unless string
504504

505505
initialize string, mode

lib/truffle/truffle/cext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ def rb_class_new(superclass)
11861186

11871187
def rb_define_class_under(mod, name, superclass)
11881188
# nil is TypeError (checked below), false is ArgumentError
1189-
if false.equal?(superclass)
1189+
if Primitive.equal?(false, superclass)
11901190
raise ArgumentError, "no super class for `#{name}'"
11911191
end
11921192

lib/truffle/truffle/ffi_backend/struct.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def initialize(pointer = nil, *args)
6565
end
6666

6767
def initialize_copy(other)
68-
return self if equal?(other)
68+
return self if Primitive.equal?(self, other)
6969

7070
@layout = other.layout
7171

0 commit comments

Comments
 (0)