cargo fix --edition

This commit is contained in:
Simon Sapin 2018-11-01 14:09:54 +01:00
parent e1fcffb336
commit a15d33a10e
197 changed files with 1414 additions and 1380 deletions

View file

@ -5,14 +5,14 @@
//! CSS handling for the [`basic-shape`](https://drafts.csswg.org/css-shapes/#typedef-basic-shape)
//! types that are generic over their `ToCss` implementations.
use crate::values::animated::{Animate, Procedure, ToAnimatedZero};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::values::generics::border::BorderRadius;
use crate::values::generics::position::Position;
use crate::values::generics::rect::Rect;
use crate::values::specified::SVGPathData;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
use values::animated::{Animate, Procedure, ToAnimatedZero};
use values::distance::{ComputeSquaredDistance, SquaredDistance};
use values::generics::border::BorderRadius;
use values::generics::position::Position;
use values::generics::rect::Rect;
use values::specified::SVGPathData;
/// A clipping shape, for `clip-path`.
pub type ClippingShape<BasicShape, Url> = ShapeSource<BasicShape, GeometryBox, Url>;

View file

@ -4,10 +4,10 @@
//! Generic types for CSS values related to borders.
use crate::values::generics::rect::Rect;
use crate::values::generics::size::Size;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
use values::generics::rect::Rect;
use values::generics::size::Size;
/// A generic value for a single side of a `border-image-width` property.
#[derive(

View file

@ -4,7 +4,7 @@
//! Generic types for box properties.
use values::animated::ToAnimatedZero;
use crate::values::animated::ToAnimatedZero;
/// A generic value for the `vertical-align` property.
#[derive(

View file

@ -5,13 +5,13 @@
//! Generic types for counters-related CSS values.
#[cfg(feature = "servo")]
use computed_values::list_style_type::T as ListStyleType;
use crate::computed_values::list_style_type::T as ListStyleType;
use crate::values::CustomIdent;
use std::ops::Deref;
#[cfg(feature = "gecko")]
use values::generics::CounterStyleOrNone;
#[cfg(feature = "gecko")]
use values::specified::Attr;
use values::CustomIdent;
/// A name / value pair for counters.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]

View file

@ -5,8 +5,8 @@
//! Generic types for CSS Easing Functions.
//! https://drafts.csswg.org/css-easing/#timing-functions
use parser::ParserContext;
use values::CSSFloat;
use crate::parser::ParserContext;
use crate::values::CSSFloat;
/// A generic easing function.
#[derive(

View file

@ -6,9 +6,9 @@
use app_units::Au;
use byteorder::{BigEndian, ReadBytesExt};
use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use num_traits::One;
use parser::{Parse, ParserContext};
use std::fmt::{self, Write};
use std::io::Cursor;
use style_traits::{CssWriter, KeywordsCollectFn, ParseError};
@ -85,7 +85,7 @@ impl<T: Parse> Parse for FontSettings<T> {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if input.try(|i| i.expect_ident_matching("normal")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("normal")).is_ok() {
return Ok(Self::normal());
}

View file

@ -5,15 +5,15 @@
//! Generic types for the handling of
//! [grids](https://drafts.csswg.org/css-grid/).
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified;
use crate::values::specified::grid::parse_line_names;
use crate::values::{CSSFloat, CustomIdent};
use cssparser::Parser;
use parser::{Parse, ParserContext};
use std::fmt::{self, Write};
use std::{mem, usize};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use values::computed::{Context, ToComputedValue};
use values::specified;
use values::specified::grid::parse_line_names;
use values::{CSSFloat, CustomIdent};
/// A `<grid-line>` type.
///
@ -86,7 +86,7 @@ impl Parse for GridLine<specified::Integer> {
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
let mut grid_line = Self::auto();
if input.try(|i| i.expect_ident_matching("auto")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("auto")).is_ok() {
return Ok(grid_line);
}
@ -99,7 +99,7 @@ impl Parse for GridLine<specified::Integer> {
for _ in 0..3 {
// Maximum possible entities for <grid-line>
let location = input.current_source_location();
if input.try(|i| i.expect_ident_matching("span")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("span")).is_ok() {
if grid_line.is_span {
return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
@ -109,14 +109,14 @@ impl Parse for GridLine<specified::Integer> {
}
grid_line.is_span = true;
} else if let Ok(i) = input.try(|i| specified::Integer::parse(context, i)) {
} else if let Ok(i) = input.r#try(|i| specified::Integer::parse(context, i)) {
// FIXME(emilio): Probably shouldn't reject if it's calc()...
if i.value() == 0 || val_before_span || grid_line.line_num.is_some() {
return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
grid_line.line_num = Some(i);
} else if let Ok(name) = input.try(|i| i.expect_ident_cloned()) {
} else if let Ok(name) = input.r#try(|i| i.expect_ident_cloned()) {
if val_before_span || grid_line.ident.is_some() {
return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
@ -375,7 +375,7 @@ impl Parse for RepeatCount<specified::Integer> {
) -> Result<Self, ParseError<'i>> {
// Maximum number of repeat is 10000. The greater numbers should be clamped.
const MAX_LINE: i32 = 10000;
if let Ok(mut i) = input.try(|i| specified::Integer::parse_positive(context, i)) {
if let Ok(mut i) = input.r#try(|i| specified::Integer::parse_positive(context, i)) {
if i.value() > MAX_LINE {
i = specified::Integer::new(MAX_LINE);
}
@ -605,14 +605,14 @@ impl Parse for LineNameList {
let mut fill_idx = None;
loop {
let repeat_parse_result = input.try(|input| {
let repeat_parse_result = input.r#try(|input| {
input.expect_function_matching("repeat")?;
input.parse_nested_block(|input| {
let count = RepeatCount::parse(context, input)?;
input.expect_comma()?;
let mut names_list = vec![];
names_list.push(parse_line_names(input)?); // there should be at least one
while let Ok(names) = input.try(parse_line_names) {
while let Ok(names) = input.r#try(parse_line_names) {
names_list.push(names);
}
@ -643,7 +643,7 @@ impl Parse for LineNameList {
},
_ => return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
}
} else if let Ok(names) = input.try(parse_line_names) {
} else if let Ok(names) = input.r#try(parse_line_names) {
line_names.push(names);
} else {
break;

View file

@ -6,12 +6,12 @@
//!
//! [images]: https://drafts.csswg.org/css-images/#image-values
use custom_properties;
use crate::custom_properties;
use crate::values::serialize_atom_identifier;
use crate::Atom;
use servo_arc::Arc;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
use values::serialize_atom_identifier;
use Atom;
/// An [image].
///

View file

@ -4,7 +4,7 @@
//! Generic types for CSS values related to length.
use values::computed::ExtremumLength;
use crate::values::computed::ExtremumLength;
/// A generic value for the `width`, `height`, `min-width`, or `min-height` property.
///

View file

@ -6,9 +6,9 @@
//! for both specified and computed values.
use super::CustomIdent;
use counter_style::{parse_counter_style_name, Symbols};
use crate::counter_style::{parse_counter_style_name, Symbols};
use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use parser::{Parse, ParserContext};
use style_traits::{KeywordsCollectFn, ParseError};
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind};
@ -111,16 +111,19 @@ impl Parse for CounterStyleOrNone {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if let Ok(name) = input.try(|i| parse_counter_style_name(i)) {
if let Ok(name) = input.r#try(|i| parse_counter_style_name(i)) {
return Ok(CounterStyleOrNone::Name(name));
}
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("none")).is_ok() {
return Ok(CounterStyleOrNone::None);
}
if input.try(|i| i.expect_function_matching("symbols")).is_ok() {
if input
.r#try(|i| i.expect_function_matching("symbols"))
.is_ok()
{
return input.parse_nested_block(|input| {
let symbols_type = input
.try(|i| SymbolsType::parse(i))
.r#try(|i| SymbolsType::parse(i))
.unwrap_or(SymbolsType::Symbolic);
let symbols = Symbols::parse(context, input)?;
// There must be at least two symbols for alphabetic or

View file

@ -4,8 +4,8 @@
//! Generic types for CSS values that are composed of four sides.
use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use parser::{Parse, ParserContext};
use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, ToCss};
@ -50,7 +50,7 @@ where
Parse: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result<T, ParseError<'i>>,
{
let first = parse(context, input)?;
let second = if let Ok(second) = input.try(|i| parse(context, i)) {
let second = if let Ok(second) = input.r#try(|i| parse(context, i)) {
second
} else {
// <first>
@ -61,13 +61,13 @@ where
first,
));
};
let third = if let Ok(third) = input.try(|i| parse(context, i)) {
let third = if let Ok(third) = input.r#try(|i| parse(context, i)) {
third
} else {
// <first> <second>
return Ok(Self::new(first.clone(), second.clone(), first, second));
};
let fourth = if let Ok(fourth) = input.try(|i| parse(context, i)) {
let fourth = if let Ok(fourth) = input.r#try(|i| parse(context, i)) {
fourth
} else {
// <first> <second> <third>

View file

@ -4,12 +4,12 @@
//! Generic type for CSS properties that are composed by two dimensions.
use crate::parser::ParserContext;
use crate::values::animated::ToAnimatedValue;
use cssparser::Parser;
use euclid::Size2D;
use parser::ParserContext;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, SpecifiedValueInfo, ToCss};
use values::animated::ToAnimatedValue;
/// A generic size, for `border-*-radius` longhand properties, or
/// `border-spacing`.
@ -55,7 +55,7 @@ impl<L> Size<L> {
{
let first = parse_one(context, input)?;
let second = input
.try(|i| parse_one(context, i))
.r#try(|i| parse_one(context, i))
.unwrap_or_else(|_| first.clone());
Ok(Self::new(first, second))
}

View file

@ -4,10 +4,10 @@
//! Generic types for CSS values in SVG
use crate::parser::{Parse, ParserContext};
use crate::values::{Either, None_};
use cssparser::Parser;
use parser::{Parse, ParserContext};
use style_traits::{ParseError, StyleParseErrorKind};
use values::{Either, None_};
/// An SVG paint value
///
@ -84,10 +84,10 @@ fn parse_fallback<'i, 't, ColorType: Parse>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Option<Either<ColorType, None_>> {
if input.try(|i| i.expect_ident_matching("none")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("none")).is_ok() {
Some(Either::Second(None_))
} else {
if let Ok(color) = input.try(|i| ColorType::parse(context, i)) {
if let Ok(color) = input.r#try(|i| ColorType::parse(context, i)) {
Some(Either::First(color))
} else {
None
@ -100,12 +100,12 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if let Ok(url) = input.try(|i| UrlPaintServer::parse(context, i)) {
if let Ok(url) = input.r#try(|i| UrlPaintServer::parse(context, i)) {
Ok(SVGPaint {
kind: SVGPaintKind::PaintServer(url),
fallback: parse_fallback(context, input),
})
} else if let Ok(kind) = input.try(SVGPaintKind::parse_ident) {
} else if let Ok(kind) = input.r#try(SVGPaintKind::parse_ident) {
if let SVGPaintKind::None = kind {
Ok(SVGPaint {
kind: kind,
@ -117,7 +117,7 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
fallback: parse_fallback(context, input),
})
}
} else if let Ok(color) = input.try(|i| ColorType::parse(context, i)) {
} else if let Ok(color) = input.r#try(|i| ColorType::parse(context, i)) {
Ok(SVGPaint {
kind: SVGPaintKind::Color(color),
fallback: None,
@ -158,7 +158,7 @@ impl<LengthOrPercentageType: Parse, NumberType: Parse> Parse
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if let Ok(num) = input.try(|i| NumberType::parse(context, i)) {
if let Ok(num) = input.r#try(|i| NumberType::parse(context, i)) {
return Ok(SvgLengthOrPercentageOrNumber::Number(num));
}

View file

@ -5,11 +5,11 @@
//! Generic types for text properties.
use app_units::Au;
use crate::parser::ParserContext;
use crate::values::animated::{Animate, Procedure, ToAnimatedZero};
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use cssparser::Parser;
use parser::ParserContext;
use style_traits::ParseError;
use values::animated::{Animate, Procedure, ToAnimatedZero};
use values::distance::{ComputeSquaredDistance, SquaredDistance};
/// A generic value for the `initial-letter` property.
#[derive(
@ -58,7 +58,7 @@ impl<Value> Spacing<Value> {
where
F: FnOnce(&ParserContext, &mut Parser<'i, 't>) -> Result<Value, ParseError<'i>>,
{
if input.try(|i| i.expect_ident_matching("normal")).is_ok() {
if input.r#try(|i| i.expect_ident_matching("normal")).is_ok() {
return Ok(Spacing::Normal);
}
parse(context, input).map(Spacing::Value)

View file

@ -5,16 +5,16 @@
//! Generic types for CSS values that are related to transformations.
use app_units::Au;
use crate::values::computed::length::Length as ComputedLength;
use crate::values::computed::length::LengthOrPercentage as ComputedLengthOrPercentage;
use crate::values::specified::angle::Angle as SpecifiedAngle;
use crate::values::specified::length::Length as SpecifiedLength;
use crate::values::specified::length::LengthOrPercentage as SpecifiedLengthOrPercentage;
use crate::values::{computed, CSSFloat};
use euclid::{self, Rect, Transform3D};
use num_traits::Zero;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
use values::computed::length::Length as ComputedLength;
use values::computed::length::LengthOrPercentage as ComputedLengthOrPercentage;
use values::specified::angle::Angle as SpecifiedAngle;
use values::specified::length::Length as SpecifiedLength;
use values::specified::length::LengthOrPercentage as SpecifiedLengthOrPercentage;
use values::{computed, CSSFloat};
/// A generic 2D transformation matrix.
#[allow(missing_docs)]
@ -514,8 +514,8 @@ pub fn get_normalized_vector_and_angle<T: Zero>(
z: CSSFloat,
angle: T,
) -> (CSSFloat, CSSFloat, CSSFloat, T) {
use crate::values::computed::transform::DirectionVector;
use euclid::approxeq::ApproxEq;
use values::computed::transform::DirectionVector;
let vector = DirectionVector::new(x, y, z);
if vector.square_length().approx_eq(&f32::zero()) {
// https://www.w3.org/TR/css-transforms-1/#funcdef-rotate3d

View file

@ -4,8 +4,8 @@
//! Generic types for url properties.
use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use parser::{Parse, ParserContext};
use style_traits::ParseError;
/// An image url or none, used for example in list-style-image
@ -44,7 +44,7 @@ where
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<UrlOrNone<Url>, ParseError<'i>> {
if let Ok(url) = input.try(|input| Url::parse(context, input)) {
if let Ok(url) = input.r#try(|input| Url::parse(context, input)) {
return Ok(UrlOrNone::Url(url));
}
input.expect_ident_matching("none")?;