Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

refactor(rome_js_formatter): Remove Copy from JsFormatContext #2779

Merged
merged 2 commits into from
Jun 24, 2022

Conversation

MichaReiser
Copy link
Contributor

Summary

Remove the Copy from JsFormatContext to allow storing non-copyable data in the context. The idea is to store the extracted comments as an Rc<Comments> but this isn't possible today because Rc (nor Comments) implements Copy.

Test Plan

The rust compiler is so kind to point me towards all places where we now need to call clone (only in tests).

Remove the `Copy` from `JsFormatContext` to allow storing non-copyable data in the context. The idea is to store the extracted comments as an `Rc<Comments>` but this isn't possible today because `Rc` (nor `Comments`) implements `Copy`.
@MichaReiser MichaReiser temporarily deployed to aws June 24, 2022 14:38 Inactive

/// Options of current instance of the formatter
pub options: JsFormatOptions,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to inline this type as it only holds one field.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 24, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 106188d
Status: ✅  Deploy successful!
Preview URL: https://ba0bdee5.tools-8rn.pages.dev
Branch Preview URL: https://refactor-js-context-remove-c.tools-8rn.pages.dev

View logs

@MichaReiser MichaReiser temporarily deployed to aws June 24, 2022 14:49 Inactive
@github-actions
Copy link

@MichaReiser MichaReiser merged commit d5b4379 into main Jun 24, 2022
@MichaReiser MichaReiser deleted the refactor/js-context-remove-copy branch June 24, 2022 15:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants