[前][次][番号順一覧][スレッド一覧]

ruby-changes:60318

From: Nobuyoshi <ko1@a...>
Date: Sat, 7 Mar 2020 17:05:04 +0900 (JST)
Subject: [ruby-changes:60318] 108f7536b3 (master): Removed unnecessary `chomp`

https://git.ruby-lang.org/ruby.git/commit/?id=108f7536b3

From 108f7536b3fe9a05343a6c36541c5d96153c7f1d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 7 Mar 2020 16:41:19 +0900
Subject: Removed unnecessary `chomp`

As `String#split` with the default argument drops trailing newline
as a separator, preceding `String#chomp` is futile.

diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb
index 460ad08..da8c3f2 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -1042,7 +1042,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/smtp.rb#L1042
         return {} unless @string[3, 1] == '-'
         h = {}
         @string.lines.drop(1).each do |line|
-          k, *v = line[4..-1].chomp.split
+          k, *v = line[4..-1].split
           h[k] = v
         end
         h
diff --git a/spec/mspec/tool/sync/sync-rubyspec.rb b/spec/mspec/tool/sync/sync-rubyspec.rb
index 72572e2..c1218bb 100644
--- a/spec/mspec/tool/sync/sync-rubyspec.rb
+++ b/spec/mspec/tool/sync/sync-rubyspec.rb
@@ -135,7 +135,7 @@ def rebase_commits(impl) https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/sync/sync-rubyspec.rb#L135
       else
         last_merge = `git log --grep='^#{impl.last_merge_message}' -n 1 --format='%H %ct'`
       end
-      last_merge, commit_timestamp = last_merge.chomp.split(' ')
+      last_merge, commit_timestamp = last_merge.split(' ')
 
       raise "Could not find last merge" unless last_merge
       puts "Last merge is #{last_merge}"
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 53599a6..a5eb0a5 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -2381,7 +2381,7 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L2381
       end
       w.close
       assert_equal "exec failed\n", r.gets
-      vals = r.gets.chomp.split.map!(&:to_i)
+      vals = r.gets.split.map!(&:to_i)
       assert_operator vals[0], :>, vals[1], vals.inspect
       _, status = Process.waitpid2(pid)
     end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]