зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #11190 - add &Root<T> checker (from mrmiywj:Root-tidy-checker); r=jdm
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 #11137 (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. Source-Repo: https://github.com/servo/servo Source-Revision: 93f137f06d36059105d62ffc6829d65f7efe0d9d
This commit is contained in:
Родитель
50304268f8
Коммит
368fab86d1
|
@ -390,6 +390,8 @@ def check_rust(file_name, lines):
|
|||
(r": &Vec<", "use &[T] instead of &Vec<T>", no_filter),
|
||||
# No benefit over using &str
|
||||
(r": &String", "use &str instead of &String", no_filter),
|
||||
# No benefit to using &Root<T>
|
||||
(r": &Root<", "use &T instead of &Root<T>", no_filter),
|
||||
(r"^&&", "operators should go at the end of the first line", no_filter),
|
||||
(r"\{[A-Za-z0-9_]+\};", "use statement contains braces for single import",
|
||||
lambda match, line: line.startswith('use ')),
|
||||
|
|
|
@ -36,7 +36,7 @@ impl test {
|
|||
}
|
||||
}
|
||||
|
||||
fn test_fun2(y : &String, z : &Vec<f32>) -> f32 {
|
||||
fn test_fun2(y : &String, z : &Vec<f32>, r: &Root<isize>) -> f32 {
|
||||
let x = true;
|
||||
x
|
||||
&& x;
|
||||
|
|
|
@ -74,6 +74,7 @@ class CheckTidiness(unittest.TestCase):
|
|||
self.assertEqual('extra space before :', errors.next()[2])
|
||||
self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2])
|
||||
self.assertEqual('use &str instead of &String', errors.next()[2])
|
||||
self.assertEqual('use &T instead of &Root<T>', errors.next()[2])
|
||||
self.assertEqual('operators should go at the end of the first line', errors.next()[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче