fix(engine): replace str::replace with cow_replace in module loader#5141
Merged
jedel1043 merged 2 commits intoboa-dev:mainfrom Mar 18, 2026
Merged
fix(engine): replace str::replace with cow_replace in module loader#5141jedel1043 merged 2 commits intoboa-dev:mainfrom
jedel1043 merged 2 commits intoboa-dev:mainfrom
Conversation
jedel1043
reviewed
Mar 18, 2026
| // On Windows, also replace `/` with `\`. JavaScript imports use `/` as path separator. | ||
| #[cfg(target_family = "windows")] | ||
| let specifier = specifier.replace('/', "\\"); | ||
| let specifier = specifier.cow_replace('/', "\\").into_owned(); |
Member
There was a problem hiding this comment.
It would be better to use the trait directly instead of importing
cow_utils::CowUtils::cow_replace(specifier, '/', "\\")
Also, using cow_replace then into_owned immediately after is... an interesting decision, because it's basically nullifying the use of cow_replace.
Contributor
Author
There was a problem hiding this comment.
Thanks, resolved 👍
Test262 conformance changes
Tested main commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5141 +/- ##
===========================================
+ Coverage 47.24% 59.35% +12.11%
===========================================
Files 476 580 +104
Lines 46892 63181 +16289
===========================================
+ Hits 22154 37502 +15348
- Misses 24738 25679 +941 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 #5140
Replaces
str::replacewithcow_utils::CowUtils::cow_replacein the module loader to satisfyclippy::disallowed_methodsand avoid unnecessary allocation.Follows the pattern introduced in #4123.