diff options
-rw-r--r-- | components/plugins/lints/unrooted_must_root.rs | 2 | ||||
-rw-r--r-- | components/script/body.rs | 2 | ||||
-rw-r--r-- | components/script/dom/attr.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/cell.rs | 2 | ||||
-rw-r--r-- | components/script/dom/characterdata.rs | 2 | ||||
-rw-r--r-- | components/script/dom/document.rs | 3 | ||||
-rw-r--r-- | components/script/dom/dommatrixreadonly.rs | 3 | ||||
-rw-r--r-- | components/script/dom/element.rs | 3 | ||||
-rw-r--r-- | components/script/dom/request.rs | 3 | ||||
-rw-r--r-- | components/script/dom/response.rs | 2 | ||||
-rw-r--r-- | components/script/lib.rs | 1 | ||||
-rw-r--r-- | components/style/refcell.rs | 20 |
12 files changed, 10 insertions, 35 deletions
diff --git a/components/plugins/lints/unrooted_must_root.rs b/components/plugins/lints/unrooted_must_root.rs index 5dc94df69f7..351817f2310 100644 --- a/components/plugins/lints/unrooted_must_root.rs +++ b/components/plugins/lints/unrooted_must_root.rs @@ -51,8 +51,6 @@ fn is_unrooted_ty(cx: &LateContext, ty: &ty::TyS, in_new_function: bool) -> bool false } else if match_def_path(cx, did.did, &["core", "cell", "Ref"]) || match_def_path(cx, did.did, &["core", "cell", "RefMut"]) - || match_def_path(cx, did.did, &["style", "refcell", "Ref"]) - || match_def_path(cx, did.did, &["style", "refcell", "RefMut"]) || match_def_path(cx, did.did, &["core", "slice", "Iter"]) || match_def_path(cx, did.did, &["std", "collections", "hash", "map", "OccupiedEntry"]) || match_def_path(cx, did.did, &["std", "collections", "hash", "map", "VacantEntry"]) { diff --git a/components/script/body.rs b/components/script/body.rs index 7777ef62a4e..814a62c30eb 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -19,9 +19,9 @@ use js::jsapi::JS_ParseJSON; use js::jsapi::Value as JSValue; use js::jsval::UndefinedValue; use mime::{Mime, TopLevel, SubLevel}; +use std::cell::Ref; use std::rc::Rc; use std::str; -use style::refcell::Ref; use url::form_urlencoded; pub enum BodyType { diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 36de48a1f9b..d5a00e6c1fa 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -15,10 +15,10 @@ use dom::element::{AttributeMutation, Element}; use dom::virtualmethods::vtable_for; use dom::window::Window; use std::borrow::ToOwned; +use std::cell::Ref; use std::mem; use string_cache::{Atom, Namespace}; use style::attr::{AttrIdentifier, AttrValue}; -use style::refcell::Ref; // https://dom.spec.whatwg.org/#interface-attr #[dom_struct] diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index 14987db5add..0f1945ef251 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -4,7 +4,7 @@ //! A shareable mutable container for the DOM. -use style::refcell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut}; +use std::cell::{BorrowError, BorrowMutError, Ref, RefCell, RefMut}; use style::thread_state; /// A mutable field in the DOM. diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index 979e9a70434..01f11e3ac50 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -19,7 +19,7 @@ use dom::element::Element; use dom::node::{Node, NodeDamage}; use dom::processinginstruction::ProcessingInstruction; use dom::text::Text; -use style::refcell::Ref; +use std::cell::Ref; use util::opts; // https://dom.spec.whatwg.org/#characterdata diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 31c4267f915..a1cdfbc0a06 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -113,7 +113,7 @@ use script_traits::UntrustedNodeAddress; use std::ascii::AsciiExt; use std::borrow::ToOwned; use std::boxed::FnBox; -use std::cell::Cell; +use std::cell::{Cell, Ref, RefMut}; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::default::Default; @@ -125,7 +125,6 @@ use std::time::{Duration, Instant}; use string_cache::{Atom, QualName}; use style::attr::AttrValue; use style::context::ReflowGoal; -use style::refcell::{Ref, RefMut}; use style::selector_impl::ElementSnapshot; use style::str::{split_html_space_chars, str_join}; use style::stylesheets::Stylesheet; diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index 7b7e4b1e606..5c6d66c9a1a 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -14,9 +14,8 @@ use dom::bindings::reflector::{reflect_dom_object, Reflectable, Reflector}; use dom::dommatrix::DOMMatrix; use dom::dompoint::DOMPoint; use euclid::{Matrix4D, Point4D, Radians}; -use std::cell::Cell; +use std::cell::{Cell, Ref}; use std::f64; -use style::refcell::Ref; #[dom_struct] pub struct DOMMatrixReadOnly { diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index fb26ce913e0..5e00cb71c75 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -76,7 +76,7 @@ use selectors::matching::{HAS_EDGE_CHILD_SELECTOR, HAS_SLOW_SELECTOR, HAS_SLOW_S use selectors::parser::{AttrSelector, NamespaceConstraint, parse_author_origin_selector_list_from_str}; use std::ascii::AsciiExt; use std::borrow::Cow; -use std::cell::Cell; +use std::cell::{Cell, Ref}; use std::convert::TryFrom; use std::default::Default; use std::fmt; @@ -90,7 +90,6 @@ use style::parser::ParserContextExtraData; use style::properties::{DeclaredValue, Importance}; use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute}; use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size, overflow_x}; -use style::refcell::Ref; use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl}; use style::selector_matching::ApplicableDeclarationBlock; use style::sink::Push; diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs index ba15f565c27..ebfe0abf49e 100644 --- a/components/script/dom/request.rs +++ b/components/script/dom/request.rs @@ -35,10 +35,9 @@ use net_traits::request::Referrer as NetTraitsRequestReferrer; use net_traits::request::Request as NetTraitsRequest; use net_traits::request::RequestMode as NetTraitsRequestMode; use net_traits::request::Type as NetTraitsRequestType; -use std::cell::Cell; +use std::cell::{Cell, Ref}; use std::mem; use std::rc::Rc; -use style::refcell::Ref; use url::Url; #[dom_struct] diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index b8eeb81fb66..66a7e84f112 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -22,10 +22,10 @@ use hyper::header::Headers as HyperHeaders; use hyper::status::StatusCode; use hyper_serde::Serde; use net_traits::response::{ResponseBody as NetTraitsResponseBody}; +use std::cell::Ref; use std::mem; use std::rc::Rc; use std::str::FromStr; -use style::refcell::Ref; use url::Position; use url::Url; diff --git a/components/script/lib.rs b/components/script/lib.rs index 3b4c6c40a1e..a7c73205d2f 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -17,6 +17,7 @@ #![feature(slice_patterns)] #![feature(stmt_expr_attributes)] #![feature(question_mark)] +#![feature(try_borrow)] #![feature(try_from)] #![deny(unsafe_code)] diff --git a/components/style/refcell.rs b/components/style/refcell.rs index f9a2b4a0672..a41fa2b63b1 100644 --- a/components/style/refcell.rs +++ b/components/style/refcell.rs @@ -15,7 +15,6 @@ #![allow(unsafe_code)] -#[cfg(feature = "servo")] use heapsize::HeapSizeOf; use std::cell::{UnsafeCell, Cell}; use std::cmp::Ordering; use std::fmt::{self, Debug, Display}; @@ -32,13 +31,6 @@ pub struct RefCell<T: ?Sized> { value: UnsafeCell<T>, } -#[cfg(feature = "servo")] -impl<T: HeapSizeOf> HeapSizeOf for RefCell<T> { - fn heap_size_of_children(&self) -> usize { - self.borrow().heap_size_of_children() - } -} - /// An enumeration of values returned from the `state` method on a `RefCell<T>`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum BorrowState { @@ -535,18 +527,6 @@ impl<'b, T: ?Sized> Ref<'b, T> { borrow: orig.borrow, } } - - #[inline] - pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Option<Ref<'b, U>> - where F: FnOnce(&T) -> Option<&U> - { - f(orig.value).map(move |new_value| { - Ref { - value: new_value, - borrow: orig.borrow, - } - }) - } } impl<'b, T: ?Sized> RefMut<'b, T> { |