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

chore: cleanup clones for upgrade/import/export file for v1.7 #1901

Merged
merged 4 commits into from
Sep 24, 2024

Conversation

AyushAgrawal-A2
Copy link
Collaborator

No description provided.

Copy link

qa-wolf bot commented Sep 21, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@cla-bot cla-bot bot added the cla-signed label Sep 21, 2024
Copy link

vercel bot commented Sep 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quadratic ✅ Ready (Inspect) Visit Preview Sep 24, 2024 0:36am

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1901 September 21, 2024 14:36 Inactive
Copy link

codecov bot commented Sep 21, 2024

Codecov Report

Attention: Patch coverage is 87.14597% with 59 lines in your changes missing coverage. Please review.

Project coverage is 90.98%. Comparing base (eb7f878) to head (f8967d7).
Report is 5 commits behind head on borders-rework.

Files with missing lines Patch % Lines
quadratic-core/src/grid/file/serialize/format.rs 27.02% 27 Missing ⚠️
...dratic-core/src/grid/file/serialize/validations.rs 80.26% 15 Missing ⚠️
quadratic-core/src/grid/file/v1_5/file.rs 89.02% 9 Missing ⚠️
...adratic-core/src/grid/file/serialize/cell_value.rs 75.00% 7 Missing ⚠️
quadratic-core/src/grid/file/sheet_schema.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           borders-rework    #1901      +/-   ##
==================================================
+ Coverage           90.94%   90.98%   +0.03%     
==================================================
  Files                 236      236              
  Lines               48371    48328      -43     
==================================================
- Hits                43991    43970      -21     
+ Misses               4380     4358      -22     
Flag Coverage Δ
90.98% <87.14%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AyushAgrawal-A2 AyushAgrawal-A2 changed the title chore: remove clones for upgrade/import/export file for v1.7 chore: cleanup clones for upgrade/import/export file for v1.7 Sep 21, 2024
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1901 September 21, 2024 16:36 Inactive
Comment on lines 33 to 40
Value::Array(crate::Array::from(
values
.chunks(size.w as usize)
.map(|row| row.iter().map(import_cell_value).collect::<Vec<_>>())
.map(|row| {
row.iter()
.map(|value| import_cell_value(value.to_owned()))
.collect::<Vec<_>>()
})
Copy link
Collaborator Author

@AyushAgrawal-A2 AyushAgrawal-A2 Sep 21, 2024

Choose a reason for hiding this comment

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

not able to figure out how to get owned value here, row chunk is a slice
value.to_owned() can be avoided if we can directly use owned value

Copy link
Collaborator

Choose a reason for hiding this comment

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

I pushed this one

@@ -79,7 +82,9 @@ pub(crate) fn export_rows_code_runs(
},
values: array
.rows()
.flat_map(|row| row.iter().map(export_cell_value))
.flat_map(|row| {
row.iter().map(|value| export_cell_value(value.to_owned()))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think there's an easy way to avoid this one. It's possible by collecting each row into a Vec<()> before transforming it, or by just manually building up a Vec<Vec<()>> element-by-element in this function. The latter is the most clone-free way but it's not pretty.

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1901 September 24, 2024 00:20 Inactive
@AyushAgrawal-A2 AyushAgrawal-A2 merged commit 30ab6bf into borders-rework Sep 24, 2024
15 of 16 checks passed
@AyushAgrawal-A2 AyushAgrawal-A2 deleted the ayush/remove_clones branch September 24, 2024 10:45
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.

5 participants