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 #111255

Merged
merged 138 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
8889587
Merge from rustc
RalfJung Mar 22, 2023
95bb486
Merge from rustc
oli-obk Mar 23, 2023
b6495af
Merge from rustc
RalfJung Mar 24, 2023
a937f49
Merge from rustc
oli-obk Apr 4, 2023
f5ac844
Refactor unwind from Option to a new enum
nbdd0121 Oct 8, 2022
293c1a1
Fix tools
nbdd0121 Oct 10, 2022
0963a66
Make elaborator generic
compiler-errors Apr 6, 2023
d048c11
Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naber
bors Apr 9, 2023
fe129a0
Merge from rustc
saethlin Apr 10, 2023
6b95029
Merge commit '83e42a2337dadac915c956d125f1d69132f36425' into clippyup
flip1995 Apr 11, 2023
5989400
resolve: Pre-compute non-reexport module children
petrochenkov Apr 10, 2023
7a0fb90
Tweak output for 'add line' suggestion
estebank Mar 18, 2023
4680aa2
Special-case item attributes in the suggestion output
estebank Apr 10, 2023
d61570c
Auto merge of #110160 - petrochenkov:notagain2, r=cjgillot
bors Apr 14, 2023
8f53926
Alloc `hir::Lit` in an arena to remove the destructor from `Expr`
Noratrieb Mar 25, 2023
0a81f82
add `semicolon_outside_block_if_singleline` lint
Centri3 Apr 17, 2023
dfccebe
make cargo test pass
Centri3 Apr 17, 2023
a7c3301
refactor
Centri3 Apr 17, 2023
a57445d
make cargo test pass, again
Centri3 Apr 17, 2023
80707aa
improve description a bit
Centri3 Apr 17, 2023
f85928f
Merge from rustc
oli-obk Apr 17, 2023
89f0aaa
Force -Zflatten-format-args=no in Clippy.
m-ou-se Apr 17, 2023
fa1efa8
refactor
Centri3 Apr 18, 2023
2ebfbc5
Remove very useless `as_substs` usage from clippy
WaffleLapkin Apr 18, 2023
1dfc231
clippy: add test for https://github.com/rust-lang/rust-clippy/issues/…
matthiaskrgr Apr 18, 2023
d3b1001
Auto merge of #110496 - WaffleLapkin:🏳️‍⚧️sound, r=compiler-errors
bors Apr 19, 2023
2745c87
Dont suggest suboptimal_flops unavailable in nostd
lukaslueg Apr 19, 2023
a3aeec4
config instead of new lint and don't panic
Centri3 Apr 20, 2023
41f6d88
make cargo test pass
Centri3 Apr 20, 2023
8ead58c
Remove WithOptconstParam.
cjgillot May 8, 2022
afa28e6
change usages of explicit_item_bounds to bound_explicit_item_bounds
kylematsuda Apr 17, 2023
097309c
add EarlyBinder to output of explicit_item_bounds; replace bound_expl…
kylematsuda Apr 17, 2023
55d8146
add subst_identity_iter and subst_identity_iter_copied methods on Ear…
kylematsuda Apr 17, 2023
654d12f
use is_inside_const_context query for in_constant
y21 Apr 20, 2023
e8197b1
Auto merge of #109999 - m-ou-se:flatten-format-args, r=oli-obk
bors Apr 20, 2023
84bab31
Auto merge of #96840 - cjgillot:query-feed, r=oli-obk
bors Apr 21, 2023
68c4776
offset_of
beepster4096 Sep 11, 2022
85d7de2
fix false positive
Centri3 Apr 21, 2023
cb3e0fb
Evaluate place expression in `PlaceMention`.
cjgillot Nov 24, 2022
7f13e6d
Allow `LocalDefId` as the argument to `def_path_str`
oli-obk Feb 16, 2023
86d8f12
Auto merge of #106934 - DrMeepster:offset_of, r=WaffleLapkin
bors Apr 22, 2023
a43708a
Merge from rustc
RalfJung Apr 22, 2023
f30fc0a
Auto merge of #104844 - cjgillot:mention-eval-place, r=jackh726,RalfJung
bors Apr 22, 2023
628605e
Ignore `shadow` warns in code from macro expansions
lochetti Apr 22, 2023
583c97e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Apr 23, 2023
0add5bb
Bump Clippy version -> 0.1.71
flip1995 Apr 23, 2023
d5a2c2b
Bump nightly version -> 2023-04-23
flip1995 Apr 23, 2023
36bf3ef
Fix dogfood test
flip1995 Apr 23, 2023
acf50a7
Improve the help message + add a help span
blyxyas Apr 23, 2023
f16bfa4
Auto merge of #10703 - flip1995:rustup, r=flip1995
bors Apr 23, 2023
a1b75c5
Merge commit 'a3ed905928a03b6e433d0b429190bf3a847128b3' into clippyup
flip1995 Apr 23, 2023
69da902
Detect if expressions with boolean assignments to the same target
samueltardieu Feb 26, 2023
572eecd
split test into 2
matthiaskrgr Apr 23, 2023
316d83a
Auto merge of #10670 - lukaslueg:issue10634, r=Jarcho
bors Apr 23, 2023
496c110
Auto merge of #10679 - y21:better-const-ctx-check, r=Jarcho
bors Apr 23, 2023
4ed4869
Auto merge of #108118 - oli-obk:lazy_typeck, r=cjgillot
bors Apr 23, 2023
e1f6305
Auto merge of #10704 - matthiaskrgr:splitest, r=llogiq
bors Apr 23, 2023
022baa5
Remove check for `lib.register_*` and `src/docs*` in `cargo dev updat…
Alexendoo Apr 23, 2023
797a7fe
Auto merge of #10706 - Alexendoo:remove-old-generated-files-check, r=…
bors Apr 23, 2023
d2061fa
Spelling
jsoref Apr 13, 2023
6f7801f
Rewrite search_same description
jsoref Apr 17, 2023
7a870ae
Auto merge of #10432 - samueltardieu:issue-10430, r=Manishearth
bors Apr 23, 2023
e8726b2
also check for rest pat in `redundant_pattern_matching`
y21 Apr 23, 2023
96f8471
Auto merge of #10649 - jsoref:spelling, r=Jarcho
bors Apr 23, 2023
5161c4c
Auto merge of #10697 - lochetti:fix_9757, r=dswij
bors Apr 24, 2023
6c859b6
Clippy book: hotfix for broken link
flip1995 Apr 24, 2023
26f9fce
Merge from rustc
RalfJung Apr 24, 2023
3045998
Update allow_attributes_false_positive.rs
Centri3 Apr 24, 2023
4b6fdb4
Auto merge of #10683 - Centri3:allow-attributes, r=Alexendoo
bors Apr 24, 2023
30db6ed
Auto merge of #10707 - y21:redudant_pattern_matching_rest_pat, r=Mani…
bors Apr 24, 2023
c4f2c48
Auto merge of #10702 - blyxyas:fix-let_underscore_untyped_help_messag…
bors Apr 24, 2023
5514d9f
Auto merge of #110718 - flip1995:clippyup, r=Manishearth
bors Apr 24, 2023
4a76b6f
Add the warning to all documentation.
blyxyas Apr 24, 2023
acfb2c4
don't check if from macro invocation
Centri3 Apr 18, 2023
8efe9ff
run cargo dev fmt
Centri3 Apr 18, 2023
1ac30d3
make cargo test pass
Centri3 Apr 18, 2023
14a6fa4
use in_external_macro
Centri3 Apr 20, 2023
abd2c1e
Auto merge of #10665 - Centri3:string_lit_as_bytes_changes, r=giraffate
bors Apr 25, 2023
637d10b
Catching, stray, commas, (I'll, never, learn, to, use, them, correctl…
xFrednet Apr 25, 2023
aa6c27a
change names to not be implicitly negative
Centri3 Apr 25, 2023
e3ee10d
use `//@` for commands in tests
Centri3 Apr 25, 2023
9cf9642
Use `ty::TraitRef::new` in clippy
WaffleLapkin Apr 25, 2023
19465c9
Auto merge of #10715 - xFrednet:changelog-1-69, r=llogiq
bors Apr 25, 2023
a7335cb
Auto merge of #10712 - blyxyas:fix-fixflag_implies_all_targets, r=llogiq
bors Apr 25, 2023
331c547
Rollup merge of #110556 - kylematsuda:earlybinder-explicit-item-bound…
matthiaskrgr Apr 25, 2023
8c8cf40
Update lint_configuration.md
Centri3 Apr 25, 2023
990bbdc
Auto merge of #10656 - Centri3:master, r=xFrednet
bors Apr 25, 2023
92645b0
Merge from rustc
RalfJung Apr 26, 2023
9564895
Fix uses of `TraitRef::identity` in clippy and rustdoc
WaffleLapkin Apr 26, 2023
9428138
adds lint to detect construction of unit struct using `default`
Icxolu Apr 25, 2023
0339d4e
rename `needs_infer` to `has_infer`
BoxyUwU Apr 27, 2023
273c898
Fix #10713 and move the tests to a subdir
blyxyas Apr 27, 2023
83504fa
Make clippy happy
compiler-errors Apr 25, 2023
19b3b22
Merge from rustc
RalfJung Apr 28, 2023
d1f55e6
run linkcheck in Remark CI
SergenKaraoglan Apr 27, 2023
b7939f4
Auto merge of #10720 - SergenKaraoglan:personal, r=flip1995
bors Apr 28, 2023
81a6141
uplift `clippy::clone_double_ref` as `suspicious_double_ref_op`
fee1-dead Apr 28, 2023
f37054b
Remove useless span magic
blyxyas Apr 28, 2023
2b5820d
Change module import system
blyxyas Apr 28, 2023
395b1f5
Rename items + Delete `imported_module.stderr`
blyxyas Apr 28, 2023
3594d55
Auto merge of #10719 - blyxyas:fix-items_after_test_mod_imported_modu…
bors Apr 28, 2023
2ed254e
Clarify docs for RESULT_LARGE_ERR
lukaslueg Apr 29, 2023
bb58083
new lint: `while_pop_unwrap`
y21 Apr 4, 2023
bcdcc34
elide lifetimes, get rid of glob import
y21 Apr 15, 2023
1d08325
move lint to loops, emit proper suggestion, more tests
y21 Apr 17, 2023
ab9b7a5
remove unnecessary reference
y21 Apr 17, 2023
f10e39f
make PopStmt copy+clone
y21 Apr 17, 2023
8d8178f
rename lint to `manual_while_let_some`
y21 Apr 19, 2023
9613ea8
fix run-rustfix directive
y21 Apr 29, 2023
7bc3da9
Auto merge of #10647 - y21:while_pop_unwrap, r=llogiq
bors Apr 29, 2023
032bc11
fix diagnostic message style
Icxolu Apr 29, 2023
de4bc66
Merge from rustc
RalfJung Apr 30, 2023
d4baabe
clean up Colon from clippy
chenyukang Mar 14, 2023
5749054
globally ignore `#[no_std]` crates
blyxyas May 1, 2023
8354b34
Auto merge of #111036 - RalfJung:miri, r=RalfJung
bors May 1, 2023
220a9db
fixed span and corrected test output
Icxolu May 1, 2023
824f2e7
Auto merge of #10724 - lukaslueg:largeerrdocs, r=giraffate
bors May 2, 2023
eac589b
Rollup merge of #110955 - fee1-dead-contrib:sus-operation, r=compiler…
Dylan-DPC May 2, 2023
d36bde7
Auto merge of #109128 - chenyukang:yukang/remove-type-ascription, r=e…
bors May 2, 2023
0dd2501
Don't ignore `check_radians`
blyxyas May 2, 2023
431cce1
Restrict `From<S>` for `{D,Subd}iagnosticMessage`.
nnethercote Apr 20, 2023
7e24ff3
Update macros.rs
smoelius May 2, 2023
9353170
Auto merge of #10730 - blyxyas:no_std_mul_add, r=Jarcho
bors May 3, 2023
c2e0d43
Auto merge of #10734 - smoelius:patch-2, r=Alexendoo
bors May 3, 2023
4e04903
rename to plural form
Icxolu May 3, 2023
8701009
add more test cases
Icxolu May 3, 2023
4ed7fd1
fix failing tests
Icxolu May 3, 2023
1603715
add `rustfix` annotation
Icxolu May 3, 2023
48ae5a0
fix lint docs
Icxolu May 3, 2023
f9c1d15
Auto merge of #10716 - Icxolu:unitstruct_default_construction, r=Mani…
bors May 3, 2023
8518391
Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr
bors May 4, 2023
0f7b61d
Inherit stdout/stderr for `cargo dev dogfood`
Alexendoo May 5, 2023
d7173e2
Auto merge of #10747 - Alexendoo:cargo-dev-dogfood-stdout, r=flip1995
bors May 5, 2023
88c7632
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 May 5, 2023
79656cc
Bump nightly version -> 2023-05-05
flip1995 May 5, 2023
371120b
Auto merge of #10749 - flip1995:rustup, r=flip1995
bors May 5, 2023
4cb0519
Merge commit '371120bdbf58a331db5dcfb2d9cddc040f486de8' into clippyup
flip1995 May 5, 2023
b53c1bb
Update Cargo.lock
flip1995 May 5, 2023
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
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"

[[package]]
name = "clippy"
version = "0.1.70"
version = "0.1.71"
dependencies = [
"clap 4.2.1",
"clippy_lints",
Expand Down Expand Up @@ -619,7 +619,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.70"
version = "0.1.71"
dependencies = [
"arrayvec",
"cargo_metadata 0.15.3",
Expand All @@ -643,7 +643,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.70"
version = "0.1.71"
dependencies = [
"arrayvec",
"if_chain",
Expand Down Expand Up @@ -969,7 +969,7 @@ checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"

[[package]]
name = "declare_clippy_lint"
version = "0.1.70"
version = "0.1.71"
dependencies = [
"itertools",
"quote",
Expand Down
6 changes: 6 additions & 0 deletions src/tools/clippy/.github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
- name: Check *.md files
run: git ls-files -z '*.md' | xargs -0 -n 1 -I {} ./node_modules/.bin/remark {} -u lint -f > /dev/null

- name: Linkcheck book
run: |
rustup toolchain install nightly --component rust-docs
curl https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh -o linkcheck.sh
sh linkcheck.sh clippy --path ./book

- name: Build mdbook
run: mdbook build book

Expand Down
25 changes: 14 additions & 11 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Current stable, released 2023-04-20

### Enhancements

* [`arithmetic_side_effects`]: No longer lints, if safe constant values are used.
* [`arithmetic_side_effects`]: No longer lints if safe constant values are used.
[#10310](https://github.com/rust-lang/rust-clippy/pull/10310)
* [`needless_lifetimes`]: Now works in local macros
[#10257](https://github.com/rust-lang/rust-clippy/pull/10257)
Expand All @@ -60,39 +60,39 @@ Current stable, released 2023-04-20

### False Positive Fixes

* [`explicit_auto_deref`]: Now considers projections, when determining if auto deref is applicable
* [`explicit_auto_deref`]: Now considers projections when determining if auto deref is applicable
[#10386](https://github.com/rust-lang/rust-clippy/pull/10386)
* [`manual_let_else`]: Now considers side effects of branches, before linting
* [`manual_let_else`]: Now considers side effects of branches before linting
[#10336](https://github.com/rust-lang/rust-clippy/pull/10336)
* [`uninlined_format_args`]: No longer lints for arguments with generic parameters
[#10343](https://github.com/rust-lang/rust-clippy/pull/10343)
* [`needless_lifetimes`]: No longer lints signatures in macros, if the lifetime is a metavariable
* [`needless_lifetimes`]: No longer lints signatures in macros if the lifetime is a metavariable
[#10380](https://github.com/rust-lang/rust-clippy/pull/10380)
* [`len_without_is_empty`]: No longer lints, if `len` as a non-default signature
* [`len_without_is_empty`]: No longer lints if `len` as a non-default signature
[#10255](https://github.com/rust-lang/rust-clippy/pull/10255)
* [`unusual_byte_groupings`]: Relaxed the required restrictions for specific sizes, to reduce false
* [`unusual_byte_groupings`]: Relaxed the required restrictions for specific sizes to reduce false
positives
[#10353](https://github.com/rust-lang/rust-clippy/pull/10353)
* [`manual_let_else`]: No longer lints `if-else` blocks if they can divergent
[#10332](https://github.com/rust-lang/rust-clippy/pull/10332)
* [`expect_used`], [`unwrap_used`], [`dbg_macro`], [`print_stdout`], [`print_stderr`]: No longer lint
in test functions, if `allow-expect-in-tests` is set
in test functions if `allow-expect-in-tests` is set
[#10391](https://github.com/rust-lang/rust-clippy/pull/10391)
* [`unnecessary_safety_comment`]: No longer lints code inside macros
[#10106](https://github.com/rust-lang/rust-clippy/pull/10106)
* [`never_loop`]: No longer lints, for statements following break statements for outer blocks.
* [`never_loop`]: No longer lints statements following break statements for outer blocks.
[#10311](https://github.com/rust-lang/rust-clippy/pull/10311)

### Suggestion Fixes/Improvements

* [`box_default`]: The suggestion now includes the type for trait objects, when needed
* [`box_default`]: The suggestion now includes the type for trait objects when needed
[#10382](https://github.com/rust-lang/rust-clippy/pull/10382)
* [`cast_possible_truncation`]: Now suggests using `try_from` or allowing the lint
[#10038](https://github.com/rust-lang/rust-clippy/pull/10038)
* [`invalid_regex`]: Regex errors for non-literals or regular strings containing escape sequences will
now show the complete error
[#10231](https://github.com/rust-lang/rust-clippy/pull/10231)
* [`transmutes_expressible_as_ptr_casts`]: The suggestion now works, if the base type is borrowed
* [`transmutes_expressible_as_ptr_casts`]: The suggestion now works if the base type is borrowed
[#10193](https://github.com/rust-lang/rust-clippy/pull/10193)
* [`needless_return`]: Now removes all semicolons on the same line
[#10187](https://github.com/rust-lang/rust-clippy/pull/10187)
Expand All @@ -113,7 +113,7 @@ Current stable, released 2023-04-20

### ICE Fixes

* [`needless_pass_by_value`]: Fixed an ICE, caused by how late bounds were handled
* [`needless_pass_by_value`]: Fixed an ICE caused by how late bounds were handled
[#10328](https://github.com/rust-lang/rust-clippy/pull/10328)
* [`needless_borrow`]: No longer panics on ambiguous projections
[#10403](https://github.com/rust-lang/rust-clippy/pull/10403)
Expand Down Expand Up @@ -4582,6 +4582,7 @@ Released 2018-09-13
[`debug_assert_with_mut_call`]: https://rust-lang.github.io/rust-clippy/master/index.html#debug_assert_with_mut_call
[`decimal_literal_representation`]: https://rust-lang.github.io/rust-clippy/master/index.html#decimal_literal_representation
[`declare_interior_mutable_const`]: https://rust-lang.github.io/rust-clippy/master/index.html#declare_interior_mutable_const
[`default_constructed_unit_structs`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
[`default_instead_of_iter_empty`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_instead_of_iter_empty
[`default_numeric_fallback`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_numeric_fallback
[`default_trait_access`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access
Expand Down Expand Up @@ -4797,6 +4798,7 @@ Released 2018-09-13
[`manual_strip`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip
[`manual_swap`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_swap
[`manual_unwrap_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or
[`manual_while_let_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_while_let_some
[`many_single_char_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names
[`map_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
[`map_collect_result_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_collect_result_unit
Expand Down Expand Up @@ -4864,6 +4866,7 @@ Released 2018-09-13
[`needless_arbitrary_self_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_arbitrary_self_type
[`needless_bitwise_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bitwise_bool
[`needless_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool
[`needless_bool_assign`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool_assign
[`needless_borrow`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
[`needless_borrowed_reference`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
[`needless_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.70"
version = "0.1.71"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ cargo clippy

#### Automatically applying Clippy suggestions

Clippy can automatically apply some lint suggestions, just like the compiler.
Clippy can automatically apply some lint suggestions, just like the compiler. Note that `--fix` implies
`--all-targets`, so it can fix as much code as it can.

```terminal
cargo clippy --fix
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/lint_passes.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ questions already, but the parser is okay with it. This is what we
mean when we say `EarlyLintPass` deals with only syntax on the AST level.

Alternatively, think of the `foo_functions` lint we mentioned in
define new lints chapter.
define new lints <!-- FIXME: add link --> chapter.

We want the `foo_functions` lint to detect functions with `foo` as their name.
Writing a lint that only checks for the name of a function means that we only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ whether the pattern matched.

## Pattern syntax

The following examples demonstate the pattern syntax:
The following examples demonstrate the pattern syntax:


#### Any (`_`)
Expand Down
18 changes: 18 additions & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Please use that command to update the file and do not edit it by hand.
| [msrv](#msrv) | `None` |
| [cognitive-complexity-threshold](#cognitive-complexity-threshold) | `25` |
| [disallowed-names](#disallowed-names) | `["foo", "baz", "quux"]` |
| [semicolon-inside-block-ignore-singleline](#semicolon-inside-block-ignore-singleline) | `false` |
| [semicolon-outside-block-ignore-multiline](#semicolon-outside-block-ignore-multiline) | `false` |
| [doc-valid-idents](#doc-valid-idents) | `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PureScript", "TypeScript", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenDNS", "WebGL", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]` |
| [too-many-arguments-threshold](#too-many-arguments-threshold) | `7` |
| [type-complexity-threshold](#type-complexity-threshold) | `250` |
Expand Down Expand Up @@ -203,6 +205,22 @@ default configuration of Clippy. By default, any configuration will replace the
* [disallowed_names](https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names)


### semicolon-inside-block-ignore-singleline
Whether to lint only if it's multiline.

**Default Value:** `false` (`bool`)

* [semicolon_inside_block](https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_inside_block)


### semicolon-outside-block-ignore-multiline
Whether to lint only if it's singleline.

**Default Value:** `false` (`bool`)

* [semicolon_outside_block](https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_outside_block)


### doc-valid-idents
The list of words this lint should not consider as identifiers needing ticks. The value
`".."` can be used as part of the list to indicate, that the configured values should be appended to the
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/book/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ fn main() {

### Automatically applying Clippy suggestions

Clippy can automatically apply some lint suggestions, just like the compiler.
Clippy can automatically apply some lint suggestions, just like the compiler. Note that `--fix` implies
`--all-targets`, so it can fix as much code as it can.

```terminal
cargo clippy --fix
Expand Down
8 changes: 3 additions & 5 deletions src/tools/clippy/clippy_dev/src/dogfood.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::clippy_project_root;
use crate::{clippy_project_root, exit_if_err};
use std::process::Command;

/// # Panics
Expand All @@ -10,7 +10,7 @@ pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
cmd.current_dir(clippy_project_root())
.args(["test", "--test", "dogfood"])
.args(["--features", "internal"])
.args(["--", "dogfood_clippy"]);
.args(["--", "dogfood_clippy", "--nocapture"]);

let mut dogfood_args = Vec::new();
if fix {
Expand All @@ -27,7 +27,5 @@ pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {

cmd.env("__CLIPPY_DOGFOOD_ARGS", dogfood_args.join(" "));

let output = cmd.output().expect("failed to run command");

println!("{}", String::from_utf8_lossy(&output.stdout));
exit_if_err(cmd.status());
}
13 changes: 13 additions & 0 deletions src/tools/clippy/clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
extern crate rustc_driver;
extern crate rustc_lexer;

use std::io;
use std::path::PathBuf;
use std::process::{self, ExitStatus};

pub mod bless;
pub mod dogfood;
Expand Down Expand Up @@ -58,3 +60,14 @@ pub fn clippy_project_root() -> PathBuf {
}
panic!("error: Can't determine root of project. Please run inside a Clippy working dir.");
}

pub fn exit_if_err(status: io::Result<ExitStatus>) {
match status.expect("failed to run command").code() {
Some(0) => {},
Some(n) => process::exit(n),
None => {
eprintln!("Killed by signal");
process::exit(1);
},
}
}
17 changes: 3 additions & 14 deletions src/tools/clippy/clippy_dev/src/lint.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
use crate::cargo_clippy_path;
use std::process::{self, Command, ExitStatus};
use std::{fs, io};

fn exit_if_err(status: io::Result<ExitStatus>) {
match status.expect("failed to run command").code() {
Some(0) => {},
Some(n) => process::exit(n),
None => {
eprintln!("Killed by signal");
process::exit(1);
},
}
}
use crate::{cargo_clippy_path, exit_if_err};
use std::fs;
use std::process::{self, Command};

pub fn run<'a>(path: &str, args: impl Iterator<Item = &'a String>) {
let is_file = match fs::metadata(path) {
Expand Down
54 changes: 0 additions & 54 deletions src/tools/clippy/clippy_dev/src/update_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,60 +36,6 @@ pub enum UpdateMode {
pub fn update(update_mode: UpdateMode) {
let (lints, deprecated_lints, renamed_lints) = gather_all();
generate_lint_files(update_mode, &lints, &deprecated_lints, &renamed_lints);
remove_old_files(update_mode);
}

/// Remove files no longer needed after <https://github.com/rust-lang/rust-clippy/pull/9541>
/// that may be reintroduced unintentionally
///
/// FIXME: This is a temporary measure that should be removed when there are no more PRs that
/// include the stray files
fn remove_old_files(update_mode: UpdateMode) {
let mut failed = false;
let mut remove_file = |path: &Path| match update_mode {
UpdateMode::Check => {
if path.exists() {
failed = true;
println!("unexpected file: {}", path.display());
}
},
UpdateMode::Change => {
if fs::remove_file(path).is_ok() {
println!("removed file: {}", path.display());
}
},
};

let files = [
"clippy_lints/src/lib.register_all.rs",
"clippy_lints/src/lib.register_cargo.rs",
"clippy_lints/src/lib.register_complexity.rs",
"clippy_lints/src/lib.register_correctness.rs",
"clippy_lints/src/lib.register_internal.rs",
"clippy_lints/src/lib.register_lints.rs",
"clippy_lints/src/lib.register_nursery.rs",
"clippy_lints/src/lib.register_pedantic.rs",
"clippy_lints/src/lib.register_perf.rs",
"clippy_lints/src/lib.register_restriction.rs",
"clippy_lints/src/lib.register_style.rs",
"clippy_lints/src/lib.register_suspicious.rs",
"src/docs.rs",
];

for file in files {
remove_file(Path::new(file));
}

if let Ok(docs_dir) = fs::read_dir("src/docs") {
for doc_file in docs_dir {
let path = doc_file.unwrap().path();
remove_file(&path);
}
}

if failed {
exit_with_failure();
}
}

fn generate_lint_files(
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.70"
version = "0.1.71"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
4 changes: 3 additions & 1 deletion src/tools/clippy/clippy_lints/src/allow_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use ast::AttrStyle;
use clippy_utils::diagnostics::span_lint_and_sugg;
use rustc_ast as ast;
use rustc_errors::Applicability;
use rustc_lint::{LateContext, LateLintPass};
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
Expand Down Expand Up @@ -51,6 +52,7 @@ impl LateLintPass<'_> for AllowAttribute {
// Separate each crate's features.
fn check_attribute(&mut self, cx: &LateContext<'_>, attr: &ast::Attribute) {
if_chain! {
if !in_external_macro(cx.sess(), attr.span);
if cx.tcx.features().lint_reasons;
if let AttrStyle::Outer = attr.style;
if let Some(ident) = attr.ident();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/casts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ declare_clippy_lint! {
#[clippy::version = "1.66.0"]
pub AS_PTR_CAST_MUT,
nursery,
"casting the result of the `&self`-taking `as_ptr` to a mutabe pointer"
"casting the result of the `&self`-taking `as_ptr` to a mutable pointer"
}

declare_clippy_lint! {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ fn lint_unnecessary_cast(

fn get_numeric_literal<'e>(expr: &'e Expr<'e>) -> Option<&'e Lit> {
match expr.kind {
ExprKind::Lit(ref lit) => Some(lit),
ExprKind::Lit(lit) => Some(lit),
ExprKind::Unary(UnOp::Neg, e) => {
if let ExprKind::Lit(ref lit) = e.kind {
if let ExprKind::Lit(lit) = e.kind {
Some(lit)
} else {
None
Expand Down
Loading