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

ruby-changes:68229

From: J=C3=B6rg <ko1@a...>
Date: Sun, 3 Oct 2021 22:16:19 +0900 (JST)
Subject: [ruby-changes:68229] fb03598666 (master): Remove unnecessary checks in `Range#each` [Bug #18237]

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

From fb03598666ddbb9f8b35eb4f599e75654ca7ca06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20W=20Mittag?= <github@j...>
Date: Sun, 3 Oct 2021 15:16:08 +0200
Subject: Remove unnecessary checks in `Range#each` [Bug #18237]

In commit:7817a438eb1803e7b3358f43bd1f38479badfbdc, the implementation
of `Time#succ`, which had been deprecated for 10 years, was finally
removed.

During that time, there was an explicit `instance_of?` check in
source:range.c#L350 with a comment that the check should be removed
once `Time#succ` is removed.

Since `Time#succ` is now gone, this check should be removed.

Note: this should be coordinated with adding a version guard to the
corresponding check in ruby/spec as well.
---
 range.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/range.c b/range.c
index c0b855002b..6f44e82600 100644
--- a/range.c
+++ b/range.c
@@ -347,7 +347,6 @@ step_i(VALUE i, VALUE arg) https://github.com/ruby/ruby/blob/trunk/range.c#L347
 static int
 discrete_object_p(VALUE obj)
 {
-    if (rb_obj_is_kind_of(obj, rb_cTime)) return FALSE; /* until Time#succ removed */
     return rb_respond_to(obj, id_succ);
 }
 
-- 
cgit v1.2.1


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

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