Auto merge of #14896 - g1smo:tidy-assignments, r=jdm

Tidy assignments

<!-- Please describe your changes on the following line: -->
I've added a new tidy rule (no = in the beginning of line) + tests for it. Also cleaned up a few rust source files to accord with the new rule.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14890 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/14896)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-07 09:40:46 -08:00 committed by GitHub
commit b6c137b36f
6 changed files with 12 additions and 6 deletions

View file

@ -1283,8 +1283,8 @@ impl BlockFlow {
content_block_size,
available_block_size));
candidate_block_size_iterator.candidate_value
= solution.unwrap().block_size;
candidate_block_size_iterator.candidate_value =
solution.unwrap().block_size;
}
}
}

View file

@ -1290,8 +1290,8 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
for kid in node.children() {
// CSS 2.1 § 17.2.1. Treat all non-column child fragments of `table-column-group`
// as `display: none`.
if let ConstructionResult::ConstructionItem(ConstructionItem::TableColumnFragment(fragment))
= kid.swap_out_construction_result() {
if let ConstructionResult::ConstructionItem(ConstructionItem::TableColumnFragment(fragment)) =
kid.swap_out_construction_result() {
col_fragments.push(fragment)
}
}

View file

@ -51,8 +51,8 @@ macro_rules! thread_types ( ( $( $fun:ident = $flag:ident ; )* ) => (
}
#[cfg(debug_assertions)]
static TYPES: &'static [ThreadState]
= &[ $( $flag ),* ];
static TYPES: &'static [ThreadState] =
&[ $( $flag ),* ];
));
thread_types! {

View file

@ -520,6 +520,8 @@ def check_rust(file_name, lines):
lambda match, line: is_attribute),
(r"=[A-Za-z0-9\"]", "missing space after =",
lambda match, line: is_attribute),
(r"^=\s", "no = in the beginning of line",
lambda match, line: not is_comment),
# ignore scientific notation patterns like 1e-6
(r"[A-DF-Za-df-z0-9]-", "missing space before -",
lambda match, line: not is_attribute),

View file

@ -59,4 +59,7 @@ impl test {
// Should not be triggered
macro_rules! test_macro ( ( $( $fun:ident = $flag:ident ; )* ) => ());
let var
= "val";
}

View file

@ -125,6 +125,7 @@ class CheckTidiness(unittest.TestCase):
self.assertEqual('extra space after (', errors.next()[2])
self.assertEqual('extra space after (', errors.next()[2])
self.assertEqual('extra space after test_fun', errors.next()[2])
self.assertEqual('no = in the beginning of line', errors.next()[2])
self.assertNoMoreErrors(errors)
feature_errors = tidy.collect_errors_for_files(iterFile('lib.rs'), [], [tidy.check_rust], print_text=False)