Bug 1765916 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

[`NS_SUCCEEDED` and `NS_FAILED` have `MOZ_LIKELY` and `MOZ_UNLIKELY`](https://searchfox.org/mozilla-central/rev/a019f4f233dc43af0ade38be0914010448c4ce03/xpcom/base/nsError.h#32-33). However, neither [`Result::isOk` nor `Result::isErr` does not have](https://searchfox.org/mozilla-central/rev/a019f4f233dc43af0ade38be0914010448c4ce03/mfbt/Result.h#521,524). This inconsistency causes mixed style code like:

```
Result<Foo, nsresult> result = Bar();
if (MOZ_UNLIKELY(result.isErr())) {
  return result.unwrapErr();
}
nsresult rv = Baz();
if (NS_FAILED(rv)) {
  return rv;
}
```
[`NS_SUCCEEDED` and `NS_FAILED` have `MOZ_LIKELY` and `MOZ_UNLIKELY`](https://searchfox.org/mozilla-central/rev/a019f4f233dc43af0ade38be0914010448c4ce03/xpcom/base/nsError.h#32-33). However, neither [`Result::isOk` nor `Result::isErr` does not have](https://searchfox.org/mozilla-central/rev/a019f4f233dc43af0ade38be0914010448c4ce03/mfbt/Result.h#521,524). This inconsistency causes mixed style code like:

```
Result<Foo, nsresult> result = Bar();
if (MOZ_UNLIKELY(result.isErr())) {
  return result.unwrapErr();
}
nsresult rv = Baz();
if (NS_FAILED(rv)) {
  return rv;
}
```

So they should have them.

Back to Bug 1765916 Comment 0