]> git.lizzy.rs Git - rust.git/blobdiff - util/lintlib.py
Add run-rustfix to into_iter_on_ref
[rust.git] / util / lintlib.py
index 61090abc1380473c9eaf7d885ae59fa67733fa9b..1c49ab770d5e3e8175eecd2530c65d772f092a4d 100644 (file)
@@ -1,13 +1,3 @@
-# Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
-# file at the top-level directory of this distribution and at
-# http://rust-lang.org/COPYRIGHT.
-#
-# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-# option. This file may not be copied, modified, or distributed
-# except according to those terms.
-
 # Common utils for the several housekeeping scripts.
 
 import os
@@ -82,10 +72,13 @@ def parse_lints(lints, filepath):
                             g = group_re.search(line)
                             if g:
                                 group = g.group(1).lower()
-                                level = lint_levels[group]
+                                level = lint_levels.get(group, None)
                                 break
                             line = next(fp)
 
+                    if level is None:
+                        continue
+
                     log.info("found %s with level %s in %s",
                              name, level, filepath)
                     lints.append(Lint(name, level, last_comment, filepath, group))
@@ -113,9 +106,11 @@ def parse_configs(path):
 
 def parse_all(path="clippy_lints/src"):
     lints = []
-    for filename in os.listdir(path):
-        if filename.endswith(".rs"):
-            parse_lints(lints, os.path.join(path, filename))
+    for root, dirs, files in os.walk(path):
+        for fn in files:
+            if fn.endswith('.rs'):
+                parse_lints(lints, os.path.join(root, fn))
+
     log.info("got %s lints", len(lints))
 
     configs = parse_configs(path)