logger: use safe navigation operator

Saves a few hundred bytes of bytecode in a frequently loaded module.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-01-18 00:52:01 +00:00
Родитель 900bf7682e
Коммит f729089f44
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -479,9 +479,7 @@ class Logger
# device exists, return +nil+.
#
def <<(msg)
unless @logdev.nil?
@logdev.write(msg)
end
@logdev&.write(msg)
end
#
@ -568,7 +566,7 @@ class Logger
# Close the logging device.
#
def close
@logdev.close if @logdev
@logdev&.close
end
private