servo: Merge #18126 - geckolib: Fix some warnings (treated as error) new in Rust Nigthly (from servo:glow-fox); r=emilio

Source-Repo: https://github.com/servo/servo
Source-Revision: cc86ca2bcdec5e89ee5279085ea38db63ef41af9

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 0586dbc81f1411c89821605a6dae4ebd0af8f0d5
This commit is contained in:
Simon Sapin 2017-08-17 11:05:32 -05:00
parent ac9d5325f1
commit f0acf27d18
6 changed files with 21 additions and 21 deletions

View File

@ -352,7 +352,7 @@ impl nsStyleImage {
// NB: stops are guaranteed to be none in the gecko side by
// default.
let mut gecko_stop = unsafe {
let gecko_stop = unsafe {
&mut (*gecko_gradient).mStops[index]
};
let mut coord = nsStyleCoord::null();

View File

@ -413,7 +413,7 @@ impl<'lb> GeckoXBLBinding<'lb> {
}
}
fn each_xbl_stylist<F>(self, mut f: &mut F)
fn each_xbl_stylist<F>(self, f: &mut F)
where
F: FnMut(&Stylist),
{

View File

@ -90,7 +90,7 @@ impl<T> nsTArray<T> {
// this can leak
debug_assert!(len >= self.len() as u32);
self.ensure_capacity(len as usize);
let mut header = self.header_mut();
let header = self.header_mut();
header.mLength = len;
}
@ -99,7 +99,7 @@ impl<T> nsTArray<T> {
/// This will not leak since it only works on POD types (and thus doesn't assert)
pub unsafe fn set_len_pod(&mut self, len: u32) where T: Copy {
self.ensure_capacity(len as usize);
let mut header = unsafe { self.header_mut() };
let header = unsafe { self.header_mut() };
header.mLength = len;
}
}

View File

@ -4432,14 +4432,14 @@ fn static_assert() {
fn init_shadow(filter: &mut nsStyleFilter) -> &mut nsCSSShadowArray {
unsafe {
let ref mut union = filter.__bindgen_anon_1;
let mut shadow_array: &mut *mut nsCSSShadowArray = union.mDropShadow.as_mut();
let shadow_array: &mut *mut nsCSSShadowArray = union.mDropShadow.as_mut();
*shadow_array = Gecko_NewCSSShadowArray(1);
&mut **shadow_array
}
}
let mut gecko_shadow = init_shadow(gecko_filter);
let gecko_shadow = init_shadow(gecko_filter);
gecko_shadow.mArray[0].set_from_simple_shadow(shadow);
},
Url(ref url) => {
@ -4988,14 +4988,14 @@ fn static_assert() {
unsafe {
// We have to be very careful to avoid a copy here!
let ref mut union = ${ident}.__bindgen_anon_1;
let mut shape: &mut *mut StyleBasicShape = union.mBasicShape.as_mut();
let shape: &mut *mut StyleBasicShape = union.mBasicShape.as_mut();
*shape = Gecko_NewBasicShape(ty);
&mut **shape
}
}
match servo_shape {
BasicShape::Inset(inset) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Inset);
let shape = init_shape(${ident}, StyleBasicShapeType::Inset);
unsafe { shape.mCoordinates.set_len(4) };
// set_len() can't call constructors, so the coordinates
@ -5017,7 +5017,7 @@ fn static_assert() {
set_corners_from_radius(inset.round, &mut shape.mRadius);
}
BasicShape::Circle(circ) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Circle);
let shape = init_shape(${ident}, StyleBasicShapeType::Circle);
unsafe { shape.mCoordinates.set_len(1) };
shape.mCoordinates[0].leaky_set_null();
circ.radius.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@ -5025,7 +5025,7 @@ fn static_assert() {
shape.mPosition = circ.position.into();
}
BasicShape::Ellipse(el) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Ellipse);
let shape = init_shape(${ident}, StyleBasicShapeType::Ellipse);
unsafe { shape.mCoordinates.set_len(2) };
shape.mCoordinates[0].leaky_set_null();
el.semiaxis_x.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@ -5035,7 +5035,7 @@ fn static_assert() {
shape.mPosition = el.position.into();
}
BasicShape::Polygon(poly) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Polygon);
let shape = init_shape(${ident}, StyleBasicShapeType::Polygon);
unsafe {
shape.mCoordinates.set_len(poly.coordinates.len() as u32 * 2);
}
@ -5150,7 +5150,7 @@ clip-path
unsafe {
bindings::Gecko_nsStyleSVG_SetDashArrayLength(&mut self.gecko, v.len() as u32);
}
for (mut gecko, servo) in self.gecko.mStrokeDasharray.iter_mut().zip(v) {
for (gecko, servo) in self.gecko.mStrokeDasharray.iter_mut().zip(v) {
match servo {
Either::First(number) => gecko.set_value(CoordDataValue::Factor(number.into())),
Either::Second(lop) => gecko.set(lop),
@ -5216,7 +5216,7 @@ clip-path
}
self.gecko.mContextPropsBits = 0;
for (mut gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
for (gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
if servo.0 == atom!("fill") {
self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL as u8;
} else if servo.0 == atom!("stroke") {

View File

@ -198,7 +198,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
// When 'contain: paint', update overflow from 'visible' to 'clip'.
if self.style.get_box().clone_contain().contains(contain::PAINT) {
if self.style.get_box().clone_overflow_x() == overflow::visible {
let mut box_style = self.style.mutate_box();
let box_style = self.style.mutate_box();
box_style.set_overflow_x(overflow::_moz_hidden_unscrollable);
box_style.set_overflow_y(overflow::_moz_hidden_unscrollable);
}
@ -213,7 +213,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
use properties::longhands::font_style::computed_value::T as font_style;
use properties::longhands::font_weight::computed_value::T as font_weight;
if self.style.get_font().clone__moz_math_variant() != moz_math_variant::none {
let mut font_style = self.style.mutate_font();
let font_style = self.style.mutate_font();
// Sadly we don't have a nice name for the computed value
// of "font-weight: normal".
font_style.set_font_weight(font_weight::normal());

View File

@ -888,7 +888,7 @@ pub extern "C" fn Servo_StyleSet_AppendStyleSheet(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let mut data = &mut *data;
let data = &mut *data;
let guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.append_stylesheet(&data.stylist, sheet, &guard);
@ -937,7 +937,7 @@ pub extern "C" fn Servo_StyleSet_PrependStyleSheet(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let mut data = &mut *data;
let data = &mut *data;
let guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.prepend_stylesheet(&data.stylist, sheet, &guard);
@ -951,7 +951,7 @@ pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let mut data = &mut *data;
let data = &mut *data;
let guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.insert_stylesheet_before(
@ -969,7 +969,7 @@ pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
let mut data = &mut *data;
let data = &mut *data;
let guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.remove_stylesheet(&data.stylist, sheet, &guard);
@ -1359,7 +1359,7 @@ pub extern "C" fn Servo_StyleRule_GetSpecificityAtIndex(
specificity: *mut u64
) {
read_locked_arc(rule, |rule: &StyleRule| {
let mut specificity = unsafe { specificity.as_mut().unwrap() };
let specificity = unsafe { specificity.as_mut().unwrap() };
let index = index as usize;
if index >= rule.selectors.0.len() {
*specificity = 0;
@ -2831,7 +2831,7 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed,
pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
was_restyled: *mut bool) -> u32
{
let mut was_restyled = unsafe { was_restyled.as_mut().unwrap() };
let was_restyled = unsafe { was_restyled.as_mut().unwrap() };
let element = GeckoElement(element);
let damage = match element.mutate_data() {