Skip to content

Unnecessary string allocation #104

Closed
@SimonSapin

Description

@SimonSapin

This diff can be applied if the dependency requirement for rust-url is tightened to 1.0+. See #103.

diff --git a/src/http/handle.rs b/src/http/handle.rs
index ac3b8b0..5d1e2d4 100644
--- a/src/http/handle.rs
+++ b/src/http/handle.rs
@@ -426,7 +426,7 @@ impl<'a> ToUrl for &'a str {
 impl<'a> ToUrl for &'a Url {
     fn with_url_str<F>(self, f: F) where F: FnOnce(&str) {
-        self.to_string().with_url_str(f);
+        self.as_str().with_url_str(f);
     }
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions