Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Clippy #77747

Merged
merged 125 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
390a13b
needless-lifetime - fix nested elision site FPs
tnielens Aug 27, 2020
a60e5de
needless-lifetime / nested elision sites / PR remarks
tnielens Sep 8, 2020
c8e9e52
needless-lifetime / add test cases for nested elision sites
tnielens Sep 8, 2020
1778a1e
Restrict `same_item_push` to suppress false positives
giraffate Sep 7, 2020
0117ea2
Refactoring: use inner function
giraffate Sep 7, 2020
b80576f
Some refactoring
giraffate Sep 7, 2020
14faebe
Add some tests to `same_item_push`
giraffate Sep 8, 2020
2972ad3
Refactoring: tests in `same_item_push`
giraffate Sep 8, 2020
730ca45
Address `items_after_statement`
giraffate Sep 8, 2020
72b402e
Add pass names to some common dataflow analyses
ecstatic-morse Sep 15, 2020
5e393c7
Fix a FP in `explicit_counter_loop`
rail-rain Jun 10, 2020
3e294b2
Revert "or_fn_call: ignore nullary associated const fns"
ebroto Sep 22, 2020
ce83d8d
Revert "Avoid or_fun_call for const_fn with no args"
ebroto Sep 22, 2020
9365660
unnecessary sort by: avoid dereferencing closure param
ebroto Sep 23, 2020
d1f9cad
Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup
flip1995 Sep 24, 2020
019c0d5
Auto merge of #6076 - rail-rain:fix_fp_explicit_counter_loop, r=matth…
bors Sep 24, 2020
cc1998f
Auto merge of #6077 - ebroto:revert_or_fun_call_const, r=matthiaskrgr
bors Sep 24, 2020
2892a2b
Fix FP in `print_stdout`
giraffate Sep 24, 2020
a8c6073
Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnr
jonas-schievink Sep 25, 2020
6273be6
Auto merge of #77144 - flip1995:clippyup, r=Manishearth
bors Sep 25, 2020
6b59675
Remove run-pass annotations from crash tests
ebroto Sep 25, 2020
fd06561
Add emit=metadata to UI tests build flags
ebroto Sep 25, 2020
1cb3c00
Use emit=link for auxiliary proc macro crates
ebroto Sep 25, 2020
6e5306d
Auto merge of #6084 - ebroto:ui_tests_cleanup, r=flip1995
bors Sep 25, 2020
5b484b4
Fix the detection of build scripts
giraffate Sep 25, 2020
1479c18
add disallowed_method lint
Sep 24, 2020
12e5637
update unused variable
Sep 24, 2020
f4d88cb
run cargo dev update_lints
Sep 24, 2020
e1b3f85
run cargo dev fmt
Sep 24, 2020
9eb52d2
update toml_unknown_key test
Sep 24, 2020
725a0ef
change config variables to reference, remove wildcard import
Sep 24, 2020
3886edb
fix error message
Sep 24, 2020
f9da294
update error message, refactor disallowed_method
Sep 25, 2020
d186531
remove useless test, update disallowed_method description
Sep 25, 2020
5f7b643
update lint description
Sep 25, 2020
a6fda14
Move `qualify_min_const_fn` out of rustc into clippy
oli-obk Sep 26, 2020
83294f8
Some small fixes
giraffate Sep 26, 2020
7072e45
Remove all unstable feature support in the `missing_const_for_fn` lint
oli-obk Sep 26, 2020
71b6d54
Add build script but does not work in the dogfood test
giraffate Sep 26, 2020
1214a85
Add missing attr to clippy_workspace_tests/build.rs
ebroto Sep 26, 2020
b64d21d
Auto merge of #6079 - giraffate:print_stdout_in_build_rs, r=ebroto
bors Sep 26, 2020
ea079eb
Auto merge of #6081 - ilknarf:master, r=matthiaskrgr
bors Sep 26, 2020
00e641b
lints: clarify rc_buffer and add caveats
Fishrock123 Sep 27, 2020
949b834
Auto merge of #6090 - Fishrock123:rc_buffer-formatting-caveats, r=yaahc
bors Sep 27, 2020
210e891
Add option to pass a custom codegen backend from a driver
bjorn3 Sep 8, 2020
798a5cf
Merge remote-tracking branch 'upstream/master' into rustup
ebroto Sep 27, 2020
cd47064
Run cargo dev fmt
ebroto Sep 27, 2020
8bf27c5
Fix dogfood
ebroto Sep 27, 2020
db6fb90
Auto merge of #6091 - ebroto:rustup, r=ebroto
bors Sep 27, 2020
952ec7d
Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk
RalfJung Sep 28, 2020
101e76f
needless arbitrary self: handle macros
ebroto Sep 28, 2020
1b58144
Merge remote-tracking branch 'upstream/master' into rustup
ebroto Sep 28, 2020
ce678b9
Auto merge of #6094 - ebroto:rustup, r=ebroto
bors Sep 29, 2020
99483be
Auto merge of #6093 - ebroto:6089_renamed_lifetimes, r=Manishearth
bors Sep 29, 2020
7cfe3dc
Merge branch 'master' into needless-lifetime
tnielens Sep 29, 2020
124420f
needless-lifetime / fix master merge
tnielens Sep 29, 2020
aa2ac38
needless-lifetime / add known problem item
tnielens Sep 29, 2020
cb2be6f
needless-lifetime / pr remarks
tnielens Sep 29, 2020
0690f9c
Add lint for inline assembly syntax style preference
Sep 28, 2020
507561e
Update tests/ui/asm_syntax.rs
ebroto Sep 30, 2020
abce9e7
Auto merge of #6092 - jethrogb:jb/inline-asm-syntax-lint, r=ebroto
bors Sep 30, 2020
d431373
Auto merge of #5978 - montrivo:needless-lifetime, r=ebroto
bors Oct 1, 2020
d28211d
Fix rustup fallout
flip1995 Oct 1, 2020
0a91fe7
Don't emit a lint for the suggestion leading to errors in `needless_r…
giraffate Oct 1, 2020
8c9800a
Auto merge of #6102 - giraffate:no_lint_when_invalid_suggestion_in_ne…
bors Oct 1, 2020
e91202c
Allow exponent separator
Oct 2, 2020
f0eac45
Auto merge of #6104 - mikerite:fix-6096, r=ebroto
bors Oct 2, 2020
515ca93
Look for soft hyphens as well
bugadani Oct 2, 2020
45f25f8
Run update_lints
bugadani Oct 2, 2020
840f7da
Deprecate clippy lint
notriddle Oct 2, 2020
8b8c63f
changed non_copy_const lints to warn by default
Sep 30, 2020
a1a7f20
Auto merge of #6098 - longlb:interior_mut_const, r=ebroto
bors Oct 2, 2020
998bd3b
Rename lint to invisible_characters
bugadani Oct 2, 2020
572e4c4
Add WJ
bugadani Oct 2, 2020
9408c68
Auto merge of #6105 - bugadani:sus-char, r=ebroto
bors Oct 2, 2020
2ed5143
Auto merge of #6111 - flip1995:rustup, r=flip1995
bors Oct 4, 2020
5747c15
Prevent forbid from being ignored if overriden at the same level.
pnkfelix Jun 15, 2020
f34f4a7
Change clippy's Constant back to refcount clone byte strings
rschoon Oct 4, 2020
29d43f6
clippy: `(Body, DefId)` -> `Body`
ecstatic-morse Oct 4, 2020
78695bd
Do not lint float fractions in `mistyped_literal_suffixes` (fixes #4706)
FliegendeWurst Oct 5, 2020
428ef36
Fix test formatting
FliegendeWurst Oct 5, 2020
c5f1700
Add changelog for 1.48 beta
ebroto Oct 5, 2020
5f49249
Merge remote-tracking branch 'upstream/master' into rustup
ebroto Oct 5, 2020
5554641
Fix rustup fallout
ebroto Oct 5, 2020
411e3ba
Auto merge of #6118 - ebroto:rustup, r=ebroto
bors Oct 5, 2020
3239b46
Auto merge of #6114 - FliegendeWurst:no-mistyped-fraction, r=Manishearth
bors Oct 5, 2020
13781ae
Remove "thanks" section
ebroto Oct 5, 2020
4b45959
clippy_dev: Replace lazy_static with SyncLazy
phansch Oct 6, 2020
9b4ceee
integration tests: Replace lazy_static with SyncLazy
phansch Oct 6, 2020
c9fdeef
Auto merge of #6078 - ebroto:unnecessary_sort_by_take_2, r=phansch
bors Oct 6, 2020
a7b7219
Rollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-overrid…
JohnTitor Oct 6, 2020
22c5e0c
Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr
JohnTitor Oct 6, 2020
adb7fc6
Fix tools
matthewjasper Jun 30, 2020
da57a16
clippy_lints: Replace lazy_static with SyncLazy
phansch Oct 6, 2020
7021d70
Use more concrete explanation for methods
pickfire Oct 6, 2020
b05aeaa
Run fmt
flip1995 Oct 6, 2020
1a4175b
Auto merge of #6126 - flip1995:rustup, r=flip1995
bors Oct 6, 2020
6c3611b
Reinstate test for forbid blanket restriction
ebroto Oct 6, 2020
c8d89ba
Auto merge of #6127 - ebroto:reinstate_forbid_restriction, r=flip1995
bors Oct 6, 2020
14e7269
Auto merge of #6124 - pickfire:patch-1, r=flip1995
bors Oct 6, 2020
a5ef305
Downgrade string_lit_as_bytes to nursery
dtolnay Oct 5, 2020
0e159a5
Downgrade rc_buffer to restriction
dtolnay Oct 7, 2020
2771918
Auto merge of #6120 - phansch:replace-lazy-static, r=Manishearth
bors Oct 7, 2020
1167257
Fix unicode regexen with bytes::Regex
llogiq Oct 7, 2020
13a80b3
Auto merge of #6128 - dtolnay:rc_buffer, r=yaahc
bors Oct 7, 2020
738ed38
clippy_lints: Do not warn against Box parameter in C FFI
JPTIZ Oct 8, 2020
15150c0
clippy_lint: Test for BoxedLocal false-positive in C-FFI and fix C-FF…
JPTIZ Oct 8, 2020
171ab9b
Auto merge of #6132 - rust-lang:regex-unicode, r=ebroto
bors Oct 8, 2020
3a6f59e
Document string_lit_as_bytes known problems
dtolnay Oct 8, 2020
c81bea4
Make clippy_lints's doc tests succeed
dtolnay Oct 8, 2020
cc26924
clippy_lint: Extend BoxedLocal ignored ABI to all non-rust ABIs.
JPTIZ Oct 8, 2020
418cde0
clippy_lint: Fix typo (now -> not)
JPTIZ Oct 8, 2020
5ae0f26
clippy_lint: extern definition is in Rust, not C
JPTIZ Oct 8, 2020
e6a7106
Clippy dev subcommand to build and serve website
dtolnay Oct 8, 2020
fd61686
Add note that we follow a rustc no merge-commit policy
giraffate Oct 8, 2020
6bfc19c
Auto merge of #6138 - giraffate:note_that_we_follow_rustc_no_merge_po…
bors Oct 8, 2020
265e484
Auto merge of #6117 - dtolnay:string_lit_as_bytes, r=ebroto
bors Oct 8, 2020
b709b87
tests: Add test function that does not specify ABI
JPTIZ Oct 8, 2020
e651a04
Auto merge of #6133 - JPTIZ:no-box-for-c-ffi, r=ebroto
bors Oct 8, 2020
5837528
Merge remote-tracking branch 'upstream/beta' into backport_remerge
flip1995 Oct 9, 2020
195cc9b
Auto merge of #6145 - flip1995:backport_remerge, r=flip1995
bors Oct 9, 2020
6fb3b2c
Auto merge of #6115 - ebroto:changelog_1_48, r=flip1995
bors Oct 9, 2020
2f6439a
Auto merge of #6136 - dtolnay:serve, r=flip1995
bors Oct 9, 2020
6b8d25e
Merge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyup
flip1995 Oct 9, 2020
7ea42be
Update Cargo.lock
flip1995 Oct 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ dependencies = [
"cargo_metadata 0.11.1",
"if_chain",
"itertools 0.9.0",
"lazy_static",
"pulldown-cmark 0.8.0",
"quine-mc_cluskey",
"quote",
Expand Down
129 changes: 125 additions & 4 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,129 @@ document.

## Unreleased / In Rust Nightly

[09bd400...master](https://github.com/rust-lang/rust-clippy/compare/09bd400...master)
[e636b88...master](https://github.com/rust-lang/rust-clippy/compare/e636b88...master)

## Rust 1.48

Current beta, release 2020-11-19

[09bd400...e636b88](https://github.com/rust-lang/rust-clippy/compare/09bd400...e636b88)

### New lints

* [`self_assignment`] [#5894](https://github.com/rust-lang/rust-clippy/pull/5894)
* [`unnecessary_lazy_evaluations`] [#5720](https://github.com/rust-lang/rust-clippy/pull/5720)
* [`manual_strip`] [#6038](https://github.com/rust-lang/rust-clippy/pull/6038)
* [`map_err_ignore`] [#5998](https://github.com/rust-lang/rust-clippy/pull/5998)
* [`rc_buffer`] [#6044](https://github.com/rust-lang/rust-clippy/pull/6044)
* [`to_string_in_display`] [#5831](https://github.com/rust-lang/rust-clippy/pull/5831)
* [`single_char_push_str`] [#5881](https://github.com/rust-lang/rust-clippy/pull/5881)

### Moves and Deprecations

* Downgrade [`verbose_bit_mask`] to pedantic
[#6036](https://github.com/rust-lang/rust-clippy/pull/6036)

### Enhancements

* Extend [`precedence`] to handle chains of methods combined with unary negation
[#5928](https://github.com/rust-lang/rust-clippy/pull/5928)
* [`useless_vec`]: add a configuration value for the maximum allowed size on the stack
[#5907](https://github.com/rust-lang/rust-clippy/pull/5907)
* [`suspicious_arithmetic_impl`]: extend to implementations of `BitAnd`, `BitOr`, `BitXor`, `Rem`, `Shl`, and `Shr`
[#5884](https://github.com/rust-lang/rust-clippy/pull/5884)
* [`invalid_atomic_ordering`]: detect misuse of `compare_exchange`, `compare_exchange_weak`, and `fetch_update`
[#6025](https://github.com/rust-lang/rust-clippy/pull/6025)
* Avoid [`redundant_pattern_matching`] triggering in macros
[#6069](https://github.com/rust-lang/rust-clippy/pull/6069)
* [`option_if_let_else`]: distinguish pure from impure `else` expressions
[#5937](https://github.com/rust-lang/rust-clippy/pull/5937)
* [`needless_doctest_main`]: parse doctests instead of using textual search
[#5912](https://github.com/rust-lang/rust-clippy/pull/5912)
* [`wildcard_imports`]: allow `prelude` to appear in any segment of an import
[#5929](https://github.com/rust-lang/rust-clippy/pull/5929)
* Re-enable [`len_zero`] for ranges now that `range_is_empty` is stable
[#5961](https://github.com/rust-lang/rust-clippy/pull/5961)
* [`option_as_ref_deref`]: catch fully-qualified calls to `Deref::deref` and `DerefMut::deref_mut`
[#5933](https://github.com/rust-lang/rust-clippy/pull/5933)

### False Positive Fixes

* [`useless_attribute`]: permit allowing [`wildcard_imports`] and [`enum_glob_use`]
[#5994](https://github.com/rust-lang/rust-clippy/pull/5994)
* [`transmute_ptr_to_ptr`]: avoid suggesting dereferencing raw pointers in const contexts
[#5999](https://github.com/rust-lang/rust-clippy/pull/5999)
* [`redundant_closure_call`]: take into account usages of the closure in nested functions and closures
[#5920](https://github.com/rust-lang/rust-clippy/pull/5920)
* Fix false positive in [`borrow_interior_mutable_const`] when referencing a field behind a pointer
[#5949](https://github.com/rust-lang/rust-clippy/pull/5949)
* [`doc_markdown`]: allow using "GraphQL" without backticks
[#5996](https://github.com/rust-lang/rust-clippy/pull/5996)
* [`to_string_in_display`]: avoid linting when calling `to_string()` on anything that is not `self`
[#5971](https://github.com/rust-lang/rust-clippy/pull/5971)
* [`indexing_slicing`] and [`out_of_bounds_indexing`] treat references to arrays as arrays
[#6034](https://github.com/rust-lang/rust-clippy/pull/6034)
* [`should_implement_trait`]: ignore methods with lifetime parameters
[#5725](https://github.com/rust-lang/rust-clippy/pull/5725)
* [`needless_return`]: avoid linting if a temporary borrows a local variable
[#5903](https://github.com/rust-lang/rust-clippy/pull/5903)
* Restrict [`unnecessary_sort_by`] to non-reference, Copy types
[#6006](https://github.com/rust-lang/rust-clippy/pull/6006)
* Avoid suggesting `from_bits`/`to_bits` in const contexts in [`transmute_int_to_float`]
[#5919](https://github.com/rust-lang/rust-clippy/pull/5919)
* [`declare_interior_mutable_const`] and [`borrow_interior_mutable_const`]: improve detection of interior mutable types
[#6046](https://github.com/rust-lang/rust-clippy/pull/6046)

### Suggestion Fixes/Improvements

* [`let_and_return`]: add a cast to the suggestion when the return expression has adjustments
[#5946](https://github.com/rust-lang/rust-clippy/pull/5946)
* [`useless_conversion`]: show the type in the error message
[#6035](https://github.com/rust-lang/rust-clippy/pull/6035)
* [`unnecessary_mut_passed`]: discriminate between functions and methods in the error message
[#5892](https://github.com/rust-lang/rust-clippy/pull/5892)
* [`float_cmp`] and [`float_cmp_const`]: change wording to make margin of error less ambiguous
[#6043](https://github.com/rust-lang/rust-clippy/pull/6043)
* [`default_trait_access`]: do not use unnecessary type parameters in the suggestion
[#5993](https://github.com/rust-lang/rust-clippy/pull/5993)
* [`collapsible_if`]: don't use expanded code in the suggestion
[#5992](https://github.com/rust-lang/rust-clippy/pull/5992)
* Do not suggest empty format strings in [`print_with_newline`] and [`write_with_newline`]
[#6042](https://github.com/rust-lang/rust-clippy/pull/6042)
* [`unit_arg`]: improve the readability of the suggestion
[#5931](https://github.com/rust-lang/rust-clippy/pull/5931)
* [`stable_sort_primitive`]: print the type that is being sorted in the lint message
[#5935](https://github.com/rust-lang/rust-clippy/pull/5935)
* Show line count and max lines in [`too_many_lines`] lint message
[#6009](https://github.com/rust-lang/rust-clippy/pull/6009)
* Keep parentheses in the suggestion of [`useless_conversion`] where applicable
[#5900](https://github.com/rust-lang/rust-clippy/pull/5900)
* [`option_map_unit_fn`] and [`result_map_unit_fn`]: print the unit type `()` explicitly
[#6024](https://github.com/rust-lang/rust-clippy/pull/6024)
* [`redundant_allocation`]: suggest replacing `Rc<Box<T>>` with `Rc<T>`
[#5899](https://github.com/rust-lang/rust-clippy/pull/5899)
* Make lint messages adhere to rustc dev guide conventions
[#5893](https://github.com/rust-lang/rust-clippy/pull/5893)

### ICE Fixes

* Fix ICE in [`repeat_once`]
[#5948](https://github.com/rust-lang/rust-clippy/pull/5948)

### Documentation Improvements

* [`mutable_key_type`]: explain potential for false positives when the interior mutable type is not accessed in the `Hash` implementation
[#6019](https://github.com/rust-lang/rust-clippy/pull/6019)
* [`unnecessary_mut_passed`]: fix typo
[#5913](https://github.com/rust-lang/rust-clippy/pull/5913)
* Add example of false positive to [`ptr_arg`] docs.
[#5885](https://github.com/rust-lang/rust-clippy/pull/5885)
* [`box_vec`], [`vec_box`] and [`borrowed_box`]: add link to the documentation of `Box`
[#6023](https://github.com/rust-lang/rust-clippy/pull/6023)

## Rust 1.47

Current beta, release 2020-10-08
Current stable, released 2020-10-08

[c2c07fa...09bd400](https://github.com/rust-lang/rust-clippy/compare/c2c07fa...09bd400)

Expand Down Expand Up @@ -112,7 +230,7 @@ Current beta, release 2020-10-08

## Rust 1.46

Current stable, released 2020-08-27
Released 2020-08-27

[7ea7cd1...c2c07fa](https://github.com/rust-lang/rust-clippy/compare/7ea7cd1...c2c07fa)

Expand Down Expand Up @@ -1559,6 +1677,7 @@ Released 2018-09-13
[`deref_addrof`]: https://rust-lang.github.io/rust-clippy/master/index.html#deref_addrof
[`derive_hash_xor_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
[`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
[`disallowed_method`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_method
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
Expand Down Expand Up @@ -1634,6 +1753,8 @@ Released 2018-09-13
[`inherent_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string
[`inherent_to_string_shadow_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string_shadow_display
[`inline_always`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_always
[`inline_asm_x86_att_syntax`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_asm_x86_att_syntax
[`inline_asm_x86_intel_syntax`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_asm_x86_intel_syntax
[`inline_fn_without_body`]: https://rust-lang.github.io/rust-clippy/master/index.html#inline_fn_without_body
[`int_plus_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#int_plus_one
[`integer_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic
Expand All @@ -1644,6 +1765,7 @@ Released 2018-09-13
[`invalid_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_ref
[`invalid_regex`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_regex
[`invalid_upcast_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_upcast_comparisons
[`invisible_characters`]: https://rust-lang.github.io/rust-clippy/master/index.html#invisible_characters
[`items_after_statements`]: https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
[`iter_cloned_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_cloned_collect
[`iter_next_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_next_loop
Expand Down Expand Up @@ -1919,6 +2041,5 @@ Released 2018-09-13
[`zero_divided_by_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#zero_divided_by_zero
[`zero_prefixed_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal
[`zero_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#zero_ptr
[`zero_width_space`]: https://rust-lang.github.io/rust-clippy/master/index.html#zero_width_space
[`zst_offset`]: https://rust-lang.github.io/rust-clippy/master/index.html#zst_offset
<!-- end autogenerated links to lint list -->
2 changes: 1 addition & 1 deletion src/tools/clippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.

[There are over 350 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
[There are over 400 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)

We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ edition = "2018"
bytecount = "0.6"
clap = "2.33"
itertools = "0.9"
opener = "0.4"
regex = "1"
lazy_static = "1.0"
shell-escape = "0.1"
walkdir = "2"

Expand Down
43 changes: 24 additions & 19 deletions src/tools/clippy/clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![feature(once_cell)]

use itertools::Itertools;
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs;
use std::lazy::SyncLazy;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;

pub mod fmt;
pub mod new_lint;
pub mod ra_setup;
pub mod serve;
pub mod stderr_length_check;
pub mod update_lints;

lazy_static! {
static ref DEC_CLIPPY_LINT_RE: Regex = Regex::new(
static DEC_CLIPPY_LINT_RE: SyncLazy<Regex> = SyncLazy::new(|| {
Regex::new(
r#"(?x)
declare_clippy_lint!\s*[\{(]
(?:\s+///.*)*
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
(?P<cat>[a-z_]+)\s*,\s*
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
"#
declare_clippy_lint!\s*[\{(]
(?:\s+///.*)*
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
(?P<cat>[a-z_]+)\s*,\s*
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
"#,
)
.unwrap();
static ref DEC_DEPRECATED_LINT_RE: Regex = Regex::new(
.unwrap()
});

static DEC_DEPRECATED_LINT_RE: SyncLazy<Regex> = SyncLazy::new(|| {
Regex::new(
r#"(?x)
declare_deprecated_lint!\s*[{(]\s*
(?:\s+///.*)*
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
"#
declare_deprecated_lint!\s*[{(]\s*
(?:\s+///.*)*
\s+pub\s+(?P<name>[A-Z_][A-Z_0-9]*)\s*,\s*
"(?P<desc>(?:[^"\\]+|\\(?s).(?-s))*)"\s*[})]
"#,
)
.unwrap();
static ref NL_ESCAPE_RE: Regex = Regex::new(r#"\\\n\s*"#).unwrap();
}
.unwrap()
});
static NL_ESCAPE_RE: SyncLazy<Regex> = SyncLazy::new(|| Regex::new(r#"\\\n\s*"#).unwrap());

pub static DOCS_LINK: &str = "https://rust-lang.github.io/rust-clippy/master/index.html";

Expand Down
20 changes: 19 additions & 1 deletion src/tools/clippy/clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]

use clap::{App, Arg, SubCommand};
use clippy_dev::{fmt, new_lint, ra_setup, stderr_length_check, update_lints};
use clippy_dev::{fmt, new_lint, ra_setup, serve, stderr_length_check, update_lints};

fn main() {
let matches = App::new("Clippy developer tooling")
Expand Down Expand Up @@ -100,6 +100,19 @@ fn main() {
.required(true),
),
)
.subcommand(
SubCommand::with_name("serve")
.about("Launch a local 'ALL the Clippy Lints' website in a browser")
.arg(
Arg::with_name("port")
.long("port")
.short("p")
.help("Local port for the http server")
.default_value("8000")
.validator_os(serve::validate_port),
)
.arg(Arg::with_name("lint").help("Which lint's page to load initially (optional)")),
)
.get_matches();

match matches.subcommand() {
Expand Down Expand Up @@ -129,6 +142,11 @@ fn main() {
stderr_length_check::check();
},
("ra-setup", Some(matches)) => ra_setup::run(matches.value_of("rustc-repo-path")),
("serve", Some(matches)) => {
let port = matches.value_of("port").unwrap().parse().unwrap();
let lint = matches.value_of("lint");
serve::run(port, lint);
},
_ => {},
}
}
64 changes: 64 additions & 0 deletions src/tools/clippy/clippy_dev/src/serve.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
use std::ffi::{OsStr, OsString};
use std::path::Path;
use std::process::Command;
use std::thread;
use std::time::{Duration, SystemTime};

pub fn run(port: u16, lint: Option<&str>) -> ! {
let mut url = Some(match lint {
None => format!("http://localhost:{}", port),
Some(lint) => format!("http://localhost:{}/#{}", port, lint),
});

loop {
if mtime("util/gh-pages/lints.json") < mtime("clippy_lints/src") {
Command::new("python3")
.arg("util/export.py")
.spawn()
.unwrap()
.wait()
.unwrap();
}
if let Some(url) = url.take() {
thread::spawn(move || {
Command::new("python3")
.arg("-m")
.arg("http.server")
.arg(port.to_string())
.current_dir("util/gh-pages")
.spawn()
.unwrap();
// Give some time for python to start
thread::sleep(Duration::from_millis(500));
// Launch browser after first export.py has completed and http.server is up
let _ = opener::open(url);
});
}
thread::sleep(Duration::from_millis(1000));
}
}

fn mtime(path: impl AsRef<Path>) -> SystemTime {
let path = path.as_ref();
if path.is_dir() {
path.read_dir()
.into_iter()
.flatten()
.flatten()
.map(|entry| mtime(&entry.path()))
.max()
.unwrap_or(SystemTime::UNIX_EPOCH)
} else {
path.metadata()
.and_then(|metadata| metadata.modified())
.unwrap_or(SystemTime::UNIX_EPOCH)
}
}

#[allow(clippy::missing_errors_doc)]
pub fn validate_port(arg: &OsStr) -> Result<(), OsString> {
match arg.to_string_lossy().parse::<u16>() {
Ok(_port) => Ok(()),
Err(err) => Err(OsString::from(err.to_string())),
}
}
1 change: 0 additions & 1 deletion src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ edition = "2018"
cargo_metadata = "0.11.1"
if_chain = "1.0.0"
itertools = "0.9"
lazy_static = "1.0.2"
pulldown-cmark = { version = "0.8", default-features = false }
quine-mc_cluskey = "0.2.2"
regex-syntax = "0.6"
Expand Down
Loading