mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
clippy: Fix vec_box
warnings in components/script
(#31986)
* clippy: Fix vec_box warnings * refactor: Allow heap values to stay boxed * refactor: Move comments above allow directives * Apply suggestions from code review Adjust comments slightly --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
fcc7a1be53
commit
31e0b33e73
1 changed files with 12 additions and 0 deletions
|
@ -294,6 +294,9 @@ pub struct GlobalScope {
|
|||
///
|
||||
/// <https://html.spec.whatwg.org/multipage/#about-to-be-notified-rejected-promises-list>
|
||||
#[ignore_malloc_size_of = "mozjs"]
|
||||
// `Heap` values must stay boxed, as they need semantics like `Pin`
|
||||
// (that is, they cannot be moved).
|
||||
#[allow(clippy::vec_box)]
|
||||
uncaught_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>,
|
||||
|
||||
/// Promises in this list have previously been reported as rejected
|
||||
|
@ -302,6 +305,9 @@ pub struct GlobalScope {
|
|||
///
|
||||
/// <https://html.spec.whatwg.org/multipage/#outstanding-rejected-promises-weak-set>
|
||||
#[ignore_malloc_size_of = "mozjs"]
|
||||
// `Heap` values must stay boxed, as they need semantics like `Pin`
|
||||
// (that is, they cannot be moved).
|
||||
#[allow(clippy::vec_box)]
|
||||
consumed_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>,
|
||||
|
||||
/// True if headless mode.
|
||||
|
@ -2194,6 +2200,9 @@ impl GlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
// `Heap` values must stay boxed, as they need semantics like `Pin`
|
||||
// (that is, they cannot be moved).
|
||||
#[allow(clippy::vec_box)]
|
||||
pub fn get_uncaught_rejections(&self) -> &DomRefCell<Vec<Box<Heap<*mut JSObject>>>> {
|
||||
&self.uncaught_rejections
|
||||
}
|
||||
|
@ -2215,6 +2224,9 @@ impl GlobalScope {
|
|||
}
|
||||
}
|
||||
|
||||
// `Heap` values must stay boxed, as they need semantics like `Pin`
|
||||
// (that is, they cannot be moved).
|
||||
#[allow(clippy::vec_box)]
|
||||
pub fn get_consumed_rejections(&self) -> &DomRefCell<Vec<Box<Heap<*mut JSObject>>>> {
|
||||
&self.consumed_rejections
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue