Skip to content
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

Unnecessary string allocation #104

Closed
SimonSapin opened this issue Apr 30, 2016 · 0 comments · Fixed by #105
Closed

Unnecessary string allocation #104

SimonSapin opened this issue Apr 30, 2016 · 0 comments · Fixed by #105

Comments

@SimonSapin
Copy link
Contributor

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);
     }
 }
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 a pull request may close this issue.

1 participant