Skip to content

Commit 7733f5a

Browse files
committed
Simplify code for File.identical?
1 parent c873f2b commit 7733f5a

File tree

1 file changed

+2
-7
lines changed
  • src/main/ruby/truffleruby/core

1 file changed

+2
-7
lines changed

src/main/ruby/truffleruby/core/file.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -732,13 +732,8 @@ def self.identical?(orig, copy)
732732

733733
return false if Primitive.nil?(st_o) || Primitive.nil?(st_c)
734734

735-
return false unless st_o.dev == st_c.dev
736-
return false unless st_o.ino == st_c.ino
737-
return false unless st_o.ftype == st_c.ftype
738-
return false unless POSIX.access(orig, Constants::R_OK)
739-
return false unless POSIX.access(copy, Constants::R_OK)
740-
741-
true
735+
st_o.dev == st_c.dev and st_o.ino == st_c.ino and st_o.ftype == st_c.ftype and
736+
POSIX.access(orig, Constants::R_OK) && Primitive.as_boolean(POSIX.access(copy, Constants::R_OK))
742737
end
743738

744739
##

0 commit comments

Comments
 (0)