|
@@ -266,6 +266,7 @@ impl Url {
|
|
|
/// Methods of the `Url` struct assume a number of invariants.
|
|
/// Methods of the `Url` struct assume a number of invariants.
|
|
|
/// This checks each of these invariants and panic if one is not met.
|
|
/// This checks each of these invariants and panic if one is not met.
|
|
|
/// This is for testing rust-url itself.
|
|
/// This is for testing rust-url itself.
|
|
|
|
|
+ #[doc(hidden)]
|
|
|
pub fn assert_invariants(&self) {
|
|
pub fn assert_invariants(&self) {
|
|
|
macro_rules! assert {
|
|
macro_rules! assert {
|
|
|
($x: expr) => {
|
|
($x: expr) => {
|
|
@@ -848,7 +849,7 @@ impl Url {
|
|
|
let old_suffix_pos = if opt_new_port.is_some() { self.path_start } else { self.host_end };
|
|
let old_suffix_pos = if opt_new_port.is_some() { self.path_start } else { self.host_end };
|
|
|
let suffix = self.slice(old_suffix_pos..).to_owned();
|
|
let suffix = self.slice(old_suffix_pos..).to_owned();
|
|
|
self.serialization.truncate(self.host_start as usize);
|
|
self.serialization.truncate(self.host_start as usize);
|
|
|
- if !self.has_host() {
|
|
|
|
|
|
|
+ if !self.has_authority() {
|
|
|
debug_assert!(self.slice(self.scheme_end..self.host_start) == ":");
|
|
debug_assert!(self.slice(self.scheme_end..self.host_start) == ":");
|
|
|
debug_assert!(self.username_end == self.host_start);
|
|
debug_assert!(self.username_end == self.host_start);
|
|
|
self.serialization.push('/');
|
|
self.serialization.push('/');
|