-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enforce SyxtaxMapping::builtin()
to not have duplicate keys
#2643
Comments
I like the idea of adding a test for it, it would increase confidence during reviews without having to read through all the syntax mappings |
saw this while working on issue (sharkdp#2643)[sharkdp#2643]
Re: closing PR #2646 Is it cleaner if I pop out the commits and changes from this branch or is it fine if I open a new PR related to this issue? |
As |
Yep, that's probably what we want so more specific globs would take precedence over less specific ones.
No worries, everyone has to start somewhere and learn somehow 🙂 I'd be fine with a force push to the existing PR branch to drop commits, but GitHub might not let you reopen the PR in some cases doing this, so probably a new PR is less hassle for you in the long run |
Presently, SyntaxMapping is implemented as a Vec, but we could have duplicate keys. I can insert a pair that has the same Glob (and even the same string) into the
mapping
variable used bybuiltins()
.crate::get_syntax_mapping_to_paths
emits a hashmap, so I think that means we'll always get a syntax to map to if a key is duplicated to two differentMappingTarget
s but in principle it'll depend on when it was added to the HashMap so that theVec
s order matters.I don't see a need to change from
Vec
, but maybe testing that theVec
doesn't have matching globs in the first piece of the tuple would be good.However, the list of builtins isn't long to read, so maybe this isn't worthwhile, but it's also unsorted. If this is something useful, I can add that test.
The text was updated successfully, but these errors were encountered: