Jelajahi Sumber

Switch double-quotes to single-quotes

Daniel Lockyer 9 tahun lalu
induk
melakukan
844e2d5cf8
2 mengubah file dengan 6 tambahan dan 6 penghapusan
  1. 4 4
      src/host.rs
  2. 2 2
      src/parser.rs

+ 4 - 4
src/host.rs

@@ -139,8 +139,8 @@ impl Host<String> {
     ///
     /// https://url.spec.whatwg.org/#host-parsing
     pub fn parse(input: &str) -> Result<Self, ParseError> {
-        if input.starts_with("[") {
-            if !input.ends_with("]") {
+        if input.starts_with('[') {
+            if !input.ends_with(']') {
                 return Err(ParseError::InvalidIpv6Address)
             }
             return parse_ipv6addr(&input[1..input.len() - 1]).map(Host::Ipv6)
@@ -304,14 +304,14 @@ fn parse_ipv4number(mut input: &str) -> Result<u32, ()> {
     if input.starts_with("0x") || input.starts_with("0X") {
         input = &input[2..];
         r = 16;
-    } else if input.len() >= 2 && input.starts_with("0") {
+    } else if input.len() >= 2 && input.starts_with('0') {
         input = &input[1..];
         r = 8;
     }
     if input.is_empty() {
         return Ok(0);
     }
-    if input.starts_with("+") {
+    if input.starts_with('+') {
         return Err(())
     }
     match u32::from_str_radix(&input, r) {

+ 2 - 2
src/parser.rs

@@ -878,7 +878,7 @@ impl<'a> Parser<'a> {
                           path_start: usize, mut input: Input<'i>)
                           -> Input<'i> {
         // Relative path state
-        debug_assert!(self.serialization.ends_with("/"));
+        debug_assert!(self.serialization.ends_with('/'));
         loop {
             let segment_start = self.serialization.len();
             let mut ends_with_slash = false;
@@ -926,7 +926,7 @@ impl<'a> Parser<'a> {
                     debug_assert!(self.serialization.as_bytes()[segment_start - 1] == b'/');
                     self.serialization.truncate(segment_start - 1);  // Truncate "/.."
                     self.pop_path(scheme_type, path_start);
-                    if !self.serialization[path_start..].ends_with("/") {
+                    if !self.serialization[path_start..].ends_with('/') {
                         self.serialization.push('/')
                     }
                 },