mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Run rustfmt on selectors, servo_arc, and style.
This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
This commit is contained in:
parent
f7ae1a37e3
commit
c99bcdd4b8
181 changed files with 9981 additions and 7933 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use cssparser::{Token, SourceLocation, ParseErrorKind, BasicParseErrorKind};
|
||||
use cssparser::{BasicParseErrorKind, ParseErrorKind, SourceLocation, Token};
|
||||
use log;
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
|
@ -62,11 +62,19 @@ impl<'a> fmt::Display for ContextualParseError<'a> {
|
|||
Token::QuotedString(ref s) => write!(f, "quoted string \"{}\"", s),
|
||||
Token::UnquotedUrl(ref u) => write!(f, "url {}", u),
|
||||
Token::Delim(ref d) => write!(f, "delimiter {}", d),
|
||||
Token::Number { int_value: Some(i), .. } => write!(f, "number {}", i),
|
||||
Token::Number {
|
||||
int_value: Some(i), ..
|
||||
} => write!(f, "number {}", i),
|
||||
Token::Number { value, .. } => write!(f, "number {}", value),
|
||||
Token::Percentage { int_value: Some(i), .. } => write!(f, "percentage {}", i),
|
||||
Token::Percentage { unit_value, .. } => write!(f, "percentage {}", unit_value * 100.),
|
||||
Token::Dimension { value, ref unit, .. } => write!(f, "dimension {}{}", value, unit),
|
||||
Token::Percentage {
|
||||
int_value: Some(i), ..
|
||||
} => write!(f, "percentage {}", i),
|
||||
Token::Percentage { unit_value, .. } => {
|
||||
write!(f, "percentage {}", unit_value * 100.)
|
||||
},
|
||||
Token::Dimension {
|
||||
value, ref unit, ..
|
||||
} => write!(f, "dimension {}{}", value, unit),
|
||||
Token::WhiteSpace(_) => write!(f, "whitespace"),
|
||||
Token::Comment(_) => write!(f, "comment"),
|
||||
Token::Colon => write!(f, "colon (:)"),
|
||||
|
@ -96,22 +104,20 @@ impl<'a> fmt::Display for ContextualParseError<'a> {
|
|||
ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(ref t)) => {
|
||||
write!(f, "found unexpected ")?;
|
||||
token_to_str(t, f)
|
||||
}
|
||||
},
|
||||
ParseErrorKind::Basic(BasicParseErrorKind::EndOfInput) => {
|
||||
write!(f, "unexpected end of input")
|
||||
}
|
||||
},
|
||||
ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(ref i)) => {
|
||||
write!(f, "@ rule invalid: {}", i)
|
||||
}
|
||||
},
|
||||
ParseErrorKind::Basic(BasicParseErrorKind::AtRuleBodyInvalid) => {
|
||||
write!(f, "@ rule invalid")
|
||||
}
|
||||
},
|
||||
ParseErrorKind::Basic(BasicParseErrorKind::QualifiedRuleInvalid) => {
|
||||
write!(f, "qualified rule invalid")
|
||||
}
|
||||
ParseErrorKind::Custom(ref err) => {
|
||||
write!(f, "{:?}", err)
|
||||
}
|
||||
},
|
||||
ParseErrorKind::Custom(ref err) => write!(f, "{:?}", err),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,65 +125,86 @@ impl<'a> fmt::Display for ContextualParseError<'a> {
|
|||
ContextualParseError::UnsupportedPropertyDeclaration(decl, ref err) => {
|
||||
write!(f, "Unsupported property declaration: '{}', ", decl)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::UnsupportedFontFaceDescriptor(decl, ref err) => {
|
||||
write!(f, "Unsupported @font-face descriptor declaration: '{}', ", decl)?;
|
||||
write!(
|
||||
f,
|
||||
"Unsupported @font-face descriptor declaration: '{}', ",
|
||||
decl
|
||||
)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::UnsupportedFontFeatureValuesDescriptor(decl, ref err) => {
|
||||
write!(f, "Unsupported @font-feature-values descriptor declaration: '{}', ", decl)?;
|
||||
write!(
|
||||
f,
|
||||
"Unsupported @font-feature-values descriptor declaration: '{}', ",
|
||||
decl
|
||||
)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::InvalidKeyframeRule(rule, ref err) => {
|
||||
write!(f, "Invalid keyframe rule: '{}', ", rule)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::InvalidFontFeatureValuesRule(rule, ref err) => {
|
||||
write!(f, "Invalid font feature value rule: '{}', ", rule)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::UnsupportedKeyframePropertyDeclaration(decl, ref err) => {
|
||||
write!(f, "Unsupported keyframe property declaration: '{}', ", decl)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::InvalidRule(rule, ref err) => {
|
||||
write!(f, "Invalid rule: '{}', ", rule)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::UnsupportedRule(rule, ref err) => {
|
||||
write!(f, "Unsupported rule: '{}', ", rule)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::UnsupportedViewportDescriptorDeclaration(decl, ref err) => {
|
||||
write!(f, "Unsupported @viewport descriptor declaration: '{}', ", decl)?;
|
||||
write!(
|
||||
f,
|
||||
"Unsupported @viewport descriptor declaration: '{}', ",
|
||||
decl
|
||||
)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(decl, ref err) => {
|
||||
write!(f, "Unsupported @counter-style descriptor declaration: '{}', ", decl)?;
|
||||
write!(
|
||||
f,
|
||||
"Unsupported @counter-style descriptor declaration: '{}', ",
|
||||
decl
|
||||
)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
ContextualParseError::InvalidCounterStyleWithoutSymbols(ref system) => {
|
||||
write!(f, "Invalid @counter-style rule: 'system: {}' without 'symbols'", system)
|
||||
}
|
||||
ContextualParseError::InvalidCounterStyleNotEnoughSymbols(ref system) => {
|
||||
write!(f, "Invalid @counter-style rule: 'system: {}' less than two 'symbols'", system)
|
||||
}
|
||||
ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols => {
|
||||
write!(f, "Invalid @counter-style rule: 'system: additive' without 'additive-symbols'")
|
||||
}
|
||||
ContextualParseError::InvalidCounterStyleExtendsWithSymbols => {
|
||||
write!(f, "Invalid @counter-style rule: 'system: extends …' with 'symbols'")
|
||||
}
|
||||
ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols => {
|
||||
write!(f, "Invalid @counter-style rule: 'system: extends …' with 'additive-symbols'")
|
||||
}
|
||||
},
|
||||
ContextualParseError::InvalidCounterStyleWithoutSymbols(ref system) => write!(
|
||||
f,
|
||||
"Invalid @counter-style rule: 'system: {}' without 'symbols'",
|
||||
system
|
||||
),
|
||||
ContextualParseError::InvalidCounterStyleNotEnoughSymbols(ref system) => write!(
|
||||
f,
|
||||
"Invalid @counter-style rule: 'system: {}' less than two 'symbols'",
|
||||
system
|
||||
),
|
||||
ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols => write!(
|
||||
f,
|
||||
"Invalid @counter-style rule: 'system: additive' without 'additive-symbols'"
|
||||
),
|
||||
ContextualParseError::InvalidCounterStyleExtendsWithSymbols => write!(
|
||||
f,
|
||||
"Invalid @counter-style rule: 'system: extends …' with 'symbols'"
|
||||
),
|
||||
ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols => write!(
|
||||
f,
|
||||
"Invalid @counter-style rule: 'system: extends …' with 'additive-symbols'"
|
||||
),
|
||||
ContextualParseError::InvalidMediaRule(media_rule, ref err) => {
|
||||
write!(f, "Invalid media rule: {}, ", media_rule)?;
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
ContextualParseError::UnsupportedValue(_value, ref err) => {
|
||||
parse_error_to_str(err, f)
|
||||
}
|
||||
},
|
||||
ContextualParseError::UnsupportedValue(_value, ref err) => parse_error_to_str(err, f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,10 +215,12 @@ pub trait ParseErrorReporter {
|
|||
///
|
||||
/// Returns the current input being parsed, the source location it was
|
||||
/// reported from, and a message.
|
||||
fn report_error(&self,
|
||||
url: &UrlExtraData,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError);
|
||||
fn report_error(
|
||||
&self,
|
||||
url: &UrlExtraData,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError,
|
||||
);
|
||||
}
|
||||
|
||||
/// An error reporter that uses [the `log` crate](https://github.com/rust-lang-nursery/log)
|
||||
|
@ -203,12 +232,20 @@ pub trait ParseErrorReporter {
|
|||
pub struct RustLogReporter;
|
||||
|
||||
impl ParseErrorReporter for RustLogReporter {
|
||||
fn report_error(&self,
|
||||
url: &UrlExtraData,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError) {
|
||||
fn report_error(
|
||||
&self,
|
||||
url: &UrlExtraData,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError,
|
||||
) {
|
||||
if log_enabled!(log::Level::Info) {
|
||||
info!("Url:\t{}\n{}:{} {}", url.as_str(), location.line, location.column, error)
|
||||
info!(
|
||||
"Url:\t{}\n{}:{} {}",
|
||||
url.as_str(),
|
||||
location.line,
|
||||
location.column,
|
||||
error
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,10 +254,12 @@ impl ParseErrorReporter for RustLogReporter {
|
|||
pub struct NullReporter;
|
||||
|
||||
impl ParseErrorReporter for NullReporter {
|
||||
fn report_error(&self,
|
||||
_url: &UrlExtraData,
|
||||
_location: SourceLocation,
|
||||
_error: ContextualParseError) {
|
||||
fn report_error(
|
||||
&self,
|
||||
_url: &UrlExtraData,
|
||||
_location: SourceLocation,
|
||||
_error: ContextualParseError,
|
||||
) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue