Skip to content

Commit

Permalink
Auto merge of rust-lang#131892 - flip1995:clippy-subtree-update, r=Ma…
Browse files Browse the repository at this point in the history
…nishearth

Clippy subtree update

One day late with the sync, as I was sick yesterday.

Cargo.lock update includes Clippy version bump and some deps cleanup we did in Clippy to match more versions used in the Rust repo.

r? `@Manishearth`
  • Loading branch information
bors committed Oct 18, 2024
2 parents f7b5e54 + cf918d5 commit e92993d
Show file tree
Hide file tree
Showing 180 changed files with 4,036 additions and 1,779 deletions.
46 changes: 11 additions & 35 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ dependencies = [
"cargo_metadata",
"directories",
"rustc-build-sysroot",
"rustc_tools_util 0.4.0",
"rustc_tools_util",
"rustc_version",
"serde",
"serde_json",
Expand Down Expand Up @@ -537,7 +537,7 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"

[[package]]
name = "clippy"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"anstream",
"cargo_metadata",
Expand All @@ -550,9 +550,11 @@ dependencies = [
"if_chain",
"itertools",
"parking_lot",
"pulldown-cmark 0.11.3",
"quote",
"regex",
"rustc_tools_util 0.3.0",
"rinja",
"rustc_tools_util",
"serde",
"serde_json",
"syn 2.0.79",
Expand All @@ -566,7 +568,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"itertools",
"serde",
Expand All @@ -582,20 +584,19 @@ dependencies = [
"clap",
"indoc",
"itertools",
"opener 0.6.1",
"opener",
"shell-escape",
"walkdir",
]

[[package]]
name = "clippy_lints"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"arrayvec",
"cargo_metadata",
"clippy_config",
"clippy_utils",
"declare_clippy_lint",
"itertools",
"quine-mc_cluskey",
"regex",
Expand All @@ -613,7 +614,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.83"
version = "0.1.84"
dependencies = [
"arrayvec",
"clippy_config",
Expand Down Expand Up @@ -919,15 +920,6 @@ dependencies = [
"winapi",
]

[[package]]
name = "declare_clippy_lint"
version = "0.1.83"
dependencies = [
"itertools",
"quote",
"syn 2.0.79",
]

[[package]]
name = "deranged"
version = "0.3.11"
Expand Down Expand Up @@ -2163,7 +2155,7 @@ dependencies = [
"log",
"memchr",
"once_cell",
"opener 0.7.2",
"opener",
"pulldown-cmark 0.10.3",
"regex",
"serde",
Expand Down Expand Up @@ -2501,17 +2493,6 @@ dependencies = [
"stable_deref_trait",
]

[[package]]
name = "opener"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788"
dependencies = [
"bstr",
"normpath",
"winapi",
]

[[package]]
name = "opener"
version = "0.7.2"
Expand Down Expand Up @@ -2879,6 +2860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625"
dependencies = [
"bitflags 2.6.0",
"getopts",
"memchr",
"pulldown-cmark-escape 0.11.0",
"unicase",
Expand Down Expand Up @@ -4460,12 +4442,6 @@ dependencies = [
"tracing",
]

[[package]]
name = "rustc_tools_util"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba09476327c4b70ccefb6180f046ef588c26a24cf5d269a9feba316eb4f029f"

[[package]]
name = "rustc_tools_util"
version = "0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/.github/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ rm -rf out/master/ || exit 0
echo "Making the docs for master"
mkdir out/master/
cp util/gh-pages/index.html out/master
cp util/gh-pages/theme.js out/master
cp util/gh-pages/script.js out/master
cp util/gh-pages/lints.json out/master
cp util/gh-pages/style.css out/master

if [[ -n $TAG_NAME ]]; then
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ out

# gh pages docs
util/gh-pages/lints.json
util/gh-pages/index.html

# rustfmt backups
*.rs.bk
Expand Down
42 changes: 40 additions & 2 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,46 @@ document.

## Unreleased / Beta / In Rust Nightly

[b794b8e0...master](https://github.com/rust-lang/rust-clippy/compare/b794b8e0...master)
[0f8eabd6...master](https://github.com/rust-lang/rust-clippy/compare/0f8eabd6...master)

## Rust 1.82

Current stable, released 2024-10-17

[View all 108 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-07-11T20%3A12%3A07Z..2024-08-24T20%3A55%3A35Z+base%3Amaster)

### New Lints

* Added [`too_long_first_doc_paragraph`] to `nursery`
[#12993](https://github.com/rust-lang/rust-clippy/pull/12993)
* Added [`unused_result_ok`] to `restriction`
[#12150](https://github.com/rust-lang/rust-clippy/pull/12150)
* Added [`pathbuf_init_then_push`] to `restriction`
[#11700](https://github.com/rust-lang/rust-clippy/pull/11700)

### Enhancements

* [`explicit_iter_loop`]: Now respects the `msrv` configuration
[#13288](https://github.com/rust-lang/rust-clippy/pull/13288)
* [`assigning_clones`]: No longer lints in test code
[#13273](https://github.com/rust-lang/rust-clippy/pull/13273)
* [`inconsistent_struct_constructor`]: Lint attributes now work on the struct definition
[#13211](https://github.com/rust-lang/rust-clippy/pull/13211)
* [`set_contains_or_insert`]: Now also checks for `BTreeSet`
[#13053](https://github.com/rust-lang/rust-clippy/pull/13053)
* [`doc_markdown`]: Added the following identifiers to [`doc-valid-idents`]: AccessKit,
CoreFoundation, CoreGraphics, CoreText, Direct2D, Direct3D, DirectWrite, PostScript,
OpenAL, OpenType, WebRTC, WebSocket, WebTransport, NetBSD, and OpenBSD
[#13093](https://github.com/rust-lang/rust-clippy/pull/13093)

### ICE Fixes

* [`uninit_vec`]
[rust#128720](https://github.com/rust-lang/rust/pull/128720)

## Rust 1.81

Current stable, released 2024-09-05
Released 2024-09-05

### New Lints

Expand Down Expand Up @@ -5621,6 +5656,7 @@ Released 2018-09-13
[`manual_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_find_map
[`manual_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
[`manual_hash_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one
[`manual_ignore_case_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ignore_case_cmp
[`manual_inspect`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
[`manual_instant_elapsed`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_instant_elapsed
[`manual_is_ascii_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
Expand Down Expand Up @@ -5874,6 +5910,7 @@ Released 2018-09-13
[`ref_option`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option
[`ref_option_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
[`ref_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_patterns
[`regex_creation_in_loops`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_creation_in_loops
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro
[`renamed_function_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#renamed_function_params
[`repeat_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_once
Expand Down Expand Up @@ -6027,6 +6064,7 @@ Released 2018-09-13
[`unnecessary_get_then_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check
[`unnecessary_join`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_join
[`unnecessary_lazy_evaluations`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
[`unnecessary_literal_bound`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_bound
[`unnecessary_literal_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap
[`unnecessary_map_on_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_on_constructor
[`unnecessary_min_or_max`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_min_or_max
Expand Down
8 changes: 5 additions & 3 deletions 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.83"
version = "0.1.84"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand All @@ -23,7 +23,7 @@ path = "src/driver.rs"
[dependencies]
clippy_config = { path = "clippy_config" }
clippy_lints = { path = "clippy_lints" }
rustc_tools_util = "0.3.0"
rustc_tools_util = "0.4.0"
tempfile = { version = "3.3", optional = true }
termize = "0.1"
color-print = "0.3.4"
Expand All @@ -39,6 +39,8 @@ toml = "0.7.3"
walkdir = "2.3"
filetime = "0.2.9"
itertools = "0.12"
pulldown-cmark = "0.11"
rinja = { version = "0.3", default-features = false, features = ["config"] }

# UI test dependencies
clippy_utils = { path = "clippy_utils" }
Expand All @@ -50,7 +52,7 @@ parking_lot = "0.12"
tokio = { version = "1", features = ["io-util"] }

[build-dependencies]
rustc_tools_util = "0.3.0"
rustc_tools_util = "0.4.0"

[features]
integration = ["tempfile"]
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ arithmetic-side-effects-allowed-unary = ["SomeType", "AnotherType"]
## `array-size-threshold`
The maximum allowed size for arrays on the stack

**Default Value:** `512000`
**Default Value:** `16384`

---
**Affected lints:**
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_config"
version = "0.1.83"
version = "0.1.84"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
26 changes: 25 additions & 1 deletion src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,30 @@ impl ConfError {
}
}

// Remove code tags and code behind '# 's, as they are not needed for the lint docs and --explain
pub fn sanitize_explanation(raw_docs: &str) -> String {
// Remove tags and hidden code:
let mut explanation = String::with_capacity(128);
let mut in_code = false;
for line in raw_docs.lines().map(str::trim) {
if let Some(lang) = line.strip_prefix("```") {
let tag = lang.split_once(',').map_or(lang, |(left, _)| left);
if !in_code && matches!(tag, "" | "rust" | "ignore" | "should_panic" | "no_run" | "compile_fail") {
explanation += "```rust\n";
} else {
explanation += line;
explanation.push('\n');
}
in_code = !in_code;
} else if !(in_code && line.starts_with("# ")) {
explanation += line;
explanation.push('\n');
}
}

explanation
}

macro_rules! wrap_option {
() => {
None
Expand Down Expand Up @@ -366,7 +390,7 @@ define_Conf! {
arithmetic_side_effects_allowed_unary: Vec<String> = <_>::default(),
/// The maximum allowed size for arrays on the stack
#[lints(large_const_arrays, large_stack_arrays)]
array_size_threshold: u64 = 512_000,
array_size_threshold: u64 = 16 * 1024,
/// Suppress lints whenever the suggested change would cause breakage for other crates.
#[lints(
box_collection,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ mod metadata;
pub mod msrvs;
pub mod types;

pub use conf::{Conf, get_configuration_metadata, lookup_conf_file};
pub use conf::{Conf, get_configuration_metadata, lookup_conf_file, sanitize_explanation};
pub use metadata::ClippyConfiguration;
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_config/src/msrvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ macro_rules! msrv_aliases {

// names may refer to stabilized feature flags or library items
msrv_aliases! {
1,83,0 { CONST_EXTERN_FN }
1,83,0 { CONST_FLOAT_BITS_CONV }
1,83,0 { CONST_EXTERN_FN, CONST_FLOAT_BITS_CONV, CONST_FLOAT_CLASSIFY }
1,82,0 { IS_NONE_OR }
1,81,0 { LINT_REASONS_STABILIZATION }
1,80,0 { BOX_INTO_ITER}
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 @@ -9,7 +9,7 @@ aho-corasick = "1.0"
clap = { version = "4.4", features = ["derive"] }
indoc = "1.0"
itertools = "0.12"
opener = "0.6"
opener = "0.7"
shell-escape = "0.1"
walkdir = "2.3"

Expand Down
Loading

0 comments on commit e92993d

Please sign in to comment.