mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Address issues uncovered by rust-1.78 beta (#32130)
This change makes changes to allow Servo to compile with the 1.78 version of Rust: - Dead code is removd (Rust seems to have gotten better at detecting it). - The `FlowRef` `DerefMut` is updated according to @SimonSapin's advice [^1]. - The `imports.rs` now explicitly silences warnings about unused imports. [^1]: https://github.com/servo/servo/issues/6503#issuecomment-2066088179 <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they should not change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
parent
f65010c97d
commit
a0640c8524
16 changed files with 6 additions and 146 deletions
|
@ -31,8 +31,7 @@ use std::marker::PhantomData;
|
|||
use std::ops::Deref;
|
||||
use std::{mem, ptr};
|
||||
|
||||
use js::jsapi::{Heap, JSObject, JSTracer};
|
||||
use js::rust::GCMethods;
|
||||
use js::jsapi::{JSObject, JSTracer};
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use script_layout_interface::TrustedNodeAddress;
|
||||
use style::thread_state;
|
||||
|
@ -772,32 +771,3 @@ where
|
|||
&*(slice as *const [Dom<T>] as *const [LayoutDom<T>])
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper trait for safer manipulations of `Option<Heap<T>>` values.
|
||||
pub trait OptionalHeapSetter {
|
||||
type Value;
|
||||
/// Update this optional heap value with a new value.
|
||||
fn set(&mut self, v: Option<Self::Value>);
|
||||
}
|
||||
|
||||
impl<T: GCMethods + Copy> OptionalHeapSetter for Option<Heap<T>>
|
||||
where
|
||||
Heap<T>: Default,
|
||||
{
|
||||
type Value = T;
|
||||
fn set(&mut self, v: Option<T>) {
|
||||
let v = match v {
|
||||
None => {
|
||||
*self = None;
|
||||
return;
|
||||
},
|
||||
Some(v) => v,
|
||||
};
|
||||
|
||||
if self.is_none() {
|
||||
*self = Some(Heap::default());
|
||||
}
|
||||
|
||||
self.as_ref().unwrap().set(v);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue