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

Convert seek to named fields #8260

Merged
merged 7 commits into from
Mar 7, 2024
Merged

Conversation

eth3lbert
Copy link
Contributor

@eth3lbert eth3lbert commented Mar 6, 2024

As mention in commits #8244 (comment) and #8037 (comment).

This PR is best reviewed commit-by-commit.

@eth3lbert eth3lbert force-pushed the field-struct-seek branch from 0433043 to 9f57dd4 Compare March 6, 2024 21:06
Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.78%. Comparing base (74892ed) to head (03eb6fd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8260      +/-   ##
==========================================
+ Coverage   87.75%   87.78%   +0.03%     
==========================================
  Files         273      273              
  Lines       27372    27460      +88     
==========================================
+ Hits        24019    24107      +88     
  Misses       3353     3353              

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

@eth3lbert eth3lbert force-pushed the field-struct-seek branch from e65ebc9 to 636002e Compare March 6, 2024 21:43
@eth3lbert eth3lbert force-pushed the field-struct-seek branch from 636002e to 526e785 Compare March 6, 2024 21:45
@eth3lbert eth3lbert marked this pull request as ready for review March 6, 2024 21:53
@eth3lbert eth3lbert requested review from Turbo87 and LawnGnome March 6, 2024 21:54
Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

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

I'm definitely not smart enough to review the new implementation of the seek macro, but it seems to work just fine, and I definitely prefer the new code that uses it.

👍 from me as long as we get the formatting fixed up in the actual uses of seek!. Nice job!

Comment on lines 613 to 615
Id{id: i32}
New{#[serde(with="ts_microseconds")] dt: chrono::NaiveDateTime, id: i32}
RecentDownloads{ downloads: Option<i64>, id: i32 }
Copy link
Contributor

Choose a reason for hiding this comment

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

This could use some manual formatting, since rustfmt obviously isn't getting in here.

Copy link
Member

Choose a reason for hiding this comment

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

I've managed to figure out how to rustfmt can be used for this:

  1. we need to have valid Rust code inside the macro invocation, but the implementation was missing trailing commas for the enum variants
  2. it needs to be invoked as seek!(...); instead of seek! { ... } and apparently that enables rustfmt to format the invocation content (see https://users.rust-lang.org/t/rustfmt-skips-macro-arguments/74807/4)

I've added two commits to the PR for the above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your help. I appreciate it.

Comment on lines +578 to +589
let (
Crate {
id,
updated_at,
created_at,
..
},
exact_match,
downloads,
recent_downloads,
rank,
) = *record;
Copy link
Contributor

Choose a reason for hiding this comment

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

Some day I hope to be brave enough to write a let destructure like this. 😆

@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Mar 7, 2024
@Turbo87 Turbo87 force-pushed the field-struct-seek branch from 4dbde8c to 03eb6fd Compare March 7, 2024 09:45
@Turbo87 Turbo87 merged commit 0ab8b84 into rust-lang:main Mar 7, 2024
8 checks passed
@eth3lbert eth3lbert deleted the field-struct-seek branch March 7, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants