aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy
diff options
context:
space:
mode:
authorJure Podgoršek <jurij.podgorsek@dlabs.si>2017-01-06 20:48:23 +0100
committerJure Podgoršek <jurij.podgorsek@dlabs.si>2017-01-06 20:56:59 +0100
commitadcedd83147c9c77037b96c43a69ddb1a6254b45 (patch)
tree0d976d1bb5be4ff1527b2080b7f975aff5e4d3e5 /python/tidy
parent6d4ccab2b71c8eedcf05ed5402195538d626f8c8 (diff)
downloadservo-adcedd83147c9c77037b96c43a69ddb1a6254b45.tar.gz
servo-adcedd83147c9c77037b96c43a69ddb1a6254b45.zip
Rust tidy: disallow assignment = in the beginning of line
Diffstat (limited to 'python/tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py2
-rw-r--r--python/tidy/servo_tidy_tests/rust_tidy.rs3
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py1
3 files changed, 6 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 92d06d1712c..28bf84600a3 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -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),
diff --git a/python/tidy/servo_tidy_tests/rust_tidy.rs b/python/tidy/servo_tidy_tests/rust_tidy.rs
index 79be0ff1580..25da55e5bf8 100644
--- a/python/tidy/servo_tidy_tests/rust_tidy.rs
+++ b/python/tidy/servo_tidy_tests/rust_tidy.rs
@@ -59,4 +59,7 @@ impl test {
// Should not be triggered
macro_rules! test_macro ( ( $( $fun:ident = $flag:ident ; )* ) => ());
+
+ let var
+ = "val";
}
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index 7adcbda2dfe..d8738b08981 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -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)