Repository navigation
Conversation
|
How does one match a literal |
There was a problem hiding this comment.
Unless things have changed in the past 2 weeks, the iterator contract does not require that an iterator that returns None once continue to return None forever. In fact, the iterator contract specifies nothing at all about the behavior after None has been returned once.
There was a problem hiding this comment.
What you state appears to be true. Maybe the Iterator docs should be more explicit about this situation. I can rework the glob code to avoid the issue.
There was a problem hiding this comment.
@Dretch After discussion with @thestinger it sounds like he wants the iterator protocol to actually state that once None is returned, future calls to next() will continue to return None.
|
I'd love to see a public function equivalent to |
|
Also, your implementation of the glob is inefficient when it hits Instead, you can split your pattern on all instances of |
There was a problem hiding this comment.
It seems that pattern_matches lacks some considerations required by Patterns Used for Filename Expansion in SUSv4.
For example, foo/.bar shall not be matched by the pattern foo/*.
There was a problem hiding this comment.
Fair enough. Special behaviour for dot-files would at least be consistent with the python glob module.
|
@Dretch: If you can make a |
|
Note that @kballard there is also |
|
@omasanori There's also |
there was no way to match NOT ']'). Also do some refactoring to avoid relying on the vector iterator always returning None after returning None for the first time (as requested by @kballard).
|
@kballard I agree with you. ( |
method that acts something like the C fnmatch function (albeit without any options... yet).
and Pattern::matches, and provide a case_sensitive option that defaults to true.
to the FNM_PATHNAME flag in the libc fnmatch function
|
@Dretch Needs a rebase. |
|
Closing due to lack of activity. Please reopen if you have time to rebase it! |
|
I am still working on this (albeit slowly)! I have some more commits coming (including a rebase). I can't see any way to reopen this pull request - should I start a new one? |
This is #8201 with a bunch of amendments to address the comments (and re-based).
Change `unnecessary_to_owned` `into_iter` suggestions to `MaybeIncorrect` I am having a hard time finding a good solution for rust-lang#8148, so I am wondering if is enough to just change the suggestion's applicability to `MaybeIncorrect`? I apologize, as I realize this is a bit of a cop out. changelog: none
8201: Fix recursive macro statements expansion r=edwin0cheng a=edwin0cheng This PR attempts to properly handle macro statement expansion by implementing the following: 1. Merge macro expanded statements to parent scope statements. 2. Add a new hir `Expr::MacroStmts` for handle tail expression infer. PS : The scope of macro expanded statements are so strange that it took more time than I thought to understand and implement it :( Fixes rust-lang#8171 Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
... fixing issue #6100. This also addresses #6101.