The same code is being used in rhg files and rhg status and I expect it to
be used at more places in upcoming future. So let's have a utility function for
that.
rhg files still doesn't use this codepath but will start using in upcoming
patches.
| hg-reviewers | 
The same code is being used in rhg files and rhg status and I expect it to
be used at more places in upcoming future. So let's have a utility function for
that.
rhg files still doesn't use this codepath but will start using in upcoming
patches.
| No Linters Available | 
| No Unit Test Coverage | 
| rust/rhg/src/commands/status.rs | ||
|---|---|---|
| 293 | Since this now only used once it can be moved into the relativize_paths call without assigning to a variable. This gives "more local" information to type inference, so type annotations in the closure signature won’t be needed anymore.  | |
| rust/rhg/src/utils/path_utils.rs | ||
| 17 | In order not to force callers to allocate a Vec of of Cows just to call this, the parameter could be made a generic iterable of generic items: paths: impl IntoIterator<Item = impl AsRef<HgPath>> Then in the for loop below use file.as_ref() to go from the generic item type to &HgPath.  | |
| 18 | There is no need for dynamic dispatch here. Replacing &dyn Fn with impl Fn will let the compiler inline and optimize for each specific callback.  | |
| 21–23 | This is from code that I originally wrote, but even though in mercurial we talk about a repository’s "working directory", this code is slightly confusing because cwd also means "current working directory" but is not necessarily the same directory. Maybe rename working_directory to something like repo_root?  | |
Since this now only used once it can be moved into the relativize_paths call without assigning to a variable. This gives "more local" information to type inference, so type annotations in the closure signature won’t be needed anymore.