Repository navigation
Conversation
GlobSet previously derived Debug, which printed the internal
GlobSetMatchStrategy representation instead of anything resembling
the original glob patterns. GlobSetBuilder's derived Debug is already
readable because it just stores the Vec<Glob> it was given.
Give GlobSet a custom Debug that mirrors this: retain the Vec<Glob>
used to build the set and print only that, e.g.
GlobSet([Glob("src/**/*.rs"), Glob("*.c")]).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3274.
GlobSetcurrently derivesDebug, which prints its internalVec<GlobSetMatchStrategy>representation. That's not very useful:the match-strategy types are compiled matching structures (literal
tables, regex sets, etc.), not anything resembling the original glob
patterns, so
{:?}on aGlobSetis noisy and uninformative.GlobSetBuilder, by contrast, already has a readableDebugoutput,simply because it derives
Debugover its ownVec<Glob>, andGlobhas a concise custom
Debug(Glob("pattern")).This PR keeps the glob patterns around on
GlobSetitself (aVec<Glob>, populated inGlobSet::new) purely for this purpose, andgives
GlobSeta customDebugimpl that prints just that list, e.g.:matching the style the issue asked for from
GlobSetBuilder.Added a test (
debug_impl_is_concise) asserting the exact output fora small set and for
GlobSet::empty().Note on verification
I was able to verify this compiles cleanly with
cargo check -p globset(and
cargo check -p globset --testsup to the point of lib-cratetype-checking). However,
cargo testin my local environment failsto link unrelated dev-dependencies (
serde_json,zmij,serde_corebuild scripts) due to a broken MSVC linker invocationunrelated to this change, so I could not run the new test to
completion locally. The change itself is small and mechanical (adding
a field, populating it, and writing a
Debugimpl mirroring theexisting
Glob/GlobSetBuilderpattern), and I'm confident in it,but flagging this limitation for the reviewer.