Răsfoiți Sursa

Remove support for the heapsize crate

Simon Sapin 7 ani în urmă
părinte
comite
394e63a751
5 a modificat fișierele cu 0 adăugiri și 52 ștergeri
  1. 0 2
      Cargo.toml
  2. 0 15
      src/host.rs
  3. 0 12
      src/lib.rs
  4. 0 17
      src/origin.rs
  5. 0 6
      src/parser.rs

+ 0 - 2
Cargo.toml

@@ -38,11 +38,9 @@ bencher = "0.1"
 
 [features]
 query_encoding = ["encoding"]
-heap_size = ["heapsize"]
 
 [dependencies]
 encoding = {version = "0.2", optional = true}
-heapsize = {version = ">=0.4.1, <0.5", optional = true}
 idna = { version = "0.1.0", path = "./idna" }
 matches = "0.1"
 percent-encoding = { version = "1.0.0", path = "./percent_encoding" }

+ 0 - 15
src/host.rs

@@ -6,8 +6,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[cfg(feature = "heapsize")]
-use heapsize::HeapSizeOf;
 use idna;
 use parser::{ParseError, ParseResult};
 use percent_encoding::{percent_decode, utf8_percent_encode, SIMPLE_ENCODE_SET};
@@ -25,9 +23,6 @@ pub enum HostInternal {
     Ipv6(Ipv6Addr),
 }
 
-#[cfg(feature = "heapsize")]
-known_heap_size!(0, HostInternal);
-
 #[cfg(feature = "serde")]
 impl ::serde::Serialize for HostInternal {
     fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
@@ -130,16 +125,6 @@ impl<'de, S: ::serde::Deserialize<'de>> ::serde::Deserialize<'de> for Host<S> {
     }
 }
 
-#[cfg(feature = "heapsize")]
-impl<S: HeapSizeOf> HeapSizeOf for Host<S> {
-    fn heap_size_of_children(&self) -> usize {
-        match *self {
-            Host::Domain(ref s) => s.heap_size_of_children(),
-            _ => 0,
-        }
-    }
-}
-
 impl<'a> Host<&'a str> {
     /// Return a copy of `self` that owns an allocated `String` but does not borrow an `&Url`.
     pub fn to_owned(&self) -> Host<String> {

+ 0 - 12
src/lib.rs

@@ -111,17 +111,12 @@ assert_eq!(css_url.as_str(), "http://servo.github.io/rust-url/main.css");
 extern crate matches;
 #[cfg(feature = "serde")]
 extern crate serde;
-#[cfg(feature = "heapsize")]
-#[macro_use]
-extern crate heapsize;
 
 pub extern crate idna;
 #[macro_use]
 pub extern crate percent_encoding;
 
 use encoding::EncodingOverride;
-#[cfg(feature = "heapsize")]
-use heapsize::HeapSizeOf;
 use host::HostInternal;
 use parser::{to_u32, Context, Parser, SchemeType};
 use percent_encoding::{
@@ -184,13 +179,6 @@ pub struct Url {
     fragment_start: Option<u32>, // Before '#', unlike Position::FragmentStart
 }
 
-#[cfg(feature = "heapsize")]
-impl HeapSizeOf for Url {
-    fn heap_size_of_children(&self) -> usize {
-        self.serialization.heap_size_of_children()
-    }
-}
-
 /// Full configuration for the URL parser.
 #[derive(Copy, Clone)]
 pub struct ParseOptions<'a> {

+ 0 - 17
src/origin.rs

@@ -6,8 +6,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#[cfg(feature = "heapsize")]
-use heapsize::HeapSizeOf;
 use host::Host;
 use idna::domain_to_unicode;
 use parser::default_port;
@@ -61,18 +59,6 @@ pub enum Origin {
     Tuple(String, Host<String>, u16),
 }
 
-#[cfg(feature = "heapsize")]
-impl HeapSizeOf for Origin {
-    fn heap_size_of_children(&self) -> usize {
-        match *self {
-            Origin::Tuple(ref scheme, ref host, _) => {
-                scheme.heap_size_of_children() + host.heap_size_of_children()
-            }
-            _ => 0,
-        }
-    }
-}
-
 impl Origin {
     /// Creates a new opaque origin that is only equal to itself.
     pub fn new_opaque() -> Origin {
@@ -125,6 +111,3 @@ impl Origin {
 /// Opaque identifier for URLs that have file or other schemes
 #[derive(Eq, PartialEq, Hash, Clone, Debug)]
 pub struct OpaqueOrigin(usize);
-
-#[cfg(feature = "heapsize")]
-known_heap_size!(0, OpaqueOrigin);

+ 0 - 6
src/parser.rs

@@ -61,9 +61,6 @@ simple_enum_error! {
     Overflow => "URLs more than 4 GB are not supported",
 }
 
-#[cfg(feature = "heapsize")]
-known_heap_size!(0, ParseError);
-
 impl fmt::Display for ParseError {
     fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
         self.description().fmt(fmt)
@@ -115,9 +112,6 @@ syntax_violation_enum! {
     UnencodedAtSign => "unencoded @ sign in username or password",
 }
 
-#[cfg(feature = "heapsize")]
-known_heap_size!(0, SyntaxViolation);
-
 impl fmt::Display for SyntaxViolation {
     fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
         self.description().fmt(fmt)