Skip to content

Commit d1d62a8

Browse files
committed
Merge branch 'pr-961'
2 parents ed7ac0d + 5d64b81 commit d1d62a8

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ semver = "0.2.1"
2929
toml = "0.1"
3030
unicode-normalization = "0.1"
3131
quine-mc_cluskey = "0.2.2"
32-
clippy_lints = { version = "0.0.*", path = "clippy_lints" }
32+
# begin automatic update
33+
clippy_lints = { version = "0.0.69", path = "clippy_lints" }
34+
# end automatic update
3335

3436
[dev-dependencies]
3537
compiletest_rs = "0.1.0"

clippy_lints/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[package]
22
name = "clippy_lints"
3+
# begin automatic update
34
version = "0.0.70"
5+
# end automatic update
46
authors = [
57
"Manish Goregaokar <[email protected]>",
68
"Andre Bogus <[email protected]>",

util/update_lints.py

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def collect(lints, deprecated_lints, restriction_lints, fn):
5858
# remove \-newline escapes from description string
5959
desc = nl_escape_re.sub('', match.group('desc'))
6060
restriction_lints.append((os.path.splitext(os.path.basename(fn))[0],
61-
match.group('name').lower(),
62-
"allow",
63-
desc.replace('\\"', '"')))
61+
match.group('name').lower(),
62+
"allow",
63+
desc.replace('\\"', '"')))
6464

6565

6666
def gen_table(lints, link=None):
@@ -100,6 +100,7 @@ def gen_deprecated(lints):
100100
for lint in lints:
101101
yield ' store.register_removed("%s", "%s");\n' % (lint[1], lint[2])
102102

103+
103104
def replace_region(fn, region_start, region_end, callback,
104105
replace_start=True, write_back=True):
105106
"""Replace a region in a file delimited by two lines matching regexes.
@@ -155,6 +156,16 @@ def main(print_only=False, check=False):
155156
collect(lints, deprecated_lints, restriction_lints,
156157
os.path.join(root, fn))
157158

159+
# determine version
160+
with open('Cargo.toml') as fp:
161+
for line in fp:
162+
if line.startswith('version ='):
163+
clippy_version = line.split()[2].strip('"')
164+
break
165+
else:
166+
print('Error: version not found in Cargo.toml!')
167+
return
168+
158169
if print_only:
159170
sys.stdout.writelines(gen_table(lints + restriction_lints))
160171
return
@@ -168,8 +179,8 @@ def main(print_only=False, check=False):
168179
changed |= replace_region(
169180
'README.md',
170181
r'^There are \d+ lints included in this crate:', "",
171-
lambda: ['There are %d lints included in this crate:\n' % (len(lints)
172-
+ len(restriction_lints))],
182+
lambda: ['There are %d lints included in this crate:\n' %
183+
(len(lints) + len(restriction_lints))],
173184
write_back=not check)
174185

175186
# update the links in the CHANGELOG
@@ -182,6 +193,19 @@ def main(print_only=False, check=False):
182193
key=lambda l: l[1])],
183194
replace_start=False, write_back=not check)
184195

196+
# update version of clippy_lints in Cargo.toml
197+
changed |= replace_region(
198+
'Cargo.toml', r'# begin automatic update', '# end automatic update',
199+
lambda: ['clippy_lints = { version = "%s", path = "clippy_lints" }\n' %
200+
clippy_version],
201+
replace_start=False, write_back=not check)
202+
203+
# update version of clippy_lints in Cargo.toml
204+
changed |= replace_region(
205+
'clippy_lints/Cargo.toml', r'# begin automatic update', '# end automatic update',
206+
lambda: ['version = "%s"\n' % clippy_version],
207+
replace_start=False, write_back=not check)
208+
185209
# update the `pub mod` list
186210
changed |= replace_region(
187211
'clippy_lints/src/lib.rs', r'begin lints modules', r'end lints modules',
@@ -196,10 +220,10 @@ def main(print_only=False, check=False):
196220

197221
# same for "deprecated" lint collection
198222
changed |= replace_region(
199-
'clippy_lints/src/lib.rs', r'let mut store', r'end deprecated lints',
200-
lambda: gen_deprecated(deprecated_lints),
201-
replace_start=False,
202-
write_back=not check)
223+
'clippy_lints/src/lib.rs', r'let mut store', r'end deprecated lints',
224+
lambda: gen_deprecated(deprecated_lints),
225+
replace_start=False,
226+
write_back=not check)
203227

204228
# same for "clippy_pedantic" lint collection
205229
changed |= replace_region(

0 commit comments

Comments
 (0)