Skip to content

Conversation

epage
Copy link
Contributor

@epage epage commented Jul 20, 2022

What does this PR try to resolve?

This refactors the Source/Registry traits from accepting a fuzzy: bool to accepting an enum so we can add alternative query styles in the future, as discussed in the Cargo team meeting for fixing #10729

The expected fix for cargo add at this point would be

  • Add QueryKind::Normalized
    • Initially, we can make it like Exact for path sources and like Fuzzy for registry sources
  • Switch cargo-add to using that kind everywhere (both where Exact and Fuzzy are used)
  • A test to ensure this fixed it
  • Rename Fuzzy to Alternatives or something to clarify its actual intent

How should we test and review this PR?

The refactor is broken down into multiple commits, so ideally review a commit at a time to more easily see how it evolved.

Additional information

Future possibilities

  • Supporting normalized search on all sources
  • Doing version / source matching for normalized results (probably not needed for cargo-add but will make the API less surprising for future users)

@epage epage requested a review from Eh2406 July 20, 2022 16:36
@rust-highfive
Copy link

r? @ehuss

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 20, 2022
@epage
Copy link
Contributor Author

epage commented Jul 20, 2022

r? @Eh2406

@rust-highfive rust-highfive assigned Eh2406 and unassigned ehuss Jul 20, 2022
@Eh2406
Copy link
Contributor

Eh2406 commented Jul 21, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jul 21, 2022

📌 Commit a645c4f has been approved by Eh2406

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 21, 2022
@bors
Copy link
Contributor

bors commented Jul 21, 2022

⌛ Testing commit a645c4f with merge caf3c37...

@bors
Copy link
Contributor

bors commented Jul 21, 2022

☀️ Test successful - checks-actions
Approved by: Eh2406
Pushing caf3c37 to master...

@bors bors merged commit caf3c37 into rust-lang:master Jul 21, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 27, 2022
Update cargo

5 commits in d8d30a75376f78bb0fabe3d28ee9d87aa8035309..85b500ccad8cd0b63995fd94a03ddd4b83f7905b
2022-07-19 13:59:17 +0000 to 2022-07-24 21:10:46 +0000
- Make the empty rustc-wrapper test more explicit. (rust-lang/cargo#10899)
- expand RUSTC_WRAPPER docs (rust-lang/cargo#10896)
- Stabilize Workspace Inheritance (rust-lang/cargo#10859)
- Fix typo in unstable docs: s/PROGJCT/PROJECT/ (rust-lang/cargo#10890)
- refactor(source): Open query API for adding more types of queries (rust-lang/cargo#10883)
@ehuss ehuss added this to the 1.64.0 milestone Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants