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:
Martin Robinson 2024-04-22 20:20:47 +02:00 committed by GitHub
parent f65010c97d
commit a0640c8524
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 6 additions and 146 deletions

View file

@ -7,7 +7,7 @@
//! See CSS 2.1 § 9.5.1: <https://www.w3.org/TR/CSS2/visuren.html#float-position>
use std::collections::VecDeque;
use std::fmt::{Debug, Formatter, Result as FmtResult};
use std::fmt::Debug;
use std::mem;
use std::ops::Range;
@ -24,7 +24,7 @@ use crate::context::LayoutContext;
use crate::dom::NodeExt;
use crate::dom_traversal::{Contents, NodeAndStyleInfo};
use crate::formatting_contexts::IndependentFormattingContext;
use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, CollapsedMargin, FloatFragment};
use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, CollapsedMargin};
use crate::geom::{LogicalRect, LogicalVec2};
use crate::positioned::PositioningContext;
use crate::style_ext::{ComputedValuesExt, DisplayInside, PaddingBorderMargin};
@ -867,12 +867,6 @@ impl FloatBandLink {
}
}
impl Debug for FloatFragment {
fn fmt(&self, formatter: &mut Formatter) -> FmtResult {
write!(formatter, "FloatFragment")
}
}
impl FloatBox {
/// Creates a new float box.
pub fn construct<'dom>(

View file

@ -48,11 +48,6 @@ pub(crate) enum Fragment {
IFrame(IFrameFragment),
}
#[derive(Serialize)]
pub(crate) struct FloatFragment {
pub box_fragment: BoxFragment,
}
#[derive(Serialize)]
pub(crate) struct CollapsedBlockMargins {
pub collapsed_through: bool,

View file

@ -137,8 +137,6 @@ impl PaddingBorderMargin {
}
pub(crate) trait ComputedValuesExt {
fn inline_size_is_length(&self) -> bool;
fn inline_box_offsets_are_both_non_auto(&self) -> bool;
fn box_offsets(
&self,
containing_block: &ContainingBlock,
@ -198,28 +196,6 @@ pub(crate) trait ComputedValuesExt {
}
impl ComputedValuesExt for ComputedValues {
fn inline_size_is_length(&self) -> bool {
let position = self.get_position();
// FIXME: this is the wrong writing mode but we plan to remove eager content size computation.
let size = if self.writing_mode.is_horizontal() {
&position.width
} else {
&position.height
};
matches!(size, Size::LengthPercentage(lp) if lp.0.to_length().is_some())
}
fn inline_box_offsets_are_both_non_auto(&self) -> bool {
let position = self.get_position();
// FIXME: this is the wrong writing mode but we plan to remove eager content size computation.
let (a, b) = if self.writing_mode.is_horizontal() {
(&position.left, &position.right)
} else {
(&position.top, &position.bottom)
};
!a.is_auto() && !b.is_auto()
}
fn box_offsets(
&self,
containing_block: &ContainingBlock,