tidy: Remove dead and redundant code from Servo Rust tidy check (#38632)

- Remove all handling of comments and attributes. This was not affecting
  the checks in any way.
- Remove `is_associated_type()` as it was unused.
- Remove the check for `&String`, `&Vec`, operators at the end of the
  line, and the unit return type as clippy already checks these (and
  handles the mutable variants).

Testing: This is covered by tidy script tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-08-12 19:57:35 +02:00 committed by GitHub
parent 2ea251117a
commit 6ff5c4ef99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 104 deletions

View file

@ -117,13 +117,8 @@ class CheckTidiness(unittest.TestCase):
def test_rust(self):
errors = tidy.collect_errors_for_files(iterFile("rust_tidy.rs"), [], [tidy.check_rust], print_text=False)
self.assertEqual("found an empty line following a {", next(errors)[2])
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)
feature_errors = tidy.collect_errors_for_files(iterFile("lib.rs"), [], [tidy.check_rust], print_text=False)