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"),
}
},
Err(e) => panic!(e),
Err(e) => panic!("{}", e),
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -157,7 +157,7 @@ impl TableWrapperFlow {
.zip(guesses.iter())
{
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
}
@ -382,7 +382,7 @@ impl Flow for TableWrapperFlow {
.map(
|column_intrinsic_inline_size| IntermediateColumnInlineSize {
size: column_intrinsic_inline_size.minimum_length,
percentage: column_intrinsic_inline_size.percentage,
// percentage: column_intrinsic_inline_size.percentage,
},
)
.collect::<Vec<_>>();
@ -822,7 +822,9 @@ impl ExcessInlineSizeDistributionInfo {
/// An intermediate column size assignment.
struct IntermediateColumnInlineSize {
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`.

View file

@ -189,9 +189,6 @@ pub struct LayoutThread {
/// The root of the flow tree.
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
epoch: Cell<Epoch>,
@ -543,7 +540,6 @@ impl LayoutThread {
generation: Cell::new(0),
outstanding_web_fonts: Arc::new(AtomicUsize::new(0)),
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: Cell::new(Epoch(1)),
viewport_size: Size2D::new(Au(0), Au(0)),
@ -1261,7 +1257,6 @@ impl LayoutThread {
// Calculate the actual viewport as per DEVICE-ADAPT § 6
// If the entire flow tree is invalid, then it will be reflowed anyhow.
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 ua_stylesheets = &*UA_STYLESHEETS;

View file

@ -167,9 +167,6 @@ pub struct LayoutThread {
/// The fragment tree.
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
epoch: Cell<Epoch>,
@ -510,7 +507,6 @@ impl LayoutThread {
outstanding_web_fonts: Arc::new(AtomicUsize::new(0)),
box_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: Cell::new(Epoch(1)),
viewport_size: Size2D::new(Au(0), Au(0)),
@ -947,7 +943,6 @@ impl LayoutThread {
// Calculate the actual viewport as per DEVICE-ADAPT § 6
// If the entire flow tree is invalid, then it will be reflowed anyhow.
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 ua_stylesheets = &*UA_STYLESHEETS;

View file

@ -44,7 +44,7 @@ fn assert_parse(
filtered: FilteredMetadata::Basic(m),
..
}) => m,
result => panic!(result),
result => panic!("{:?}", result),
};
assert_eq!(metadata.content_type.map(Serde::into_inner), content_type);
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.redirected = response.actual_response().url_list.len() > 1;
metadata
};
}
if let Some(error) = self.get_network_error() {
return Err(error.clone());

View file

@ -101,10 +101,7 @@ impl Profiler {
let name_clone = name.clone();
match self.reporters.insert(name, reporter) {
None => true,
Some(_) => panic!(format!(
"RegisterReporter: '{}' name is already in use",
name_clone
)),
Some(_) => panic!("RegisterReporter: '{}' name is already in use", name_clone),
}
},
@ -112,7 +109,7 @@ impl Profiler {
// Panic if it hasn't previously been registered.
match self.reporters.remove(&name) {
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};
/// A CSS url() value for gecko.
#[css(function = "url")]
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
#[css(function = "url")]
#[repr(C)]
pub struct CssUrl(pub Arc<CssUrlData>);

View file

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

View file

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

View file

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

View file

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

View file

@ -116,7 +116,7 @@ impl<'a> FontSettingTagIter<'a> {
let mut sorted_tags = Vec::from_iter(tags.iter());
sorted_tags.sort_by_key(|k| k.tag.0);
sorted_tags
};
}
Ok(FontSettingTagIter {
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.
#[allow(missing_docs)]
#[animation(no_bound(U))]
#[derive(
Animate,
Clone,
@ -106,6 +105,7 @@ impl Default for ShapeBox {
ToResolvedValue,
ToShmem,
)]
#[animation(no_bound(U))]
#[repr(u8)]
pub enum GenericClipPath<BasicShape, U> {
#[animation(error)]
@ -126,7 +126,6 @@ pub use self::GenericClipPath as ClipPath;
/// A value for the `shape-outside` property.
#[allow(missing_docs)]
#[animation(no_bound(I))]
#[derive(
Animate,
Clone,
@ -141,6 +140,7 @@ pub use self::GenericClipPath as ClipPath;
ToResolvedValue,
ToShmem,
)]
#[animation(no_bound(I))]
#[repr(u8)]
pub enum GenericShapeOutside<BasicShape, I> {
#[animation(error)]
@ -193,7 +193,6 @@ pub use self::GenericBasicShape as BasicShape;
/// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
#[allow(missing_docs)]
#[css(function = "inset")]
#[derive(
Animate,
Clone,
@ -207,6 +206,7 @@ pub use self::GenericBasicShape as BasicShape;
ToResolvedValue,
ToShmem,
)]
#[css(function = "inset")]
#[repr(C)]
pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
pub rect: Rect<LengthPercentage>,
@ -216,7 +216,6 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
#[allow(missing_docs)]
#[css(function)]
#[derive(
Animate,
Clone,
@ -231,6 +230,7 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
ToResolvedValue,
ToShmem,
)]
#[css(function)]
#[repr(C)]
pub struct Circle<H, V, NonNegativeLengthPercentage> {
pub position: GenericPosition<H, V>,
@ -239,7 +239,6 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
#[allow(missing_docs)]
#[css(function)]
#[derive(
Animate,
Clone,
@ -254,6 +253,7 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
ToResolvedValue,
ToShmem,
)]
#[css(function)]
#[repr(C)]
pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
pub position: GenericPosition<H, V>,
@ -293,7 +293,6 @@ pub use self::GenericShapeRadius as ShapeRadius;
/// A generic type for representing the `polygon()` function
///
/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
#[css(comma, function = "polygon")]
#[derive(
Clone,
Debug,
@ -306,6 +305,7 @@ pub use self::GenericShapeRadius as ShapeRadius;
ToResolvedValue,
ToShmem,
)]
#[css(comma, function = "polygon")]
#[repr(C)]
pub struct GenericPolygon<LengthPercentage> {
/// The filling rule for a polygon.
@ -364,7 +364,6 @@ pub enum FillRule {
/// The path function defined in css-shape-2.
///
/// https://drafts.csswg.org/css-shapes-2/#funcdef-path
#[css(comma)]
#[derive(
Animate,
Clone,
@ -379,6 +378,7 @@ pub enum FillRule {
ToResolvedValue,
ToShmem,
)]
#[css(comma)]
#[repr(C)]
pub struct 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`.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[animation(no_bound(U))]
#[derive(
Clone,
ComputeSquaredDistance,
@ -49,6 +48,7 @@ pub use self::GenericBoxShadow as BoxShadow;
ToResolvedValue,
ToShmem,
)]
#[animation(no_bound(U))]
#[repr(C, u8)]
pub enum GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U> {
/// `blur(<length>)`

View file

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

View file

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

View file

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

View file

@ -47,7 +47,6 @@ pub use self::GenericMatrix as Matrix;
#[allow(missing_docs)]
#[cfg_attr(rustfmt, rustfmt_skip)]
#[css(comma, function = "matrix3d")]
#[derive(
Clone,
Copy,
@ -62,6 +61,7 @@ pub use self::GenericMatrix as Matrix;
ToResolvedValue,
ToShmem,
)]
#[css(comma, function = "matrix3d")]
#[repr(C)]
pub struct GenericMatrix3D<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)]
#[darling(attributes(animation), default)]
pub struct AnimationInputAttrs {
pub no_bound: Option<PathList>,
}
#[darling(attributes(animation), default)]
#[derive(Default, FromVariant)]
#[darling(attributes(animation), default)]
pub struct AnimationVariantAttrs {
pub error: bool,
// Only here because of structs, where the struct definition acts as a
@ -127,8 +127,8 @@ pub struct AnimationVariantAttrs {
pub no_bound: Option<PathList>,
}
#[darling(attributes(animation), default)]
#[derive(Default, FromField)]
#[darling(attributes(animation), default)]
pub struct AnimationFieldAttrs {
pub constant: bool,
pub field_bound: bool,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -44,8 +44,8 @@ pub fn derive(input: DeriveInput) -> TokenStream {
)
}
#[darling(attributes(resolve), default)]
#[derive(Default, FromField)]
#[darling(attributes(resolve), default)]
struct ResolvedValueAttrs {
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)]
#[darling(attributes(shmem), default)]
pub struct ShmemInputAttrs {
pub no_bounds: bool,
}
#[darling(attributes(shmem), default)]
#[derive(Default, FromField)]
#[darling(attributes(shmem), default)]
pub struct ShmemFieldAttrs {
pub field_bound: bool,
}

View file

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

View file

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

View file

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

View file

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