Skip to content

Commit b816d4e

Browse files
committed
Merge remote-tracking branch 'upstream/master' into rustup
2 parents 4847c40 + ab560d8 commit b816d4e

File tree

221 files changed

+4853
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+4853
-717
lines changed

.github/workflows/deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: cargo generate-lockfile
5353

5454
- name: Cache
55-
uses: Swatinem/rust-cache@v2.7.0
55+
uses: Swatinem/rust-cache@v2
5656
with:
5757
save-if: ${{ github.ref == 'refs/heads/master' }}
5858

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -5331,6 +5331,7 @@ Released 2018-09-13
53315331
[`almost_complete_range`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_range
53325332
[`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
53335333
[`approx_constant`]: https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
5334+
[`arbitrary_source_item_ordering`]: https://rust-lang.github.io/rust-clippy/master/index.html#arbitrary_source_item_ordering
53345335
[`arc_with_non_send_sync`]: https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
53355336
[`arithmetic_side_effects`]: https://rust-lang.github.io/rust-clippy/master/index.html#arithmetic_side_effects
53365337
[`as_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions
@@ -5689,13 +5690,15 @@ Released 2018-09-13
56895690
[`manual_unwrap_or_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
56905691
[`manual_while_let_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_while_let_some
56915692
[`many_single_char_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names
5693+
[`map_all_any_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_all_any_identity
56925694
[`map_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
56935695
[`map_collect_result_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_collect_result_unit
56945696
[`map_entry`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
56955697
[`map_err_ignore`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_err_ignore
56965698
[`map_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
56975699
[`map_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
56985700
[`map_unwrap_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
5701+
[`map_with_unused_argument_over_ranges`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_with_unused_argument_over_ranges
56995702
[`match_as_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_as_ref
57005703
[`match_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_bool
57015704
[`match_like_matches_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
@@ -5761,6 +5764,7 @@ Released 2018-09-13
57615764
[`mutex_integer`]: https://rust-lang.github.io/rust-clippy/master/index.html#mutex_integer
57625765
[`naive_bytecount`]: https://rust-lang.github.io/rust-clippy/master/index.html#naive_bytecount
57635766
[`needless_arbitrary_self_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_arbitrary_self_type
5767+
[`needless_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_as_bytes
57645768
[`needless_bitwise_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bitwise_bool
57655769
[`needless_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool
57665770
[`needless_bool_assign`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool_assign
@@ -6205,19 +6209,22 @@ Released 2018-09-13
62056209
[`max-trait-bounds`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-trait-bounds
62066210
[`min-ident-chars-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#min-ident-chars-threshold
62076211
[`missing-docs-in-crate-items`]: https://doc.rust-lang.org/clippy/lint_configuration.html#missing-docs-in-crate-items
6212+
[`module-item-order-groupings`]: https://doc.rust-lang.org/clippy/lint_configuration.html#module-item-order-groupings
62086213
[`msrv`]: https://doc.rust-lang.org/clippy/lint_configuration.html#msrv
62096214
[`pass-by-value-size-limit`]: https://doc.rust-lang.org/clippy/lint_configuration.html#pass-by-value-size-limit
62106215
[`pub-underscore-fields-behavior`]: https://doc.rust-lang.org/clippy/lint_configuration.html#pub-underscore-fields-behavior
62116216
[`semicolon-inside-block-ignore-singleline`]: https://doc.rust-lang.org/clippy/lint_configuration.html#semicolon-inside-block-ignore-singleline
62126217
[`semicolon-outside-block-ignore-multiline`]: https://doc.rust-lang.org/clippy/lint_configuration.html#semicolon-outside-block-ignore-multiline
62136218
[`single-char-binding-names-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#single-char-binding-names-threshold
6219+
[`source-item-ordering`]: https://doc.rust-lang.org/clippy/lint_configuration.html#source-item-ordering
62146220
[`stack-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#stack-size-threshold
62156221
[`standard-macro-braces`]: https://doc.rust-lang.org/clippy/lint_configuration.html#standard-macro-braces
62166222
[`struct-field-name-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#struct-field-name-threshold
62176223
[`suppress-restriction-lint-in-const`]: https://doc.rust-lang.org/clippy/lint_configuration.html#suppress-restriction-lint-in-const
62186224
[`too-large-for-stack`]: https://doc.rust-lang.org/clippy/lint_configuration.html#too-large-for-stack
62196225
[`too-many-arguments-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#too-many-arguments-threshold
62206226
[`too-many-lines-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#too-many-lines-threshold
6227+
[`trait-assoc-item-kinds-order`]: https://doc.rust-lang.org/clippy/lint_configuration.html#trait-assoc-item-kinds-order
62216228
[`trivial-copy-size-limit`]: https://doc.rust-lang.org/clippy/lint_configuration.html#trivial-copy-size-limit
62226229
[`type-complexity-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#type-complexity-threshold
62236230
[`unnecessary-box-size`]: https://doc.rust-lang.org/clippy/lint_configuration.html#unnecessary-box-size

Cargo.toml

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ toml = "0.7.3"
3939
walkdir = "2.3"
4040
filetime = "0.2.9"
4141
itertools = "0.12"
42-
pulldown-cmark = "0.11"
42+
pulldown-cmark = { version = "0.11", default-features = false, features = ["html"] }
4343
rinja = { version = "0.3", default-features = false, features = ["config"] }
4444

4545
# UI test dependencies
@@ -69,3 +69,10 @@ harness = false
6969
[[test]]
7070
name = "dogfood"
7171
harness = false
72+
73+
# quine-mc_cluskey makes up a significant part of the runtime in dogfood
74+
# due to the number of conditions in the clippy_lints crate
75+
# and enabling optimizations for that specific dependency helps a bit
76+
# without increasing total build times.
77+
[profile.dev.package.quine-mc_cluskey]
78+
opt-level = 3

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

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

8-
[There are over 700 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
8+
[There are over 750 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
99

1010
Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html).
1111
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.

book/src/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
A collection of lints to catch common mistakes and improve your
77
[Rust](https://github.com/rust-lang/rust) code.
88

9-
[There are over 700 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are over 750 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1010

1111
Lints are divided into categories, each with a default [lint
1212
level](https://doc.rust-lang.org/rustc/lints/levels.html). You can choose how

book/src/development/common_tools_writing_lints.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for MyStructLint {
6868
// Check our expr is calling a method
6969
if let hir::ExprKind::MethodCall(path, _, _self_arg, ..) = &expr.kind
7070
// Check the name of this method is `some_method`
71-
&& path.ident.name == sym!(some_method)
71+
&& path.ident.name.as_str() == "some_method"
7272
// Optionally, check the type of the self argument.
7373
// - See "Checking for a specific type"
7474
{
@@ -167,7 +167,7 @@ impl<'tcx> LateLintPass<'tcx> for MyTypeImpl {
167167
// Check if item is a method/function
168168
if let ImplItemKind::Fn(ref signature, _) = impl_item.kind
169169
// Check the method is named `some_method`
170-
&& impl_item.ident.name == sym!(some_method)
170+
&& impl_item.ident.name.as_str() == "some_method"
171171
// We can also check it has a parameter `self`
172172
&& signature.decl.implicit_self.has_implicit_self()
173173
// We can go further and even check if its return type is `String`

book/src/development/method_checking.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
In some scenarios we might want to check for methods when developing
44
a lint. There are two kinds of questions that we might be curious about:
55

6-
- Invocation: Does an expression call a specific method?
7-
- Definition: Does an `impl` define a method?
6+
- Invocation: Does an expression call a specific method?
7+
- Definition: Does an `impl` define a method?
88

99
## Checking if an `expr` is calling a specific method
1010

@@ -23,7 +23,7 @@ impl<'tcx> LateLintPass<'tcx> for OurFancyMethodLint {
2323
// Check our expr is calling a method with pattern matching
2424
if let hir::ExprKind::MethodCall(path, _, [self_arg, ..]) = &expr.kind
2525
// Check if the name of this method is `our_fancy_method`
26-
&& path.ident.name == sym!(our_fancy_method)
26+
&& path.ident.name.as_str() == "our_fancy_method"
2727
// We can check the type of the self argument whenever necessary.
2828
// (It's necessary if we want to check that method is specifically belonging to a specific trait,
2929
// for example, a `map` method could belong to user-defined trait instead of to `Iterator`)
@@ -41,10 +41,6 @@ information on the pattern matching. As mentioned in [Define
4141
Lints](defining_lints.md#lint-types), the `methods` lint type is full of pattern
4242
matching with `MethodCall` in case the reader wishes to explore more.
4343

44-
Additionally, we use the [`clippy_utils::sym!`][sym] macro to conveniently
45-
convert an input `our_fancy_method` into a `Symbol` and compare that symbol to
46-
the [`Ident`]'s name in the [`PathSegment`] in the [`MethodCall`].
47-
4844
## Checking if a `impl` block implements a method
4945

5046
While sometimes we want to check whether a method is being called or not, other
@@ -71,7 +67,7 @@ impl<'tcx> LateLintPass<'tcx> for MyTypeImpl {
7167
// Check if item is a method/function
7268
if let ImplItemKind::Fn(ref signature, _) = impl_item.kind
7369
// Check the method is named `our_fancy_method`
74-
&& impl_item.ident.name == sym!(our_fancy_method)
70+
&& impl_item.ident.name.as_str() == "our_fancy_method"
7571
// We can also check it has a parameter `self`
7672
&& signature.decl.implicit_self.has_implicit_self()
7773
// We can go even further and even check if its return type is `String`
@@ -85,9 +81,6 @@ impl<'tcx> LateLintPass<'tcx> for MyTypeImpl {
8581

8682
[`check_impl_item`]: https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/trait.LateLintPass.html#method.check_impl_item
8783
[`ExprKind`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/hir/enum.ExprKind.html
88-
[`Ident`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_span/symbol/struct.Ident.html
8984
[`ImplItem`]: https://doc.rust-lang.org/stable/nightly-rustc/rustc_hir/hir/struct.ImplItem.html
9085
[`LateLintPass`]: https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/trait.LateLintPass.html
9186
[`MethodCall`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/hir/enum.ExprKind.html#variant.MethodCall
92-
[`PathSegment`]: https://doc.rust-lang.org/beta/nightly-rustc/rustc_hir/hir/struct.PathSegment.html
93-
[sym]: https://doc.rust-lang.org/stable/nightly-rustc/clippy_utils/macro.sym.html

book/src/lint_configuration.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ default configuration of Clippy. By default, any configuration will replace the
456456
* `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
457457
* `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.
458458

459-
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "AccessKit", "CoreFoundation", "CoreGraphics", "CoreText", "DevOps", "Direct2D", "Direct3D", "DirectWrite", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "OpenType", "WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`
459+
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "MHz", "GHz", "THz", "AccessKit", "CoAP", "CoreFoundation", "CoreGraphics", "CoreText", "DevOps", "Direct2D", "Direct3D", "DirectWrite", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "OpenType", "WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`
460460

461461
---
462462
**Affected lints:**
@@ -666,6 +666,16 @@ crate. For example, `pub(crate)` items.
666666
* [`missing_docs_in_private_items`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_docs_in_private_items)
667667

668668

669+
## `module-item-order-groupings`
670+
The named groupings of different source item kinds within modules.
671+
672+
**Default Value:** `[["modules", ["extern_crate", "mod", "foreign_mod"]], ["use", ["use"]], ["macros", ["macro"]], ["global_asm", ["global_asm"]], ["UPPER_SNAKE_CASE", ["static", "const"]], ["PascalCase", ["ty_alias", "enum", "struct", "union", "trait", "trait_alias", "impl"]], ["lower_snake_case", ["fn"]]]`
673+
674+
---
675+
**Affected lints:**
676+
* [`arbitrary_source_item_ordering`](https://rust-lang.github.io/rust-clippy/master/index.html#arbitrary_source_item_ordering)
677+
678+
669679
## `msrv`
670680
The minimum rust version that the project supports. Defaults to the `rust-version` field in `Cargo.toml`
671681

@@ -710,6 +720,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
710720
* [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold)
711721
* [`map_clone`](https://rust-lang.github.io/rust-clippy/master/index.html#map_clone)
712722
* [`map_unwrap_or`](https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or)
723+
* [`map_with_unused_argument_over_ranges`](https://rust-lang.github.io/rust-clippy/master/index.html#map_with_unused_argument_over_ranges)
713724
* [`match_like_matches_macro`](https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro)
714725
* [`mem_replace_with_default`](https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default)
715726
* [`missing_const_for_fn`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn)
@@ -783,6 +794,16 @@ The maximum number of single char bindings a scope may have
783794
* [`many_single_char_names`](https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names)
784795

785796

797+
## `source-item-ordering`
798+
Which kind of elements should be ordered internally, possible values being `enum`, `impl`, `module`, `struct`, `trait`.
799+
800+
**Default Value:** `["enum", "impl", "module", "struct", "trait"]`
801+
802+
---
803+
**Affected lints:**
804+
* [`arbitrary_source_item_ordering`](https://rust-lang.github.io/rust-clippy/master/index.html#arbitrary_source_item_ordering)
805+
806+
786807
## `stack-size-threshold`
787808
The maximum allowed stack size for functions in bytes
788809

@@ -862,6 +883,16 @@ The maximum number of lines a function or method can have
862883
* [`too_many_lines`](https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines)
863884

864885

886+
## `trait-assoc-item-kinds-order`
887+
The order of associated items in traits.
888+
889+
**Default Value:** `["const", "type", "fn"]`
890+
891+
---
892+
**Affected lints:**
893+
* [`arbitrary_source_item_ordering`](https://rust-lang.github.io/rust-clippy/master/index.html#arbitrary_source_item_ordering)
894+
895+
865896
## `trivial-copy-size-limit`
866897
The maximum size (in bytes) to consider a `Copy` type for passing by value instead of by
867898
reference. By default there is no limit

0 commit comments

Comments
 (0)