Fix warnings introduced in newer Rust Nightly

This does not (yet) upgrade ./rust-toolchain

The warnings:

* dead_code "field is never read"
* redundant_semicolons "unnecessary trailing semicolon"
* non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021"
* unstable_name_collisions "a method with this name may be added to the standard library in the future"
* legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
This commit is contained in:
Simon Sapin 2021-02-25 10:39:53 +01:00
parent 4353d534d4
commit a0d9f97c8e
35 changed files with 75 additions and 116 deletions

View file

@ -47,6 +47,6 @@ fn main() {
_ => panic!("Cannot find package definitions in lockfile"), _ => panic!("Cannot find package definitions in lockfile"),
} }
}, },
Err(e) => panic!(e), Err(e) => panic!("{}", e),
} }
} }

View file

@ -141,9 +141,6 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> {
/// the compositor. /// the compositor.
pub shutdown_state: ShutdownState, pub shutdown_state: ShutdownState,
/// Tracks the last composite time.
last_composite_time: u64,
/// Tracks whether the zoom action has happened recently. /// Tracks whether the zoom action has happened recently.
zoom_action: bool, zoom_action: bool,
@ -320,7 +317,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
frame_tree_id: FrameTreeId(0), frame_tree_id: FrameTreeId(0),
constellation_chan: state.constellation_chan, constellation_chan: state.constellation_chan,
time_profiler_chan: state.time_profiler_chan, time_profiler_chan: state.time_profiler_chan,
last_composite_time: 0,
ready_to_save_state: ReadyState::Unknown, ready_to_save_state: ReadyState::Unknown,
webrender: state.webrender, webrender: state.webrender,
webrender_document: state.webrender_document, webrender_document: state.webrender_document,
@ -1580,8 +1576,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
warn!("Failed to present surface: {:?}", err); warn!("Failed to present surface: {:?}", err);
} }
self.last_composite_time = precise_time_ns();
self.composition_request = CompositionRequest::NoCompositingNecessary; self.composition_request = CompositionRequest::NoCompositingNecessary;
self.process_animations(); self.process_animations();

View file

@ -113,12 +113,7 @@ macro_rules! impl_from_pref {
if let $variant(value) = other { if let $variant(value) = other {
value.into() value.into()
} else { } else {
panic!( panic!("Cannot convert {:?} to {:?}", other, std::any::type_name::<$t>())
format!("Cannot convert {:?} to {:?}",
other,
std::any::type_name::<$t>()
)
);
} }
} }
} }

View file

@ -132,11 +132,13 @@ impl Build {
.get_field_name_mapping() .get_field_name_mapping()
.map(|pref_attr| pref_attr.value()) .map(|pref_attr| pref_attr.value())
.unwrap_or_else(|| { .unwrap_or_else(|| {
Itertools::intersperse(
path_stack path_stack
.iter() .iter()
.chain(iter::once(&field.name)) .chain(iter::once(&field.name))
.map(Ident::to_string) .map(Ident::to_string),
.intersperse(String::from(".")) String::from("."),
)
.collect() .collect()
}) })
} }

View file

@ -11,13 +11,12 @@ use msg::constellation_msg::PipelineId;
use serde_json::{Map, Value}; use serde_json::{Map, Value};
use std::mem; use std::mem;
use std::net::TcpStream; use std::net::TcpStream;
use time::precise_time_ns;
pub struct FramerateActor { pub struct FramerateActor {
name: String, name: String,
pipeline: PipelineId, pipeline: PipelineId,
script_sender: IpcSender<DevtoolScriptControlMsg>, script_sender: IpcSender<DevtoolScriptControlMsg>,
start_time: Option<u64>,
is_recording: bool, is_recording: bool,
ticks: Vec<HighResolutionStamp>, ticks: Vec<HighResolutionStamp>,
} }
@ -51,7 +50,6 @@ impl FramerateActor {
name: actor_name.clone(), name: actor_name.clone(),
pipeline: pipeline_id, pipeline: pipeline_id,
script_sender: script_sender, script_sender: script_sender,
start_time: None,
is_recording: false, is_recording: false,
ticks: Vec::new(), ticks: Vec::new(),
}; };
@ -79,7 +77,6 @@ impl FramerateActor {
return; return;
} }
self.start_time = Some(precise_time_ns());
self.is_recording = true; self.is_recording = true;
let msg = DevtoolScriptControlMsg::RequestAnimationFrame(self.pipeline, self.name()); let msg = DevtoolScriptControlMsg::RequestAnimationFrame(self.pipeline, self.name());
@ -91,7 +88,6 @@ impl FramerateActor {
return; return;
} }
self.is_recording = false; self.is_recording = false;
self.start_time = None;
} }
} }

View file

@ -157,7 +157,7 @@ impl TableWrapperFlow {
.zip(guesses.iter()) .zip(guesses.iter())
{ {
intermediate_column_inline_size.size = guess.calculate(selection); intermediate_column_inline_size.size = guess.calculate(selection);
intermediate_column_inline_size.percentage = 0.0; // intermediate_column_inline_size.percentage = 0.0;
total_used_inline_size = total_used_inline_size + intermediate_column_inline_size.size total_used_inline_size = total_used_inline_size + intermediate_column_inline_size.size
} }
@ -382,7 +382,7 @@ impl Flow for TableWrapperFlow {
.map( .map(
|column_intrinsic_inline_size| IntermediateColumnInlineSize { |column_intrinsic_inline_size| IntermediateColumnInlineSize {
size: column_intrinsic_inline_size.minimum_length, size: column_intrinsic_inline_size.minimum_length,
percentage: column_intrinsic_inline_size.percentage, // percentage: column_intrinsic_inline_size.percentage,
}, },
) )
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@ -822,7 +822,9 @@ impl ExcessInlineSizeDistributionInfo {
/// An intermediate column size assignment. /// An intermediate column size assignment.
struct IntermediateColumnInlineSize { struct IntermediateColumnInlineSize {
size: Au, size: Au,
percentage: f32, // This used to be stored here but nothing used it,
// which started emitting a compiler warning: https://github.com/servo/servo/pull/28202
// percentage: f32,
} }
/// Returns the computed inline size of the table wrapper represented by `block`. /// Returns the computed inline size of the table wrapper represented by `block`.

View file

@ -189,9 +189,6 @@ pub struct LayoutThread {
/// The root of the flow tree. /// The root of the flow tree.
root_flow: RefCell<Option<FlowRef>>, root_flow: RefCell<Option<FlowRef>>,
/// The document-specific shared lock used for author-origin stylesheets
document_shared_lock: Option<SharedRwLock>,
/// A counter for epoch messages /// A counter for epoch messages
epoch: Cell<Epoch>, epoch: Cell<Epoch>,
@ -543,7 +540,6 @@ impl LayoutThread {
generation: Cell::new(0), generation: Cell::new(0),
outstanding_web_fonts: Arc::new(AtomicUsize::new(0)), outstanding_web_fonts: Arc::new(AtomicUsize::new(0)),
root_flow: RefCell::new(None), root_flow: RefCell::new(None),
document_shared_lock: None,
// Epoch starts at 1 because of the initial display list for epoch 0 that we send to WR // Epoch starts at 1 because of the initial display list for epoch 0 that we send to WR
epoch: Cell::new(Epoch(1)), epoch: Cell::new(Epoch(1)),
viewport_size: Size2D::new(Au(0), Au(0)), viewport_size: Size2D::new(Au(0), Au(0)),
@ -1261,7 +1257,6 @@ impl LayoutThread {
// Calculate the actual viewport as per DEVICE-ADAPT § 6 // Calculate the actual viewport as per DEVICE-ADAPT § 6
// If the entire flow tree is invalid, then it will be reflowed anyhow. // If the entire flow tree is invalid, then it will be reflowed anyhow.
let document_shared_lock = document.style_shared_lock(); let document_shared_lock = document.style_shared_lock();
self.document_shared_lock = Some(document_shared_lock.clone());
let author_guard = document_shared_lock.read(); let author_guard = document_shared_lock.read();
let ua_stylesheets = &*UA_STYLESHEETS; let ua_stylesheets = &*UA_STYLESHEETS;

View file

@ -167,9 +167,6 @@ pub struct LayoutThread {
/// The fragment tree. /// The fragment tree.
fragment_tree: RefCell<Option<Arc<FragmentTree>>>, fragment_tree: RefCell<Option<Arc<FragmentTree>>>,
/// The document-specific shared lock used for author-origin stylesheets
document_shared_lock: Option<SharedRwLock>,
/// A counter for epoch messages /// A counter for epoch messages
epoch: Cell<Epoch>, epoch: Cell<Epoch>,
@ -510,7 +507,6 @@ impl LayoutThread {
outstanding_web_fonts: Arc::new(AtomicUsize::new(0)), outstanding_web_fonts: Arc::new(AtomicUsize::new(0)),
box_tree: Default::default(), box_tree: Default::default(),
fragment_tree: Default::default(), fragment_tree: Default::default(),
document_shared_lock: None,
// Epoch starts at 1 because of the initial display list for epoch 0 that we send to WR // Epoch starts at 1 because of the initial display list for epoch 0 that we send to WR
epoch: Cell::new(Epoch(1)), epoch: Cell::new(Epoch(1)),
viewport_size: Size2D::new(Au(0), Au(0)), viewport_size: Size2D::new(Au(0), Au(0)),
@ -947,7 +943,6 @@ impl LayoutThread {
// Calculate the actual viewport as per DEVICE-ADAPT § 6 // Calculate the actual viewport as per DEVICE-ADAPT § 6
// If the entire flow tree is invalid, then it will be reflowed anyhow. // If the entire flow tree is invalid, then it will be reflowed anyhow.
let document_shared_lock = document.style_shared_lock(); let document_shared_lock = document.style_shared_lock();
self.document_shared_lock = Some(document_shared_lock.clone());
let author_guard = document_shared_lock.read(); let author_guard = document_shared_lock.read();
let ua_stylesheets = &*UA_STYLESHEETS; let ua_stylesheets = &*UA_STYLESHEETS;

View file

@ -44,7 +44,7 @@ fn assert_parse(
filtered: FilteredMetadata::Basic(m), filtered: FilteredMetadata::Basic(m),
.. ..
}) => m, }) => m,
result => panic!(result), result => panic!("{:?}", result),
}; };
assert_eq!(metadata.content_type.map(Serde::into_inner), content_type); assert_eq!(metadata.content_type.map(Serde::into_inner), content_type);
assert_eq!(metadata.charset.as_ref().map(String::deref), charset); assert_eq!(metadata.charset.as_ref().map(String::deref), charset);

View file

@ -312,7 +312,7 @@ impl Response {
metadata.referrer_policy = response.referrer_policy.clone(); metadata.referrer_policy = response.referrer_policy.clone();
metadata.redirected = response.actual_response().url_list.len() > 1; metadata.redirected = response.actual_response().url_list.len() > 1;
metadata metadata
}; }
if let Some(error) = self.get_network_error() { if let Some(error) = self.get_network_error() {
return Err(error.clone()); return Err(error.clone());

View file

@ -101,10 +101,7 @@ impl Profiler {
let name_clone = name.clone(); let name_clone = name.clone();
match self.reporters.insert(name, reporter) { match self.reporters.insert(name, reporter) {
None => true, None => true,
Some(_) => panic!(format!( Some(_) => panic!("RegisterReporter: '{}' name is already in use", name_clone),
"RegisterReporter: '{}' name is already in use",
name_clone
)),
} }
}, },
@ -112,7 +109,7 @@ impl Profiler {
// Panic if it hasn't previously been registered. // Panic if it hasn't previously been registered.
match self.reporters.remove(&name) { match self.reporters.remove(&name) {
Some(_) => true, Some(_) => true,
None => panic!(format!("UnregisterReporter: '{}' name is unknown", &name)), None => panic!("UnregisterReporter: '{}' name is unknown", &name),
} }
}, },

View file

@ -21,8 +21,8 @@ use style_traits::{CssWriter, ParseError, ToCss};
use to_shmem::{self, SharedMemoryBuilder, ToShmem}; use to_shmem::{self, SharedMemoryBuilder, ToShmem};
/// A CSS url() value for gecko. /// A CSS url() value for gecko.
#[css(function = "url")]
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)] #[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
#[css(function = "url")]
#[repr(C)] #[repr(C)]
pub struct CssUrl(pub Arc<CssUrlData>); pub struct CssUrl(pub Arc<CssUrlData>);

View file

@ -14,8 +14,8 @@ use cssparser::{Delimiter, Parser};
use cssparser::{ParserInput, Token}; use cssparser::{ParserInput, Token};
/// A type that encapsulates a media query list. /// A type that encapsulates a media query list.
#[css(comma, derive_debug)]
#[derive(Clone, MallocSizeOf, ToCss, ToShmem)] #[derive(Clone, MallocSizeOf, ToCss, ToShmem)]
#[css(comma, derive_debug)]
pub struct MediaList { pub struct MediaList {
/// The list of media queries. /// The list of media queries.
#[css(iterable)] #[css(iterable)]

View file

@ -170,9 +170,6 @@
/// Making this type generic allows the compiler to figure out the /// Making this type generic allows the compiler to figure out the
/// animated value for us, instead of having to implement it /// animated value for us, instead of having to implement it
/// manually for every type we care about. /// manually for every type we care about.
% if separator == "Comma":
#[css(comma)]
% endif
#[derive( #[derive(
Clone, Clone,
Debug, Debug,
@ -182,6 +179,9 @@
ToResolvedValue, ToResolvedValue,
ToCss, ToCss,
)] )]
% if separator == "Comma":
#[css(comma)]
% endif
pub struct OwnedList<T>( pub struct OwnedList<T>(
% if not allow_empty: % if not allow_empty:
#[css(iterable)] #[css(iterable)]
@ -198,9 +198,6 @@
% else: % else:
pub use self::ComputedList as List; pub use self::ComputedList as List;
% if separator == "Comma":
#[css(comma)]
% endif
#[derive( #[derive(
Clone, Clone,
Debug, Debug,
@ -208,6 +205,9 @@
PartialEq, PartialEq,
ToCss, ToCss,
)] )]
% if separator == "Comma":
#[css(comma)]
% endif
pub struct ComputedList( pub struct ComputedList(
% if not allow_empty: % if not allow_empty:
#[css(iterable)] #[css(iterable)]
@ -324,10 +324,10 @@
} }
/// The specified value of ${name}. /// The specified value of ${name}.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
% if separator == "Comma": % if separator == "Comma":
#[css(comma)] #[css(comma)]
% endif % endif
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
pub struct SpecifiedValue( pub struct SpecifiedValue(
% if not allow_empty: % if not allow_empty:
#[css(iterable)] #[css(iterable)]

View file

@ -215,8 +215,8 @@ impl DocumentMatchingFunction {
/// The `@document` rule's condition is written as a comma-separated list of /// The `@document` rule's condition is written as a comma-separated list of
/// URL matching functions, and the condition evaluates to true whenever any /// URL matching functions, and the condition evaluates to true whenever any
/// one of those functions evaluates to true. /// one of those functions evaluates to true.
#[css(comma)]
#[derive(Clone, Debug, ToCss, ToShmem)] #[derive(Clone, Debug, ToCss, ToShmem)]
#[css(comma)]
pub struct DocumentCondition(#[css(iterable)] Vec<DocumentMatchingFunction>); pub struct DocumentCondition(#[css(iterable)] Vec<DocumentMatchingFunction>);
impl DocumentCondition { impl DocumentCondition {

View file

@ -149,8 +149,8 @@ impl KeyframePercentage {
/// A keyframes selector is a list of percentages or from/to symbols, which are /// A keyframes selector is a list of percentages or from/to symbols, which are
/// converted at parse time to percentages. /// converted at parse time to percentages.
#[css(comma)]
#[derive(Clone, Debug, Eq, PartialEq, ToCss, ToShmem)] #[derive(Clone, Debug, Eq, PartialEq, ToCss, ToShmem)]
#[css(comma)]
pub struct KeyframeSelector(#[css(iterable)] Vec<KeyframePercentage>); pub struct KeyframeSelector(#[css(iterable)] Vec<KeyframePercentage>);
impl KeyframeSelector { impl KeyframeSelector {

View file

@ -116,7 +116,7 @@ impl<'a> FontSettingTagIter<'a> {
let mut sorted_tags = Vec::from_iter(tags.iter()); let mut sorted_tags = Vec::from_iter(tags.iter());
sorted_tags.sort_by_key(|k| k.tag.0); sorted_tags.sort_by_key(|k| k.tag.0);
sorted_tags sorted_tags
}; }
Ok(FontSettingTagIter { Ok(FontSettingTagIter {
a_state: FontSettingTagIterState::new(as_new_sorted_tags(&a_settings.0)), a_state: FontSettingTagIterState::new(as_new_sorted_tags(&a_settings.0)),

View file

@ -91,7 +91,6 @@ impl Default for ShapeBox {
/// A value for the `clip-path` property. /// A value for the `clip-path` property.
#[allow(missing_docs)] #[allow(missing_docs)]
#[animation(no_bound(U))]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -106,6 +105,7 @@ impl Default for ShapeBox {
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[animation(no_bound(U))]
#[repr(u8)] #[repr(u8)]
pub enum GenericClipPath<BasicShape, U> { pub enum GenericClipPath<BasicShape, U> {
#[animation(error)] #[animation(error)]
@ -126,7 +126,6 @@ pub use self::GenericClipPath as ClipPath;
/// A value for the `shape-outside` property. /// A value for the `shape-outside` property.
#[allow(missing_docs)] #[allow(missing_docs)]
#[animation(no_bound(I))]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -141,6 +140,7 @@ pub use self::GenericClipPath as ClipPath;
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[animation(no_bound(I))]
#[repr(u8)] #[repr(u8)]
pub enum GenericShapeOutside<BasicShape, I> { pub enum GenericShapeOutside<BasicShape, I> {
#[animation(error)] #[animation(error)]
@ -193,7 +193,6 @@ pub use self::GenericBasicShape as BasicShape;
/// <https://drafts.csswg.org/css-shapes/#funcdef-inset> /// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
#[allow(missing_docs)] #[allow(missing_docs)]
#[css(function = "inset")]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -207,6 +206,7 @@ pub use self::GenericBasicShape as BasicShape;
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(function = "inset")]
#[repr(C)] #[repr(C)]
pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> { pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
pub rect: Rect<LengthPercentage>, pub rect: Rect<LengthPercentage>,
@ -216,7 +216,6 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-circle> /// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
#[allow(missing_docs)] #[allow(missing_docs)]
#[css(function)]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -231,6 +230,7 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(function)]
#[repr(C)] #[repr(C)]
pub struct Circle<H, V, NonNegativeLengthPercentage> { pub struct Circle<H, V, NonNegativeLengthPercentage> {
pub position: GenericPosition<H, V>, pub position: GenericPosition<H, V>,
@ -239,7 +239,6 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse> /// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
#[allow(missing_docs)] #[allow(missing_docs)]
#[css(function)]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -254,6 +253,7 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(function)]
#[repr(C)] #[repr(C)]
pub struct Ellipse<H, V, NonNegativeLengthPercentage> { pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
pub position: GenericPosition<H, V>, pub position: GenericPosition<H, V>,
@ -293,7 +293,6 @@ pub use self::GenericShapeRadius as ShapeRadius;
/// A generic type for representing the `polygon()` function /// A generic type for representing the `polygon()` function
/// ///
/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon> /// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
#[css(comma, function = "polygon")]
#[derive( #[derive(
Clone, Clone,
Debug, Debug,
@ -306,6 +305,7 @@ pub use self::GenericShapeRadius as ShapeRadius;
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(comma, function = "polygon")]
#[repr(C)] #[repr(C)]
pub struct GenericPolygon<LengthPercentage> { pub struct GenericPolygon<LengthPercentage> {
/// The filling rule for a polygon. /// The filling rule for a polygon.
@ -364,7 +364,6 @@ pub enum FillRule {
/// The path function defined in css-shape-2. /// The path function defined in css-shape-2.
/// ///
/// https://drafts.csswg.org/css-shapes-2/#funcdef-path /// https://drafts.csswg.org/css-shapes-2/#funcdef-path
#[css(comma)]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -379,6 +378,7 @@ pub enum FillRule {
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(comma)]
#[repr(C)] #[repr(C)]
pub struct Path { pub struct Path {
/// The filling rule for the svg path. /// The filling rule for the svg path.

View file

@ -35,7 +35,6 @@ pub use self::GenericBoxShadow as BoxShadow;
/// A generic value for a single `filter`. /// A generic value for a single `filter`.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[animation(no_bound(U))]
#[derive( #[derive(
Clone, Clone,
ComputeSquaredDistance, ComputeSquaredDistance,
@ -49,6 +48,7 @@ pub use self::GenericBoxShadow as BoxShadow;
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[animation(no_bound(U))]
#[repr(C, u8)] #[repr(C, u8)]
pub enum GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U> { pub enum GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U> {
/// `blur(<length>)` /// `blur(<length>)`

View file

@ -77,7 +77,6 @@ pub struct VariationValue<Number> {
} }
/// A value both for font-variation-settings and font-feature-settings. /// A value both for font-variation-settings and font-feature-settings.
#[css(comma)]
#[derive( #[derive(
Clone, Clone,
Debug, Debug,
@ -90,6 +89,7 @@ pub struct VariationValue<Number> {
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(comma)]
pub struct FontSettings<T>(#[css(if_empty = "normal", iterable)] pub Box<[T]>); pub struct FontSettings<T>(#[css(if_empty = "normal", iterable)] pub Box<[T]>);
impl<T> FontSettings<T> { impl<T> FontSettings<T> {

View file

@ -264,7 +264,6 @@ impl ToCss for PaintWorklet {
/// ///
/// `-moz-image-rect(<uri>, top, right, bottom, left);` /// `-moz-image-rect(<uri>, top, right, bottom, left);`
#[allow(missing_docs)] #[allow(missing_docs)]
#[css(comma, function = "-moz-image-rect")]
#[derive( #[derive(
Clone, Clone,
Debug, Debug,
@ -276,6 +275,7 @@ impl ToCss for PaintWorklet {
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(comma, function = "-moz-image-rect")]
#[repr(C)] #[repr(C)]
pub struct GenericMozImageRect<NumberOrPercentage, MozImageRectUrl> { pub struct GenericMozImageRect<NumberOrPercentage, MozImageRectUrl> {
pub url: MozImageRectUrl, pub url: MozImageRectUrl,

View file

@ -42,7 +42,6 @@ pub use self::GenericSVGPaintFallback as SVGPaintFallback;
/// An SVG paint value /// An SVG paint value
/// ///
/// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint> /// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint>
#[animation(no_bound(Url))]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -58,6 +57,7 @@ pub use self::GenericSVGPaintFallback as SVGPaintFallback;
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[animation(no_bound(Url))]
#[repr(C)] #[repr(C)]
pub struct GenericSVGPaint<Color, Url> { pub struct GenericSVGPaint<Color, Url> {
/// The paint source. /// The paint source.
@ -81,7 +81,6 @@ impl<C, U> Default for SVGPaint<C, U> {
/// ///
/// Whereas the spec only allows PaintServer to have a fallback, Gecko lets the /// Whereas the spec only allows PaintServer to have a fallback, Gecko lets the
/// context properties have a fallback as well. /// context properties have a fallback as well.
#[animation(no_bound(U))]
#[derive( #[derive(
Animate, Animate,
Clone, Clone,
@ -98,6 +97,7 @@ impl<C, U> Default for SVGPaint<C, U> {
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[animation(no_bound(U))]
#[repr(C, u8)] #[repr(C, u8)]
pub enum GenericSVGPaintKind<C, U> { pub enum GenericSVGPaintKind<C, U> {
/// `none` /// `none`

View file

@ -47,7 +47,6 @@ pub use self::GenericMatrix as Matrix;
#[allow(missing_docs)] #[allow(missing_docs)]
#[cfg_attr(rustfmt, rustfmt_skip)] #[cfg_attr(rustfmt, rustfmt_skip)]
#[css(comma, function = "matrix3d")]
#[derive( #[derive(
Clone, Clone,
Copy, Copy,
@ -62,6 +61,7 @@ pub use self::GenericMatrix as Matrix;
ToResolvedValue, ToResolvedValue,
ToShmem, ToShmem,
)] )]
#[css(comma, function = "matrix3d")]
#[repr(C)] #[repr(C)]
pub struct GenericMatrix3D<T> { pub struct GenericMatrix3D<T> {
pub m11: T, pub m12: T, pub m13: T, pub m14: T, pub m11: T, pub m12: T, pub m13: T, pub m14: T,

View file

@ -112,14 +112,14 @@ fn derive_variant_arm(
} }
} }
#[darling(attributes(animation), default)]
#[derive(Default, FromDeriveInput)] #[derive(Default, FromDeriveInput)]
#[darling(attributes(animation), default)]
pub struct AnimationInputAttrs { pub struct AnimationInputAttrs {
pub no_bound: Option<PathList>, pub no_bound: Option<PathList>,
} }
#[darling(attributes(animation), default)]
#[derive(Default, FromVariant)] #[derive(Default, FromVariant)]
#[darling(attributes(animation), default)]
pub struct AnimationVariantAttrs { pub struct AnimationVariantAttrs {
pub error: bool, pub error: bool,
// Only here because of structs, where the struct definition acts as a // Only here because of structs, where the struct definition acts as a
@ -127,8 +127,8 @@ pub struct AnimationVariantAttrs {
pub no_bound: Option<PathList>, pub no_bound: Option<PathList>,
} }
#[darling(attributes(animation), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(animation), default)]
pub struct AnimationFieldAttrs { pub struct AnimationFieldAttrs {
pub constant: bool, pub constant: bool,
pub field_bound: bool, pub field_bound: bool,

View file

@ -118,8 +118,8 @@ fn derive_variant_arm(
}; };
} }
#[darling(attributes(distance), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(distance), default)]
struct DistanceFieldAttrs { struct DistanceFieldAttrs {
field_bound: bool, field_bound: bool,
} }

View file

@ -8,15 +8,15 @@ use proc_macro2::TokenStream;
use syn::{self, DeriveInput, Path}; use syn::{self, DeriveInput, Path};
use synstructure::{Structure, VariantInfo}; use synstructure::{Structure, VariantInfo};
#[darling(attributes(parse), default)]
#[derive(Default, FromVariant)] #[derive(Default, FromVariant)]
#[darling(attributes(parse), default)]
pub struct ParseVariantAttrs { pub struct ParseVariantAttrs {
pub aliases: Option<String>, pub aliases: Option<String>,
pub condition: Option<Path>, pub condition: Option<Path>,
} }
#[darling(attributes(parse), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(parse), default)]
pub struct ParseFieldAttrs { pub struct ParseFieldAttrs {
field_bound: bool, field_bound: bool,
} }

View file

@ -166,22 +166,22 @@ fn derive_struct_fields<'a>(
true true
} }
#[darling(attributes(value_info), default)]
#[derive(Default, FromDeriveInput)] #[derive(Default, FromDeriveInput)]
#[darling(attributes(value_info), default)]
struct ValueInfoInputAttrs { struct ValueInfoInputAttrs {
ty: Option<Ident>, ty: Option<Ident>,
other_values: Option<String>, other_values: Option<String>,
} }
#[darling(attributes(value_info), default)]
#[derive(Default, FromVariant)] #[derive(Default, FromVariant)]
#[darling(attributes(value_info), default)]
struct ValueInfoVariantAttrs { struct ValueInfoVariantAttrs {
starts_with_keyword: bool, starts_with_keyword: bool,
other_values: Option<String>, other_values: Option<String>,
} }
#[darling(attributes(value_info), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(value_info), default)]
struct ValueInfoFieldAttrs { struct ValueInfoFieldAttrs {
other_values: Option<String>, other_values: Option<String>,
} }

View file

@ -195,8 +195,8 @@ pub struct ToValueAttrs {
pub no_field_bound: bool, pub no_field_bound: bool,
} }
#[darling(attributes(compute), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(compute), default)]
struct ComputedValueAttrs { struct ComputedValueAttrs {
field_bound: bool, field_bound: bool,
no_field_bound: bool, no_field_bound: bool,

View file

@ -236,8 +236,8 @@ fn derive_single_field_expr(
expr expr
} }
#[darling(attributes(css), default)]
#[derive(Default, FromDeriveInput)] #[derive(Default, FromDeriveInput)]
#[darling(attributes(css), default)]
pub struct CssInputAttrs { pub struct CssInputAttrs {
pub derive_debug: bool, pub derive_debug: bool,
// Here because structs variants are also their whole type definition. // Here because structs variants are also their whole type definition.
@ -246,8 +246,8 @@ pub struct CssInputAttrs {
pub comma: bool, pub comma: bool,
} }
#[darling(attributes(css), default)]
#[derive(Default, FromVariant)] #[derive(Default, FromVariant)]
#[darling(attributes(css), default)]
pub struct CssVariantAttrs { pub struct CssVariantAttrs {
pub function: Option<Override<String>>, pub function: Option<Override<String>>,
// Here because structs variants are also their whole type definition. // Here because structs variants are also their whole type definition.
@ -258,8 +258,8 @@ pub struct CssVariantAttrs {
pub skip: bool, pub skip: bool,
} }
#[darling(attributes(css), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(css), default)]
pub struct CssFieldAttrs { pub struct CssFieldAttrs {
pub if_empty: Option<String>, pub if_empty: Option<String>,
pub field_bound: bool, pub field_bound: bool,

View file

@ -44,8 +44,8 @@ pub fn derive(input: DeriveInput) -> TokenStream {
) )
} }
#[darling(attributes(resolve), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(resolve), default)]
struct ResolvedValueAttrs { struct ResolvedValueAttrs {
field_bound: bool, field_bound: bool,
no_field_bound: bool, no_field_bound: bool,

View file

@ -65,14 +65,14 @@ pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
} }
} }
#[darling(attributes(shmem), default)]
#[derive(Default, FromDeriveInput)] #[derive(Default, FromDeriveInput)]
#[darling(attributes(shmem), default)]
pub struct ShmemInputAttrs { pub struct ShmemInputAttrs {
pub no_bounds: bool, pub no_bounds: bool,
} }
#[darling(attributes(shmem), default)]
#[derive(Default, FromField)] #[derive(Default, FromField)]
#[darling(attributes(shmem), default)]
pub struct ShmemFieldAttrs { pub struct ShmemFieldAttrs {
pub field_bound: bool, pub field_bound: bool,
} }

View file

@ -138,12 +138,11 @@ pub struct WebDriverSession {
implicit_wait_timeout: u64, implicit_wait_timeout: u64,
page_loading_strategy: String, page_loading_strategy: String,
secure_tls: bool,
strict_file_interactability: bool, strict_file_interactability: bool,
unhandled_prompt_behavior: String, unhandled_prompt_behavior: String,
// https://w3c.github.io/webdriver/#dfn-active-input-sources
active_input_sources: Vec<InputSourceState>,
// https://w3c.github.io/webdriver/#dfn-input-state-table // https://w3c.github.io/webdriver/#dfn-input-state-table
input_state_table: HashMap<String, InputSourceState>, input_state_table: HashMap<String, InputSourceState>,
// https://w3c.github.io/webdriver/#dfn-input-cancel-list // https://w3c.github.io/webdriver/#dfn-input-cancel-list
@ -165,11 +164,9 @@ impl WebDriverSession {
implicit_wait_timeout: 0, implicit_wait_timeout: 0,
page_loading_strategy: "normal".to_string(), page_loading_strategy: "normal".to_string(),
secure_tls: true,
strict_file_interactability: false, strict_file_interactability: false,
unhandled_prompt_behavior: "dismiss and notify".to_string(), unhandled_prompt_behavior: "dismiss and notify".to_string(),
active_input_sources: Vec::new(),
input_state_table: HashMap::new(), input_state_table: HashMap::new(),
input_cancel_list: Vec::new(), input_cancel_list: Vec::new(),
} }
@ -532,8 +529,8 @@ impl Handler {
); );
match processed.get("acceptInsecureCerts") { match processed.get("acceptInsecureCerts") {
Some(accept_insecure_certs) => { Some(_accept_insecure_certs) => {
session.secure_tls = !accept_insecure_certs.as_bool().unwrap() // FIXME do something here?
}, },
None => { None => {
processed.insert( processed.insert(
@ -1374,7 +1371,6 @@ impl Handler {
let session = self.session_mut()?; let session = self.session_mut()?;
session.input_state_table = HashMap::new(); session.input_state_table = HashMap::new();
session.active_input_sources = Vec::new();
Ok(WebDriverResponse::Void) Ok(WebDriverResponse::Void)
} }

View file

@ -174,7 +174,7 @@ pub struct ServoGlue {
// and exit if it is empty afterwards. // and exit if it is empty afterwards.
browsers: Vec<BrowserId>, browsers: Vec<BrowserId>,
events: Vec<WindowEvent>, events: Vec<WindowEvent>,
current_url: Option<ServoUrl>,
context_menu_sender: Option<IpcSender<ContextMenuResult>>, context_menu_sender: Option<IpcSender<ContextMenuResult>>,
} }
@ -306,7 +306,6 @@ pub fn init(
browser_id: None, browser_id: None,
browsers: vec![], browsers: vec![],
events: vec![], events: vec![],
current_url: Some(url.clone()),
context_menu_sender: None, context_menu_sender: None,
}; };
let browser_id = BrowserId::new(); let browser_id = BrowserId::new();
@ -636,7 +635,6 @@ impl ServoGlue {
self.callbacks self.callbacks
.host_callbacks .host_callbacks
.on_url_changed(entries[current].clone().to_string()); .on_url_changed(entries[current].clone().to_string());
self.current_url = Some(entries[current].clone());
}, },
EmbedderMsg::LoadStart => { EmbedderMsg::LoadStart => {
self.callbacks.host_callbacks.on_load_started(); self.callbacks.host_callbacks.on_load_started();

View file

@ -188,7 +188,7 @@ where
Some(ref mut s) => (f)(s), Some(ref mut s) => (f)(s),
None => Err("Servo not available in this thread"), None => Err("Servo not available in this thread"),
}) { }) {
Err(e) => panic!(e), Err(e) => panic!("{}", e),
Ok(r) => r, Ok(r) => r,
} }
} }

View file

@ -42,21 +42,13 @@ pub struct Browser<Window: WindowPortsMethods + ?Sized> {
browsers: Vec<BrowserId>, browsers: Vec<BrowserId>,
title: Option<String>, title: Option<String>,
status: Option<String>,
favicon: Option<ServoUrl>,
loading_state: Option<LoadingState>,
window: Rc<Window>, window: Rc<Window>,
event_queue: Vec<WindowEvent>, event_queue: Vec<WindowEvent>,
clipboard_ctx: Option<ClipboardContext>, clipboard_ctx: Option<ClipboardContext>,
shutdown_requested: bool, shutdown_requested: bool,
} }
enum LoadingState {
Connecting,
Loading,
Loaded,
}
impl<Window> Browser<Window> impl<Window> Browser<Window>
where where
Window: WindowPortsMethods + ?Sized, Window: WindowPortsMethods + ?Sized,
@ -67,9 +59,6 @@ where
current_url: None, current_url: None,
browser_id: None, browser_id: None,
browsers: Vec::new(), browsers: Vec::new(),
status: None,
favicon: None,
loading_state: None,
window: window, window: window,
clipboard_ctx: match ClipboardContext::new() { clipboard_ctx: match ClipboardContext::new() {
Ok(c) => Some(c), Ok(c) => Some(c),
@ -278,8 +267,8 @@ where
pub fn handle_servo_events(&mut self, events: Vec<(Option<BrowserId>, EmbedderMsg)>) { pub fn handle_servo_events(&mut self, events: Vec<(Option<BrowserId>, EmbedderMsg)>) {
for (browser_id, msg) in events { for (browser_id, msg) in events {
match msg { match msg {
EmbedderMsg::Status(status) => { EmbedderMsg::Status(_status) => {
self.status = status; // FIXME: surface this status string in the UI somehow
}, },
EmbedderMsg::ChangePageTitle(title) => { EmbedderMsg::ChangePageTitle(title) => {
self.title = title; self.title = title;
@ -440,11 +429,11 @@ where
EmbedderMsg::SetCursor(cursor) => { EmbedderMsg::SetCursor(cursor) => {
self.window.set_cursor(cursor); self.window.set_cursor(cursor);
}, },
EmbedderMsg::NewFavicon(url) => { EmbedderMsg::NewFavicon(_url) => {
self.favicon = Some(url); // FIXME: show favicons in the UI somehow
}, },
EmbedderMsg::HeadParsed => { EmbedderMsg::HeadParsed => {
self.loading_state = Some(LoadingState::Loading); // FIXME: surface the loading state in the UI somehow
}, },
EmbedderMsg::HistoryChanged(urls, current) => { EmbedderMsg::HistoryChanged(urls, current) => {
self.current_url = Some(urls[current].clone()); self.current_url = Some(urls[current].clone());
@ -453,10 +442,10 @@ where
self.window.set_fullscreen(state); self.window.set_fullscreen(state);
}, },
EmbedderMsg::LoadStart => { EmbedderMsg::LoadStart => {
self.loading_state = Some(LoadingState::Connecting); // FIXME: surface the loading state in the UI somehow
}, },
EmbedderMsg::LoadComplete => { EmbedderMsg::LoadComplete => {
self.loading_state = Some(LoadingState::Loaded); // FIXME: surface the loading state in the UI somehow
}, },
EmbedderMsg::CloseBrowser => { EmbedderMsg::CloseBrowser => {
// TODO: close the appropriate "tab". // TODO: close the appropriate "tab".