From dc9112cf10e63b5272e9469d080d5d1ced30276e Mon Sep 17 00:00:00 2001 From: "S.H" Date: Sun, 3 Oct 2021 22:34:45 +0900 Subject: Using NIL_P macro instead of `== Qnil` --- struct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 5aa70edf24..6fc5bf1048 100644 --- a/struct.c +++ b/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)."); } -- cgit v1.2.1