Skip to content

feat!: explicitly require Cow for absolutize_with base parameter#37

Merged
hyf0 merged 2 commits intomainfrom
hyf_3248092384
Feb 24, 2026
Merged

feat!: explicitly require Cow for absolutize_with base parameter#37
hyf0 merged 2 commits intomainfrom
hyf_3248092384

Conversation

@hyf0
Copy link
Copy Markdown
Owner

@hyf0 hyf0 commented Feb 24, 2026

Closes #36

Copilot AI review requested due to automatic review settings February 24, 2026 06:03
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 24, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing hyf_3248092384 (f518f9f) with main (a172f38)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_with signature to fn absolutize_with<'a>(&self, base: Cow<'a, Path>) -> Cow<'_, Path>.
  • Remove IntoCowPath and its implementations from src/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>
@hyf0 hyf0 merged commit 5eec2b0 into main Feb 24, 2026
5 checks passed
@github-actions github-actions bot mentioned this pull request Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace IntoCowPath with direct Cow<'a, Path> in absolutize_with

2 participants