aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy
diff options
context:
space:
mode:
authorlberrymage <mageelog@gmail.com>2019-12-21 12:44:34 -0900
committerlberrymage <mageelog@gmail.com>2019-12-21 12:44:35 -0900
commitcd9195056c7a83b44ed439ef607b94ed4824431d (patch)
tree3d60bc161b9553746290dfe6e785fda02143b131 /python/tidy
parentbac9903fbeed0a394a86c0091e727aada665433d (diff)
downloadservo-cd9195056c7a83b44ed439ef607b94ed4824431d.tar.gz
servo-cd9195056c7a83b44ed439ef607b94ed4824431d.zip
Add lint check for `&DomRoot<T>`
`&DomRoot<T> is strictly less expressive than `&T`, so using it is pointless.
Diffstat (limited to 'python/tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py1
-rw-r--r--python/tidy/servo_tidy_tests/rust_tidy.rs2
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py1
3 files changed, 3 insertions, 1 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index da432d0c0f8..cbbb1a542d4 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -623,6 +623,7 @@ def check_rust(file_name, lines):
(r"DomRefCell<Heap<.+>>", "Banned type DomRefCell<Heap<T>> detected. Use MutDom<T> instead", no_filter),
# No benefit to using &Root<T>
(r": &Root<", "use &T instead of &Root<T>", no_filter),
+ (r": &DomRoot<", "use &T instead of &DomRoot<T>", no_filter),
(r"^&&", "operators should go at the end of the first line", no_filter),
# This particular pattern is not reentrant-safe in script_thread.rs
(r"match self.documents.borrow", "use a separate variable for the match expression",
diff --git a/python/tidy/servo_tidy_tests/rust_tidy.rs b/python/tidy/servo_tidy_tests/rust_tidy.rs
index 4b6c35b85cb..78b47a14401 100644
--- a/python/tidy/servo_tidy_tests/rust_tidy.rs
+++ b/python/tidy/servo_tidy_tests/rust_tidy.rs
@@ -38,7 +38,7 @@ impl test {
}
}
- fn test_fun2(y : &String, z : &Vec<f32>, r: &Root<isize>) -> () {
+ fn test_fun2(y : &String, z : &Vec<f32>, r: &Root<isize>, s: &DomRoot<isize>) -> () {
let x = true;
x
&& x;
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py
index c13710057ab..441e9250c51 100644
--- a/python/tidy/servo_tidy_tests/test_tidy.py
+++ b/python/tidy/servo_tidy_tests/test_tidy.py
@@ -112,6 +112,7 @@ class CheckTidiness(unittest.TestCase):
self.assertEqual('use &[T] instead of &Vec<T>', next(errors)[2])
self.assertEqual('use &str instead of &String', next(errors)[2])
self.assertEqual('use &T instead of &Root<T>', next(errors)[2])
+ self.assertEqual('use &T instead of &DomRoot<T>', next(errors)[2])
self.assertEqual('encountered function signature with -> ()', next(errors)[2])
self.assertEqual('operators should go at the end of the first line', next(errors)[2])
self.assertNoMoreErrors(errors)