Valentin Gosu 3 years ago
parent
commit
21f32d64b7
1 changed files with 10 additions and 4 deletions
  1. 10 4
      url/src/parser.rs

+ 10 - 4
url/src/parser.rs

@@ -178,8 +178,7 @@ pub fn default_port(scheme: &str) -> Option<u16> {
     }
 }
 
-#[derive(Clone)]
-#[derive(Debug)]
+#[derive(Clone, Debug)]
 pub struct Input<'i> {
     chars: str::Chars<'i>,
 }
@@ -1203,7 +1202,11 @@ impl<'a> Parser<'a> {
                     }
                     _ => {
                         self.check_url_code_point(c, &input);
-                        if scheme_type.is_file() && is_normalized_windows_drive_letter(&self.serialization[path_start+1..]) {
+                        if scheme_type.is_file()
+                            && is_normalized_windows_drive_letter(
+                                &self.serialization[path_start + 1..],
+                            )
+                        {
                             self.serialization.push('/');
                             segment_start += 1;
                         }
@@ -1254,7 +1257,10 @@ impl<'a> Parser<'a> {
                 }
                 _ => {
                     // If url’s scheme is "file", url’s path is empty, and buffer is a Windows drive letter, then
-                    if scheme_type.is_file() && segment_start == path_start + 1 && is_windows_drive_letter(segment_before_slash) {
+                    if scheme_type.is_file()
+                        && segment_start == path_start + 1
+                        && is_windows_drive_letter(segment_before_slash)
+                    {
                         // Replace the second code point in buffer with U+003A (:).
                         if let Some(c) = segment_before_slash.chars().next() {
                             self.serialization.truncate(segment_start);