Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookie-store: Simplify usage of promise_rejects_js() #25508

Conversation

rakuco
Copy link
Member

@rakuco rakuco commented Sep 13, 2020

There is no need to await on promise_rejects_js() when it is the last
call in a test: just returning it achieves the same result and looks more
idiomatic. Subsequently drop async from functions that no longer use
await.

There is no need to `await` on `promise_rejects_js()` when it is the last
call in a test: just returning it achieves the same result and looks more
idiomatic. Subsequently drop `async` from functions that no longer use
`await`.
@rakuco
Copy link
Member Author

rakuco commented Sep 13, 2020

cc @ayuishii

Copy link
Contributor

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. I'll point out that while each test may be more idiomatic it means multiple tests within a file are potentially less consistent. So I'm neutral to slightly negative on this change, but since you feel it's an important improvement, LGTM.

@pwnall
Copy link
Contributor

pwnall commented Sep 14, 2020

I'm really sorry, I'm coming off as extremely negative here. I don't like this change, and I don't have any constructive feedback... the way to make it better is to leave the code as-is.

I find tests harder to read after this PR. The mental model has an extra rule, so it's more complicated, and I don't see any benefits that justify the complexity. From a different angle, this feels like a manually-applied tail-call optimization, but for promises.

@rakuco
Copy link
Member Author

rakuco commented Sep 15, 2020

Let's just drop this one then.

@rakuco rakuco closed this Sep 15, 2020
@rakuco rakuco deleted the cookie-store-promise_rejects-usage branch September 15, 2020 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants