Skip to content

Commit

Permalink
Manual fixups so that the rustfmt output won't trigger tidy.
Browse files Browse the repository at this point in the history
  • Loading branch information
bholley committed Apr 11, 2018
1 parent b292f78 commit f7ae1a3
Show file tree
Hide file tree
Showing 40 changed files with 443 additions and 416 deletions.
3 changes: 1 addition & 2 deletions components/selectors/build.rs
Expand Up @@ -14,8 +14,7 @@ fn main() {
.join("ascii_case_insensitive_html_attributes.rs");
let mut file = BufWriter::new(File::create(&path).unwrap());

write!(&mut file, "{{ static SET: ::phf::Set<&'static str> = ",
).unwrap();
write!(&mut file, "{{ static SET: ::phf::Set<&'static str> = ").unwrap();
let mut set = phf_codegen::Set::new();
for name in ASCII_CASE_INSENSITIVE_HTML_ATTRIBUTES.split_whitespace() {
set.entry(name);
Expand Down
2 changes: 1 addition & 1 deletion components/selectors/lib.rs
Expand Up @@ -7,9 +7,9 @@

#[macro_use] extern crate bitflags;
#[macro_use] extern crate cssparser;
extern crate fnv;
#[macro_use] extern crate log;
#[macro_use] extern crate matches;
extern crate fnv;
extern crate phf;
extern crate precomputed_hash;
extern crate servo_arc;
Expand Down
73 changes: 39 additions & 34 deletions components/selectors/parser.rs
Expand Up @@ -9,7 +9,8 @@ use builder::{SelectorBuilder, SpecificityAndFlags};
use context::QuirksMode;
use cssparser::{ParseError, ParseErrorKind, BasicParseError, BasicParseErrorKind};
use cssparser::{SourceLocation, CowRcStr, Delimiter};
use cssparser::{Token, Parser as CssParser, parse_nth, ToCss, serialize_identifier, CssStringWriter};
use cssparser::{Token, Parser as CssParser, ToCss, CssStringWriter};
use cssparser::{parse_nth, serialize_identifier};
use precomputed_hash::PrecomputedHash;
use servo_arc::ThinArc;
use sink::Push;
Expand Down Expand Up @@ -1300,7 +1301,8 @@ impl<Impl: SelectorImpl> Selector<Impl> {
{
let selector = parse_selector(parser, input)?;
if selector.has_pseudo_element() {
return Err(input.new_custom_error(SelectorParseErrorKind::PseudoElementInComplexSelector))
let e = SelectorParseErrorKind::PseudoElementInComplexSelector;
return Err(input.new_custom_error(e))
}
Ok(selector)
}
Expand Down Expand Up @@ -1428,9 +1430,8 @@ where
Ok(OptionalQName::Some(namespace, Some(local_name.clone())))
}
Ok(t) if in_attr_selector => {
Err(location.new_custom_error(
SelectorParseErrorKind::InvalidQualNameInAttr(t.clone())
))
let e = SelectorParseErrorKind::InvalidQualNameInAttr(t.clone());
Err(location.new_custom_error(e))
}
Ok(t) => {
Err(location.new_custom_error(
Expand Down Expand Up @@ -1694,7 +1695,8 @@ where
},
Some(SimpleSelectorParseResult::PseudoElement(_)) |
Some(SimpleSelectorParseResult::SlottedPseudo(_)) => {
return Err(input.new_custom_error(SelectorParseErrorKind::NonSimpleSelectorInNegation));
let e = SelectorParseErrorKind::NonSimpleSelectorInNegation;
return Err(input.new_custom_error(e));
}
}
}
Expand Down Expand Up @@ -1759,10 +1761,10 @@ where
match input.next_including_whitespace() {
Ok(&Token::Colon) => {},
Ok(&Token::WhiteSpace(_)) | Err(_) => break,
Ok(t) =>
return Err(location.new_custom_error(
SelectorParseErrorKind::PseudoElementExpectedColon(t.clone())
)),
Ok(t) => {
let e = SelectorParseErrorKind::PseudoElementExpectedColon(t.clone());
return Err(location.new_custom_error(e));
},
}

let location = input.current_source_location();
Expand Down Expand Up @@ -1903,9 +1905,10 @@ where
let class = Component::Class(class.as_ref().into());
Ok(Some(SimpleSelectorParseResult::SimpleSelector(class)))
}
ref t => Err(location.new_custom_error(
SelectorParseErrorKind::ClassNeedsIdent(t.clone())
)),
ref t => {
let e = SelectorParseErrorKind::ClassNeedsIdent(t.clone());
Err(location.new_custom_error(e))
},
}
}
Ok(Token::SquareBracketBlock) => {
Expand All @@ -1921,33 +1924,32 @@ where
let (name, is_functional) = match next_token {
Token::Ident(name) => (name, false),
Token::Function(name) => (name, true),
t => return Err(input.new_custom_error(
SelectorParseErrorKind::PseudoElementExpectedIdent(t)
)),
t => {
let e = SelectorParseErrorKind::PseudoElementExpectedIdent(t);
return Err(input.new_custom_error(e));
},
};
let is_pseudo_element = !is_single_colon ||
P::pseudo_element_allows_single_colon(&name);
if is_pseudo_element {
let parse_result = if is_functional {
if P::parse_slotted(parser) && name.eq_ignore_ascii_case("slotted") {
SimpleSelectorParseResult::SlottedPseudo(
input.parse_nested_block(|input| {
parse_inner_compound_selector(
parser,
input,
)
})?
)
let selector = input.parse_nested_block(|input| {
parse_inner_compound_selector(
parser,
input,
)
})?;
SimpleSelectorParseResult::SlottedPseudo(selector)
} else {
SimpleSelectorParseResult::PseudoElement(
input.parse_nested_block(|input| {
P::parse_functional_pseudo_element(
parser,
name,
input,
)
})?
)
let selector = input.parse_nested_block(|input| {
P::parse_functional_pseudo_element(
parser,
name,
input,
)
})?;
SimpleSelectorParseResult::PseudoElement(selector)
}
} else {
SimpleSelectorParseResult::PseudoElement(
Expand Down Expand Up @@ -2158,7 +2160,10 @@ pub mod tests {
parser: &mut CssParser<'i, 't>,
) -> Result<PseudoClass, SelectorParseError<'i>> {
match_ignore_ascii_case! { &name,
"lang" => return Ok(PseudoClass::Lang(parser.expect_ident_or_string()?.as_ref().to_owned())),
"lang" => {
let lang = parser.expect_ident_or_string()?.as_ref().to_owned();
return Ok(PseudoClass::Lang(lang));
},
_ => {}
}
Err(parser.new_custom_error(SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name)))
Expand Down
21 changes: 10 additions & 11 deletions components/style/custom_properties.rs
Expand Up @@ -366,25 +366,24 @@ fn parse_declaration_value_block<'i, 't>(
token.serialization_type()
}
Token::BadUrl(u) => {
return Err(input.new_custom_error(StyleParseErrorKind::BadUrlInDeclarationValueBlock(u)))
let e = StyleParseErrorKind::BadUrlInDeclarationValueBlock(u);
return Err(input.new_custom_error(e))
}
Token::BadString(s) => {
return Err(input.new_custom_error(StyleParseErrorKind::BadStringInDeclarationValueBlock(s)))
let e = StyleParseErrorKind::BadStringInDeclarationValueBlock(s);
return Err(input.new_custom_error(e))
}
Token::CloseParenthesis => {
return Err(input.new_custom_error(
StyleParseErrorKind::UnbalancedCloseParenthesisInDeclarationValueBlock
))
let e = StyleParseErrorKind::UnbalancedCloseParenthesisInDeclarationValueBlock;
return Err(input.new_custom_error(e))
}
Token::CloseSquareBracket => {
return Err(input.new_custom_error(
StyleParseErrorKind::UnbalancedCloseSquareBracketInDeclarationValueBlock
))
let e = StyleParseErrorKind::UnbalancedCloseSquareBracketInDeclarationValueBlock;
return Err(input.new_custom_error(e))
}
Token::CloseCurlyBracket => {
return Err(input.new_custom_error(
StyleParseErrorKind::UnbalancedCloseCurlyBracketInDeclarationValueBlock
))
let e = StyleParseErrorKind::UnbalancedCloseCurlyBracketInDeclarationValueBlock;
return Err(input.new_custom_error(e))
}
Token::Function(ref name) => {
if name.eq_ignore_ascii_case("var") {
Expand Down
3 changes: 2 additions & 1 deletion components/style/font_face.rs
Expand Up @@ -12,8 +12,9 @@
use computed_values::{font_stretch, font_style, font_weight};
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use cssparser::{SourceLocation, CowRcStr};
#[cfg(feature = "gecko")]
use cssparser::UnicodeRange;
use error_reporting::{ContextualParseError, ParseErrorReporter};
#[cfg(feature = "gecko")] use cssparser::UnicodeRange;
use parser::{ParserContext, ParserErrorContext, Parse};
#[cfg(feature = "gecko")]
use properties::longhands::font_language_override;
Expand Down
28 changes: 20 additions & 8 deletions components/style/gecko/arc_types.rs
Expand Up @@ -8,13 +8,25 @@

#![allow(non_snake_case, missing_docs)]

use gecko_bindings::bindings::{RawServoCounterStyleRule, RawServoFontFeatureValuesRule, RawServoImportRule};
use gecko_bindings::bindings::{RawServoKeyframe, RawServoKeyframesRule, RawServoSupportsRule};
use gecko_bindings::bindings::{RawServoMediaRule, RawServoNamespaceRule, RawServoPageRule};
use gecko_bindings::bindings::{RawServoRuleNode, RawServoRuleNodeStrong, RawServoDocumentRule};
use gecko_bindings::bindings::RawServoCounterStyleRule;
use gecko_bindings::bindings::RawServoDocumentRule;
use gecko_bindings::bindings::RawServoFontFeatureValuesRule;
use gecko_bindings::bindings::RawServoImportRule;
use gecko_bindings::bindings::RawServoKeyframe;
use gecko_bindings::bindings::RawServoKeyframesRule;
use gecko_bindings::bindings::RawServoMediaRule;
use gecko_bindings::bindings::RawServoNamespaceRule;
use gecko_bindings::bindings::RawServoPageRule;
use gecko_bindings::bindings::RawServoRuleNode;
use gecko_bindings::bindings::RawServoRuleNodeStrong;
use gecko_bindings::bindings::RawServoSupportsRule;
use gecko_bindings::bindings::ServoCssRules;
use gecko_bindings::structs::{RawServoAnimationValue, RawServoDeclarationBlock, RawServoFontFaceRule};
use gecko_bindings::structs::{RawServoMediaList, RawServoStyleRule, RawServoStyleSheetContents};
use gecko_bindings::structs::RawServoAnimationValue;
use gecko_bindings::structs::RawServoDeclarationBlock;
use gecko_bindings::structs::RawServoFontFaceRule;
use gecko_bindings::structs::RawServoMediaList;
use gecko_bindings::structs::RawServoStyleRule;
use gecko_bindings::structs::RawServoStyleSheetContents;
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
use media_queries::MediaList;
use properties::{ComputedValues, PropertyDeclarationBlock};
Expand All @@ -24,8 +36,8 @@ use servo_arc::{Arc, ArcBorrow};
use shared_lock::Locked;
use std::{mem, ptr};
use stylesheets::{CssRules, CounterStyleRule, FontFaceRule, FontFeatureValuesRule};
use stylesheets::{ImportRule, KeyframesRule, MediaRule, StylesheetContents, StyleRule};
use stylesheets::{NamespaceRule, PageRule, SupportsRule, DocumentRule};
use stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule, NamespaceRule, PageRule};
use stylesheets::{StylesheetContents, StyleRule, SupportsRule};
use stylesheets::keyframes_rule::Keyframe;

macro_rules! impl_arc_ffi {
Expand Down

0 comments on commit f7ae1a3

Please sign in to comment.