src: replace FromJust() with Check() when possible

FromJust() is often used not for its return value, but for its
side-effects. In these cases, Check() exists, and is more clear as to
the intent. From its comment:

  To be used, where the actual value of the Maybe is not needed, like
  Object::Set.

See: https://github.com/nodejs/node/pull/26929/files#r269256335

PR-URL: https://github.com/nodejs/node/pull/27162
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
Sam Roberts committed 2019-04-12 12:33:37 -07:00
1 parent 7b0d867389
commit 060d901f87
53 files changed
+339 -340

No files matched your search

+2 -2
View File
@@ -309,11 +309,11 @@ void InitializeStringDecoder(Local<Object> target,
target->Set(context,
FIXED_ONE_BYTE_STRING(isolate, "encodings"),
encodings).FromJust();
encodings).Check();
target->Set(context,
FIXED_ONE_BYTE_STRING(isolate, "kSize"),
Integer::New(isolate, sizeof(StringDecoder))).FromJust();
Integer::New(isolate, sizeof(StringDecoder))).Check();
env->SetMethod(target, "decode", DecodeData);
env->SetMethod(target, "flush", FlushData);