From f01fa227c0b37a5af343c0c8a074ffa6fb42210e Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Sun, 30 Sep 2018 06:25:23 +0200 Subject: [PATCH] Fix update_lints.py for dir modules --- util/update_lints.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/util/update_lints.py b/util/update_lints.py index 15242abd606..b34dad73f70 100755 --- a/util/update_lints.py +++ b/util/update_lints.py @@ -46,7 +46,12 @@ def collect(deprecated_lints, clippy_lints, fn): # remove \-newline escapes from description string desc = nl_escape_re.sub('', match.group('desc')) cat = match.group('cat') - clippy_lints[cat].append((os.path.splitext(os.path.basename(fn))[0], + if cat in ('internal', 'internal_warn'): + continue + module_name = os.path.splitext(os.path.basename(fn))[0] + if module_name == 'mod': + module_name = os.path.basename(os.path.dirname(fn)) + clippy_lints[cat].append((module_name, match.group('name').lower(), "allow", desc.replace('\\"', '"'))) @@ -138,10 +143,11 @@ def main(print_only=False, check=False): return # collect all lints from source files - for fn in os.listdir('clippy_lints/src'): - if fn.endswith('.rs'): - collect(deprecated_lints, clippy_lints, - os.path.join('clippy_lints', 'src', fn)) + for root, dirs, files in os.walk('clippy_lints/src'): + for fn in files: + if fn.endswith('.rs'): + collect(deprecated_lints, clippy_lints, + os.path.join(root, fn)) # determine version with open('Cargo.toml') as fp: