mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Using NIL_P macro instead of == Qnil
This commit is contained in:
parent
fb03598666
commit
dc9112cf10
Notes:
git
2021-10-03 22:35:06 +09:00
Merged: https://github.com/ruby/ruby/pull/4925 Merged-By: nobu <nobu@ruby-lang.org>
18 changed files with 43 additions and 43 deletions
4
struct.c
4
struct.c
|
@ -712,7 +712,7 @@ struct_hash_set_i(VALUE key, VALUE val, VALUE arg)
|
|||
struct struct_hash_set_arg *args = (struct struct_hash_set_arg *)arg;
|
||||
int i = rb_struct_pos(args->self, &key);
|
||||
if (i < 0) {
|
||||
if (args->unknown_keywords == Qnil) {
|
||||
if (NIL_P(args->unknown_keywords)) {
|
||||
args->unknown_keywords = rb_ary_new();
|
||||
}
|
||||
rb_ary_push(args->unknown_keywords, key);
|
||||
|
@ -754,7 +754,7 @@ rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
|
|||
if (n < argc) {
|
||||
rb_raise(rb_eArgError, "struct size differs");
|
||||
}
|
||||
if (keyword_init == Qnil && argc == 1 && RB_TYPE_P(argv[0], T_HASH) && rb_keyword_given_p()) {
|
||||
if (NIL_P(keyword_init) && argc == 1 && RB_TYPE_P(argv[0], T_HASH) && rb_keyword_given_p()) {
|
||||
rb_warn("Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. "\
|
||||
"Please use a Hash literal like .new({k: v}) instead of .new(k: v).");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue