-
Notifications
You must be signed in to change notification settings - Fork 4.9k
http_types: delete unused can_open_in_editor and URLPath::is_root/path_without_asset_prefix #31552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,37 +28,7 @@ | |
| _decoded_storage: Option<Box<[u8]>>, | ||
| } | ||
|
|
||
| impl URLPath { | ||
|
Check warning on line 31 in src/http_types/URLPath.rs
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 🟡 Same cascade pattern on the Extended reasoning...What this isNot a correctness bug — an incomplete sweep, the same one-hop-downstream cascade already addressed for Step-by-step proof that the struct field is now dead
What is not deadThe local Why nothing else flags thisThe field is ImpactNone on runtime behavior — purely about completing the cleanup. Leaving the field in place is harmless; a later sweep would catch it. Suggested fixEither:
|
||
| pub fn is_root(&self, asset_prefix: &[u8]) -> bool { | ||
| let without = self.path_without_asset_prefix(asset_prefix); | ||
| if without.len() == 1 && without[0] == b'.' { | ||
| return true; | ||
| } | ||
| without == b"index" | ||
| } | ||
|
|
||
| // TODO: use a real URL parser | ||
| // this treats a URL like /_next/ identically to / | ||
| pub fn path_without_asset_prefix(&self, asset_prefix: &[u8]) -> &[u8] { | ||
| if asset_prefix.is_empty() { | ||
| return self.path; | ||
| } | ||
| let leading_slash_offset: usize = if asset_prefix[0] == b'/' { 1 } else { 0 }; | ||
| let base = self.path; | ||
| let origin = &asset_prefix[leading_slash_offset..]; | ||
|
|
||
| let out = if base.len() >= origin.len() && &base[0..origin.len()] == origin { | ||
| &base[origin.len()..] | ||
| } else { | ||
| base | ||
| }; | ||
| if self.is_source_map && out.ends_with(b".map") { | ||
| return &out[0..out.len() - 4]; | ||
| } | ||
|
|
||
| out | ||
| } | ||
|
|
||
| /// Take ownership of the percent-decode buffer, if `parse()` had to | ||
| /// allocate one. The slice fields of `self` keep pointing into the | ||
| /// returned allocation — the caller must keep it alive for as long as any | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.