Within the next few patches we will be using this new API.
Details
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
Event Timeline
rust/hg-core/src/filepatterns.rs | ||
---|---|---|
217 | Indeed. Also added a comment to explain the reasoning. | |
234 | I'm not sure I agree. On the basis that "Rust might optimize iterators better than for loops" I vote to keep it that way. | |
247 | For now this is pretty specific, but it might need to be moved later when more code paths use it. |
rust/hg-core/src/filepatterns.rs | ||
---|---|---|
224 | Can you move this condition into a .filter()? | |
234 | If you think it' is clearer that's fine. But I'm curious where "Rust might optimize iterators better than for loops" comes from. I did a quick test and it looks like the for loop actually generates slightly better code https://rust.godbolt.org/z/vFAWyZ |
rust/hg-core/src/filepatterns.rs | ||
---|---|---|
234 | I might be using godbolt wrong but it looks like you are using different versions of rustc. When using 1.40 for both sides, I don't see any clear win on either side... but I'm not fluent in assembly either. As I'm sure you'll agree, this function is unlikely to show up in future profiles anyway. |
rust/hg-core/src/filepatterns.rs | ||
---|---|---|
234 | Oops. My mistake. But I think we agree that readability is the top priority (until profiles say otherwise) |
It might be clearer to do bytes.iter().take_while(|b| b == sep).count()