Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRun rustfmt on selectors, servo_arc, and style #20603
Conversation
highfive
commented
Apr 10, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Apr 10, 2018
|
(and @heycam of course) r? @SimonSapin |
|
CC @Manishearth also |
|
I wonder is this really just running rustfmt on the crates? It seems to be doing more things than I would thought a formatter normally does, e.g. removing Also I find it a bit hard to follow how some decision is made for formatting, for example, I see conversion from single line |
|
Hmmm, actually not. Many of the changes I wouldn't expect formatter to do are from the manual fixup. That explains :) |
| ) | ||
| })? | ||
| ) | ||
| let r = input.parse_nested_block(|input| { |
This comment has been minimized.
This comment has been minimized.
|
CI is also red:
|
|
|
|
@bholley Could you include in the PR message (which will go in the merge commit) what version of rustfmt you used and what command you ran to produce this commit? |
|
Addressed review comments. If someone could stamp this soon I'd appreciate it, since it bitrots quickly. :-) |
|
|
|
r=me |
|
@bors-servo r=Manishearth |
|
|
|
There are a few of these that look like regressions to me. Maybe @nrc may take a look and see if there's something unexpected in some of these? Also, is there any plan / way to enforce its usage? My plan to start doing this, btw, was enforcing usage of Anyway, as much as I dislike some particular changes, consistency is king I guess... |
| .any(|part| case.eq(part.as_bytes(), s)) | ||
| } | ||
| }, | ||
| AttrSelectorOperator::Includes => element_attr_value |
This comment has been minimized.
This comment has been minimized.
| Component::Slotted(..) | | ||
| Component::PseudoElement(..) | | ||
| Component::LocalName(..) => { | ||
| Component::Slotted(..) | Component::PseudoElement(..) | Component::LocalName(..) => { |
This comment has been minimized.
This comment has been minimized.
| @@ -52,8 +52,8 @@ impl ElementSelectorFlags { | |||
| /// Returns the subset of flags that apply to the parent. | |||
| pub fn for_parent(self) -> ElementSelectorFlags { | |||
| self & (ElementSelectorFlags::HAS_SLOW_SELECTOR | | |||
| ElementSelectorFlags::HAS_SLOW_SELECTOR_LATER_SIBLINGS | | |||
This comment has been minimized.
This comment has been minimized.
| matches!( | ||
| selector.combinator_at_parse_order(from_offset), | ||
| Combinator::SlotAssignment | Combinator::PseudoElement | ||
| )), |
This comment has been minimized.
This comment has been minimized.
emilio
Apr 10, 2018
Member
Don't understand how this makes more sense than what we had either but.. I guess.
| }, | ||
| _ => true, | ||
| } | ||
| let all_match = selector_iter.clone().all(|simple| match *simple { |
This comment has been minimized.
This comment has been minimized.
| @@ -149,7 +156,7 @@ impl<'a, 'b, 'i> AtRuleParser<'i> for CounterStyleRuleParser<'a, 'b> { | |||
|
|
|||
| macro_rules! checker { | |||
| ($self:ident._($value:ident)) => {}; | |||
| ($self:ident.$checker:ident($value:ident)) => { | |||
| ($self:ident. $checker:ident($value:ident)) => { | |||
This comment has been minimized.
This comment has been minimized.
emilio
Apr 10, 2018
Member
This is touching a macro, and I'm not sure it's fine, actually... I guess it is but it looks fishy at best.
| + Clone | ||
| + SelectorsElement<Impl = SelectorImpl> | ||
| pub trait TElement: | ||
| Eq + PartialEq + Debug + Hash + Sized + Copy + Clone + SelectorsElement<Impl = SelectorImpl> |
This comment has been minimized.
This comment has been minimized.
| write!(f, "Invalid @counter-style rule: 'system: extends …' with 'additive-symbols'") | ||
| } | ||
| }, | ||
| ContextualParseError::InvalidCounterStyleWithoutSymbols(ref system) => write!( |
This comment has been minimized.
This comment has been minimized.
| #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord)] | ||
| #[derive(PartialEq, PartialOrd, ToComputedValue, ToCss)] | ||
| #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd, ToComputedValue, | ||
| ToCss)] |
This comment has been minimized.
This comment has been minimized.
emilio
Apr 10, 2018
Member
It also merges #[derive(..)] lines? Is there a way to prevent it from doing that?
| ) | ||
| where | ||
| Impl: SelectorImpl | ||
| ) where |
This comment has been minimized.
This comment has been minimized.
|
|
|
|
|
FWIW I think something like #20617 would be less invasive. Arguably needs more polish and what not. But massive reformats pollute the history quite heavily, it's better to do it incrementally if possible IMO. |
|
The downsides I see to per-patch reformatting are: There's definitely room for disagreement here. But given that most people have expressed approval for doing it this way, and given that I've already done the work here, I'm inclined to land it. |
|
@bors-servo r=Manishearth p=5 |
|
|
Run rustfmt on selectors, servo_arc, and style Now that rustfmt is getting close to stable, and work on the style system has died down a bit, it seemed like an opportune time to auto-format the style crates. The first commit disables import reordering, since tidy and rustfmt don't currently agree on the correct ordering. The second commit does a bunch of manual fixups such that the output of rustfmt passes tidy. The third commit runs rustfmt on the three aforementioned crate. There are a few dozen warnings in the style crate about lines longer than 100 characters. It would be good to fix these, but I don't have time for that now. <!-- 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/20603) <!-- Reviewable:end -->
|
|
bholley commentedApr 10, 2018
•
edited by SimonSapin
Now that rustfmt is getting close to stable, and work on the style system has died down a bit, it seemed like an opportune time to auto-format the style crates.
The first commit disables import reordering, since tidy and rustfmt don't currently agree on the correct ordering. The second commit does a bunch of manual fixups such that the output of rustfmt passes tidy. The third commit runs rustfmt on the three aforementioned crate.
There are a few dozen warnings in the style crate about lines longer than 100 characters. It would be good to fix these, but I don't have time for that now.
This change is