feat!: explicitly require Cow for absolutize_with base parameter#37
Merged
feat!: explicitly require Cow for absolutize_with base parameter#37
absolutize_with base parameter#37Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR implements a semver-breaking API change to make SugarPath::absolutize_with explicitly accept Cow<'a, Path> for its base parameter, removing the custom IntoCowPath trait and updating call sites accordingly (per issue #36).
Changes:
- Change
absolutize_withsignature tofn absolutize_with<'a>(&self, base: Cow<'a, Path>) -> Cow<'_, Path>. - Remove
IntoCowPathand its implementations fromsrc/utils.rs. - Update docs, tests, and benchmarks to pass
Cow::Borrowed(...)/Cow::Owned(...).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/sugar_path.rs |
Updates the public trait method signature and doc examples to use Cow<'a, Path>. |
src/impl_sugar_path.rs |
Updates implementations to accept Cow directly and removes into_cow_path() usage. |
src/utils.rs |
Deletes the IntoCowPath trait and keeps only get_current_dir(). |
src/lib.rs |
Updates crate-level rustdoc examples to the new Cow-based API. |
tests/absolutize_with.rs |
Updates test callsites to pass Cow (adds a helper macro for concision). |
tests/deep_paths.rs |
Updates deep-path tests to pass Cow::Borrowed bases. |
benches/absolutize.rs |
Updates benchmarks to pass Cow::Borrowed(cwd.as_path()). |
AGENTS.md |
Updates repository documentation to reflect removal of IntoCowPath. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Move `path::Path` import into unix-gated test to fix unused import warning on Windows (clippy -D warnings) - Fix comment: `base.normalize()` → `base.absolutize()` since normalize doesn't resolve relative bases against cwd Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #36