diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-06-03 00:30:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 00:30:33 -0400 |
commit | ea491b41174edd03c3ee08fe29046c33b96b0406 (patch) | |
tree | 781c8853843b512ec4b50c8f071752160bfc3871 /components/script | |
parent | af85d2fd2051ad1ceff27c581b57450dec34bfa3 (diff) | |
parent | 1feeb23514118926098f6fab219f38fc22e8f9d7 (diff) | |
download | servo-ea491b41174edd03c3ee08fe29046c33b96b0406.tar.gz servo-ea491b41174edd03c3ee08fe29046c33b96b0406.zip |
Auto merge of #26757 - jdm:unneeded-generic, r=SimonSapin
Remove unnecessary generics from low-level script code
This should remove one of the larger offenders from the cargo-llvm-lines output for the script crate.
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/conversions.rs | 9 | ||||
-rw-r--r-- | components/script/dom/bindings/root.rs | 17 |
2 files changed, 14 insertions, 12 deletions
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 531ff6ea885..da4334207bf 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -452,13 +452,10 @@ where /// Returns Err(()) if `obj` is a wrapper or if the object is not an object /// for a DOM object of the given type (as defined by the proto_id and proto_depth). #[inline] -pub unsafe fn private_from_proto_check_static<F>( +unsafe fn private_from_proto_check_static( obj: *mut JSObject, - proto_check: F, -) -> Result<*const libc::c_void, ()> -where - F: Fn(&'static DOMClass) -> bool, -{ + proto_check: fn(&'static DOMClass) -> bool, +) -> Result<*const libc::c_void, ()> { let dom_class = get_dom_class(obj).map_err(|_| ())?; if proto_check(dom_class) { trace!("good prototype"); diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 59f9b964564..36bc2296ee5 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -63,12 +63,17 @@ where /// out references which cannot outlive this new `Root`. #[allow(unrooted_must_root)] pub unsafe fn new(value: T) -> Self { - debug_assert!(thread_state::get().is_script()); - STACK_ROOTS.with(|ref root_list| { - let root_list = &*root_list.get().unwrap(); - root_list.root(value.stable_trace_object()); - Root { value, root_list } - }) + unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection { + debug_assert!(thread_state::get().is_script()); + STACK_ROOTS.with(|ref root_list| { + let root_list = &*root_list.get().unwrap(); + root_list.root(object); + root_list + }) + } + + let root_list = add_to_root_list(value.stable_trace_object()); + Root { value, root_list } } } |