This will be used in the next patch in this series.
Details
- Reviewers
kevincox pulkit - Group Reviewers
hg-reviewers - Commits
- rHG4f1543a2f5c3: rust-hg-path: add method to get part of a path relative to a prefix
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
Event Timeline
rust/hg-core/src/utils/hg_path.rs | ||
---|---|---|
131 | base.is_empty()? If we don't have that helper we should probably add it. | |
131 | The comment says that base must end with a / however you appear to handle cases where it doesn't Can you either update the documentation or the code? | |
134 | Instead of using .last() can we add and use base.ends_with(b'/')? | |
134 | base.len() > 0 is redundant both with the early return above and because last() will return None if base is empty. | |
215 | I would do self.as_bytes() for consistency. Or even better I believe you can #[derive(Eq,PartialEq)]. |
rust/hg-core/src/utils/hg_path.rs | ||
---|---|---|
131 | I've clarified the documentation. |
rust/hg-core/src/utils/hg_path.rs | ||
---|---|---|
448 | The argument order here feels backwards. I know some frameworks (like Java's JUnit) put the expected value first, but the definition of assert_eq! doesn't seem to have any opinion and https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html puts the actual value first. What do you think about changing the order? That would make it more readable to me. |
rust/hg-core/src/utils/hg_path.rs | ||
---|---|---|
448 | It looks that I took the habit because the test runner in PyCharm that I used when starting with Rust prints expected and actual in that order. I can reverse it if you really think it's more readable this way. |
base.is_empty()? If we don't have that helper we should probably add it.