Skip to content

Commit f01fa22

Browse files
author
Michael Wright
committed
Fix update_lints.py for dir modules
1 parent c2ee9c2 commit f01fa22

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

util/update_lints.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ def collect(deprecated_lints, clippy_lints, fn):
4646
# remove \-newline escapes from description string
4747
desc = nl_escape_re.sub('', match.group('desc'))
4848
cat = match.group('cat')
49-
clippy_lints[cat].append((os.path.splitext(os.path.basename(fn))[0],
49+
if cat in ('internal', 'internal_warn'):
50+
continue
51+
module_name = os.path.splitext(os.path.basename(fn))[0]
52+
if module_name == 'mod':
53+
module_name = os.path.basename(os.path.dirname(fn))
54+
clippy_lints[cat].append((module_name,
5055
match.group('name').lower(),
5156
"allow",
5257
desc.replace('\\"', '"')))
@@ -138,10 +143,11 @@ def main(print_only=False, check=False):
138143
return
139144

140145
# collect all lints from source files
141-
for fn in os.listdir('clippy_lints/src'):
142-
if fn.endswith('.rs'):
143-
collect(deprecated_lints, clippy_lints,
144-
os.path.join('clippy_lints', 'src', fn))
146+
for root, dirs, files in os.walk('clippy_lints/src'):
147+
for fn in files:
148+
if fn.endswith('.rs'):
149+
collect(deprecated_lints, clippy_lints,
150+
os.path.join(root, fn))
145151

146152
# determine version
147153
with open('Cargo.toml') as fp:

0 commit comments

Comments
 (0)