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

refactor(toml): extract dependency-to-source-id to function #13802

Merged
merged 6 commits into from
Apr 25, 2024

Conversation

weihanglo
Copy link
Member

@weihanglo weihanglo commented Apr 25, 2024

What does this PR try to resolve?

Miscellaneous refactors around extracting dependency-to-source-id to a function.

This is a side effect when trying to rebase #13779.

How should we test and review this PR?

Should be more readable IMO?

Additional information

@rustbot
Copy link
Collaborator

rustbot commented Apr 25, 2024

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-manifest Area: Cargo.toml issues S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2024
Ok(dep)
}

fn resolve_source_id_from_dependency<P: ResolveToPath + Clone>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming wise, resolve is generally being used in this file to "resolve" the original toml to a resolved toml.

For taking toml content and generating a cargo-native type, the to_ naming scheme is used. So this could be to_source_id or to_dependency_source_id.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thanks for the suggestion!

@@ -1901,20 +1901,17 @@ fn resolve_source_id_from_dependency<P: ResolveToPath + Clone>(
orig.registry_index.as_ref(),
) {
(Some(_git), _, Some(_registry), _) | (Some(_git), _, _, Some(_registry)) => bail!(
"dependency ({}) specification is ambiguous. \
"dependency ({name_in_toml}) specification is ambiguous. \
Copy link
Contributor

Choose a reason for hiding this comment

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

aside: isn't there a clippy lint we could turn on for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but not sure if we want to turn it on for every place. For here it seems fine.

@weihanglo weihanglo changed the title refactor: extract resolving dependency source id to a function refactor: extract logic for dependency to source id Apr 25, 2024
@weihanglo weihanglo changed the title refactor: extract logic for dependency to source id refactor(toml): extract dependency-to-source-id to function Apr 25, 2024
@epage
Copy link
Contributor

epage commented Apr 25, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Apr 25, 2024

📌 Commit d855cd6 has been approved by epage

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 Apr 25, 2024
@bors
Copy link
Contributor

bors commented Apr 25, 2024

⌛ Testing commit d855cd6 with merge cb1123f...

@bors
Copy link
Contributor

bors commented Apr 25, 2024

☀️ Test successful - checks-actions
Approved by: epage
Pushing cb1123f to master...

@bors bors merged commit cb1123f into rust-lang:master Apr 25, 2024
21 checks passed
@weihanglo weihanglo deleted the refactor branch April 25, 2024 18:35
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2024
Update cargo

9 commits in c9392675917adc2edab269eea27c222b5359c637..b60a1555155111e962018007a6d0ef85207db463
2024-04-23 19:35:19 +0000 to 2024-04-26 16:37:29 +0000
- fix(toml): Remove underscore field support in 2024 (rust-lang/cargo#13804)
- fix: emit 1.77 syntax error only when msrv is incompatible (rust-lang/cargo#13808)
- docs(ref): Index differences between virtual / real manifests (rust-lang/cargo#13794)
- refactor(toml): extract dependency-to-source-id to function (rust-lang/cargo#13802)
- Add where lint was set (rust-lang/cargo#13801)
- fix(toml): Don't double-warn when underscore is used in workspace dep (rust-lang/cargo#13800)
- fix(toml): Be more forceful with underscore/dash redundancy (rust-lang/cargo#13798)
- Fix warning suppression for config.toml vs config compat symlinks (rust-lang/cargo#13793)
- Cleanup linting system (rust-lang/cargo#13797)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2024
Update cargo

9 commits in c9392675917adc2edab269eea27c222b5359c637..b60a1555155111e962018007a6d0ef85207db463
2024-04-23 19:35:19 +0000 to 2024-04-26 16:37:29 +0000
- fix(toml): Remove underscore field support in 2024 (rust-lang/cargo#13804)
- fix: emit 1.77 syntax error only when msrv is incompatible (rust-lang/cargo#13808)
- docs(ref): Index differences between virtual / real manifests (rust-lang/cargo#13794)
- refactor(toml): extract dependency-to-source-id to function (rust-lang/cargo#13802)
- Add where lint was set (rust-lang/cargo#13801)
- fix(toml): Don't double-warn when underscore is used in workspace dep (rust-lang/cargo#13800)
- fix(toml): Be more forceful with underscore/dash redundancy (rust-lang/cargo#13798)
- Fix warning suppression for config.toml vs config compat symlinks (rust-lang/cargo#13793)
- Cleanup linting system (rust-lang/cargo#13797)

r? ghost
@rustbot rustbot added this to the 1.79.0 milestone Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-manifest Area: Cargo.toml issues 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