I also wrote the NT version although I didn't mean to at first, so I thought
I would keep it, so that any further effort to get the Rust code working on
Windows is a little easier.
Details
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
Event Timeline
rust/hg-core/src/utils/files.rs | ||
---|---|---|
109 | I think this can be simplified. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=78136ead96596afe6305e7542a881ca4. I had to use &[u8] to avoid having to copy all of the HgPath stuff into the playground, but the code should be easy to integrate. Notable changes:
| |
230 | We should add an example of a UNC and Drive path here to ensure that they don't get split. |
rust/hg-core/src/utils/files.rs | ||
---|---|---|
109 | Indeed, this is much better. While trying to adapt this code to fit with HgPath, I find myself needing to translate to and from bytes whenever indexing or when using split_at. Should we give a HgPath a split_at method or also all the Index<> ones? I remember that we decided against that earlier. | |
230 | Good idea |
rust/hg-core/src/utils/files.rs | ||
---|---|---|
109 | I would recommend just converting to bytes at the top of the function then converting the return value to a path at the exit. I feel when you are doing manipulation like this it makes the most sense to treat it as plain bytes within the function. Alternatively I wouldn't mind putting an index operator but have a slight preference for path.as_bytes()[n] to keep it explicit as most of the code shouldn't be reaching into paths. |
rust/hg-core/src/utils/files.rs | ||
---|---|---|
109 | I agree. I'll send a follow-up for all your remarks in an hour. |
I think this can be simplified. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=78136ead96596afe6305e7542a881ca4. I had to use &[u8] to avoid having to copy all of the HgPath stuff into the playground, but the code should be easy to integrate.
Notable changes: