|
|
@@ -1343,7 +1343,7 @@ impl Url {
|
|
|
self.serialization.push('?');
|
|
|
}
|
|
|
|
|
|
- let query = UrlQuery { url: self, fragment: fragment };
|
|
|
+ let query = UrlQuery { url: Some(self), fragment: fragment };
|
|
|
form_urlencoded::Serializer::for_suffix(query, query_start + "?".len())
|
|
|
}
|
|
|
|
|
|
@@ -2423,13 +2423,15 @@ fn io_error<T>(reason: &str) -> io::Result<T> {
|
|
|
/// Implementation detail of `Url::query_pairs_mut`. Typically not used directly.
|
|
|
#[derive(Debug)]
|
|
|
pub struct UrlQuery<'a> {
|
|
|
- url: &'a mut Url,
|
|
|
+ url: Option<&'a mut Url>,
|
|
|
fragment: Option<String>,
|
|
|
}
|
|
|
|
|
|
impl<'a> Drop for UrlQuery<'a> {
|
|
|
fn drop(&mut self) {
|
|
|
- self.url.restore_already_parsed_fragment(self.fragment.take())
|
|
|
+ if let Some(url) = self.url.take() {
|
|
|
+ url.restore_already_parsed_fragment(self.fragment.take())
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|