Auto merge of #18126 - servo:glow-fox, r=emilio

geckolib: Fix some warnings (treated as error) new in Rust Nigthly

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18126)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-17 11:05:32 -05:00 committed by GitHub
commit cc86ca2bcd
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 // NB: stops are guaranteed to be none in the gecko side by
// default. // default.
let mut gecko_stop = unsafe { let gecko_stop = unsafe {
&mut (*gecko_gradient).mStops[index] &mut (*gecko_gradient).mStops[index]
}; };
let mut coord = nsStyleCoord::null(); 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 where
F: FnMut(&Stylist), F: FnMut(&Stylist),
{ {

View file

@ -90,7 +90,7 @@ impl<T> nsTArray<T> {
// this can leak // this can leak
debug_assert!(len >= self.len() as u32); debug_assert!(len >= self.len() as u32);
self.ensure_capacity(len as usize); self.ensure_capacity(len as usize);
let mut header = self.header_mut(); let header = self.header_mut();
header.mLength = len; 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) /// 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 { pub unsafe fn set_len_pod(&mut self, len: u32) where T: Copy {
self.ensure_capacity(len as usize); self.ensure_capacity(len as usize);
let mut header = unsafe { self.header_mut() }; let header = unsafe { self.header_mut() };
header.mLength = len; header.mLength = len;
} }
} }

View file

@ -4432,14 +4432,14 @@ fn static_assert() {
fn init_shadow(filter: &mut nsStyleFilter) -> &mut nsCSSShadowArray { fn init_shadow(filter: &mut nsStyleFilter) -> &mut nsCSSShadowArray {
unsafe { unsafe {
let ref mut union = filter.__bindgen_anon_1; 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); *shadow_array = Gecko_NewCSSShadowArray(1);
&mut **shadow_array &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); gecko_shadow.mArray[0].set_from_simple_shadow(shadow);
}, },
Url(ref url) => { Url(ref url) => {
@ -4988,14 +4988,14 @@ fn static_assert() {
unsafe { unsafe {
// We have to be very careful to avoid a copy here! // We have to be very careful to avoid a copy here!
let ref mut union = ${ident}.__bindgen_anon_1; 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); *shape = Gecko_NewBasicShape(ty);
&mut **shape &mut **shape
} }
} }
match servo_shape { match servo_shape {
BasicShape::Inset(inset) => { BasicShape::Inset(inset) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Inset); let shape = init_shape(${ident}, StyleBasicShapeType::Inset);
unsafe { shape.mCoordinates.set_len(4) }; unsafe { shape.mCoordinates.set_len(4) };
// set_len() can't call constructors, so the coordinates // 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); set_corners_from_radius(inset.round, &mut shape.mRadius);
} }
BasicShape::Circle(circ) => { BasicShape::Circle(circ) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Circle); let shape = init_shape(${ident}, StyleBasicShapeType::Circle);
unsafe { shape.mCoordinates.set_len(1) }; unsafe { shape.mCoordinates.set_len(1) };
shape.mCoordinates[0].leaky_set_null(); shape.mCoordinates[0].leaky_set_null();
circ.radius.to_gecko_style_coord(&mut shape.mCoordinates[0]); circ.radius.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@ -5025,7 +5025,7 @@ fn static_assert() {
shape.mPosition = circ.position.into(); shape.mPosition = circ.position.into();
} }
BasicShape::Ellipse(el) => { BasicShape::Ellipse(el) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Ellipse); let shape = init_shape(${ident}, StyleBasicShapeType::Ellipse);
unsafe { shape.mCoordinates.set_len(2) }; unsafe { shape.mCoordinates.set_len(2) };
shape.mCoordinates[0].leaky_set_null(); shape.mCoordinates[0].leaky_set_null();
el.semiaxis_x.to_gecko_style_coord(&mut shape.mCoordinates[0]); el.semiaxis_x.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@ -5035,7 +5035,7 @@ fn static_assert() {
shape.mPosition = el.position.into(); shape.mPosition = el.position.into();
} }
BasicShape::Polygon(poly) => { BasicShape::Polygon(poly) => {
let mut shape = init_shape(${ident}, StyleBasicShapeType::Polygon); let shape = init_shape(${ident}, StyleBasicShapeType::Polygon);
unsafe { unsafe {
shape.mCoordinates.set_len(poly.coordinates.len() as u32 * 2); shape.mCoordinates.set_len(poly.coordinates.len() as u32 * 2);
} }
@ -5150,7 +5150,7 @@ clip-path
unsafe { unsafe {
bindings::Gecko_nsStyleSVG_SetDashArrayLength(&mut self.gecko, v.len() as u32); 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 { match servo {
Either::First(number) => gecko.set_value(CoordDataValue::Factor(number.into())), Either::First(number) => gecko.set_value(CoordDataValue::Factor(number.into())),
Either::Second(lop) => gecko.set(lop), Either::Second(lop) => gecko.set(lop),
@ -5216,7 +5216,7 @@ clip-path
} }
self.gecko.mContextPropsBits = 0; 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") { if servo.0 == atom!("fill") {
self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL as u8; self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL as u8;
} else if servo.0 == atom!("stroke") { } 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'. // 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_contain().contains(contain::PAINT) {
if self.style.get_box().clone_overflow_x() == overflow::visible { 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_x(overflow::_moz_hidden_unscrollable);
box_style.set_overflow_y(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_style::computed_value::T as font_style;
use properties::longhands::font_weight::computed_value::T as font_weight; use properties::longhands::font_weight::computed_value::T as font_weight;
if self.style.get_font().clone__moz_math_variant() != moz_math_variant::none { 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 // Sadly we don't have a nice name for the computed value
// of "font-weight: normal". // of "font-weight: normal".
font_style.set_font_weight(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 global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut(); 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 guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) }; let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.append_stylesheet(&data.stylist, sheet, &guard); 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 global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut(); 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 guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) }; let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.prepend_stylesheet(&data.stylist, sheet, &guard); 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 global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut(); 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 guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) }; let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.insert_stylesheet_before( data.stylesheets.insert_stylesheet_before(
@ -969,7 +969,7 @@ pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
) { ) {
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut(); 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 guard = global_style_data.shared_lock.read();
let sheet = unsafe { GeckoStyleSheet::new(sheet) }; let sheet = unsafe { GeckoStyleSheet::new(sheet) };
data.stylesheets.remove_stylesheet(&data.stylist, sheet, &guard); data.stylesheets.remove_stylesheet(&data.stylist, sheet, &guard);
@ -1359,7 +1359,7 @@ pub extern "C" fn Servo_StyleRule_GetSpecificityAtIndex(
specificity: *mut u64 specificity: *mut u64
) { ) {
read_locked_arc(rule, |rule: &StyleRule| { 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; let index = index as usize;
if index >= rule.selectors.0.len() { if index >= rule.selectors.0.len() {
*specificity = 0; *specificity = 0;
@ -2831,7 +2831,7 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed,
pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed, pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
was_restyled: *mut bool) -> u32 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 element = GeckoElement(element);
let damage = match element.mutate_data() { let damage = match element.mutate_data() {