-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #14106 - Eh2406:build_feature_map, r=ehuss
Simplify checking feature syntax ### What does this PR try to resolve? Similar to #14089, in my PubGrub work I had to try to understand the `build_feature_map` code that determines if the name refers to a feature or an optional dependency. There were a couple of little things I wanted to clean up while I was staring at the code. Specifically: - there was a lot of vertical space taken up with arguments to `bail` that could be in line at the format string. - some match statements were used where a named helper method would be clearer. - `split_once` could replace a `find ... split_at` dance. - in `dep_map` we were constructing a full `Vec<Dependency>`, when we only cared about whether there was any dependency and whether any of the dependencies were optional. ### How should we test and review this PR? It's an internal re-factor, and the tests still pass. ### Additional information If you're having questions about this code while you're reviewing, this would be a perfect opportunity for better naming and comments. Please ask questions. `@epage:` After this PR I am likely to copy this code into my pubgrub tester. Are there other users who might be interested in looking at a cargo.toml or an index entry and determining what feature names are available and what dependencies they enable? If so maybe this function should be moved to one of the new stable-ish reusable libraries.
- Loading branch information
Showing
1 changed file
with
54 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters