Skip to content

Commit a0309f8

Browse files
committed
Merge remote-tracking branch 'upstream/master' into rustup
2 parents 297f28c + 8568ca8 commit a0309f8

File tree

141 files changed

+1979
-409
lines changed

Some content is hidden

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

141 files changed

+1979
-409
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5689,13 +5689,15 @@ Released 2018-09-13
56895689
[`manual_unwrap_or_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
56905690
[`manual_while_let_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_while_let_some
56915691
[`many_single_char_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names
5692+
[`map_all_any_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_all_any_identity
56925693
[`map_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
56935694
[`map_collect_result_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_collect_result_unit
56945695
[`map_entry`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
56955696
[`map_err_ignore`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_err_ignore
56965697
[`map_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
56975698
[`map_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
56985699
[`map_unwrap_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
5700+
[`map_with_unused_argument_over_ranges`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_with_unused_argument_over_ranges
56995701
[`match_as_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_as_ref
57005702
[`match_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_bool
57015703
[`match_like_matches_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
@@ -5761,6 +5763,7 @@ Released 2018-09-13
57615763
[`mutex_integer`]: https://rust-lang.github.io/rust-clippy/master/index.html#mutex_integer
57625764
[`naive_bytecount`]: https://rust-lang.github.io/rust-clippy/master/index.html#naive_bytecount
57635765
[`needless_arbitrary_self_type`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_arbitrary_self_type
5766+
[`needless_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_as_bytes
57645767
[`needless_bitwise_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bitwise_bool
57655768
[`needless_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool
57665769
[`needless_bool_assign`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool_assign

Cargo.toml

Lines changed: 8 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 11 deletions
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

Lines changed: 2 additions & 1 deletion
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:**
@@ -710,6 +710,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
710710
* [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold)
711711
* [`map_clone`](https://rust-lang.github.io/rust-clippy/master/index.html#map_clone)
712712
* [`map_unwrap_or`](https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or)
713+
* [`map_with_unused_argument_over_ranges`](https://rust-lang.github.io/rust-clippy/master/index.html#map_with_unused_argument_over_ranges)
713714
* [`match_like_matches_macro`](https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro)
714715
* [`mem_replace_with_default`](https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default)
715716
* [`missing_const_for_fn`](https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn)

clippy_config/src/conf.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use std::{cmp, env, fmt, fs, io};
1717
#[rustfmt::skip]
1818
const DEFAULT_DOC_VALID_IDENTS: &[&str] = &[
1919
"KiB", "MiB", "GiB", "TiB", "PiB", "EiB",
20+
"MHz", "GHz", "THz",
2021
"AccessKit",
21-
"CoreFoundation", "CoreGraphics", "CoreText",
22+
"CoAP", "CoreFoundation", "CoreGraphics", "CoreText",
2223
"DevOps",
2324
"Direct2D", "Direct3D", "DirectWrite", "DirectX",
2425
"ECMAScript",
@@ -102,7 +103,9 @@ pub fn sanitize_explanation(raw_docs: &str) -> String {
102103
// Remove tags and hidden code:
103104
let mut explanation = String::with_capacity(128);
104105
let mut in_code = false;
105-
for line in raw_docs.lines().map(str::trim) {
106+
for line in raw_docs.lines() {
107+
let line = line.strip_prefix(' ').unwrap_or(line);
108+
106109
if let Some(lang) = line.strip_prefix("```") {
107110
let tag = lang.split_once(',').map_or(lang, |(left, _)| left);
108111
if !in_code && matches!(tag, "" | "rust" | "ignore" | "should_panic" | "no_run" | "compile_fail") {
@@ -570,6 +573,7 @@ define_Conf! {
570573
manual_try_fold,
571574
map_clone,
572575
map_unwrap_or,
576+
map_with_unused_argument_over_ranges,
573577
match_like_matches_macro,
574578
mem_replace_with_default,
575579
missing_const_for_fn,

clippy_config/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern crate rustc_driver;
2020
extern crate rustc_errors;
2121
extern crate rustc_session;
2222
extern crate rustc_span;
23+
extern crate smallvec;
2324

2425
mod conf;
2526
mod metadata;

0 commit comments

Comments
 (0)