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

Clippy subtree update #129991

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
197b444
Ignore underscore-prefixed args for needless_pass_by_value lint
nyurik Jul 16, 2024
c2ed04b
check the def_id with using diagnostic_item in unnecessary_min_or_max…
kyoto7250 Aug 8, 2024
2645ea3
Remove `feature=cargo-clippy` argument
xFrednet Aug 9, 2024
a5e3a3f
move `manual_c_str_literals` to complexity
y21 Aug 12, 2024
9732128
Diverging subexpression lint should not fire on todo!()
alex-semenyuk Aug 18, 2024
b615c82
Add new lint: `used_underscore_items`
WeiTheShinobi Aug 21, 2024
89ad733
stabilize const_fn_floating_point_arithmetic
RalfJung Aug 3, 2024
b179c3e
check std::panic::panic_any in panic lint
kyoto7250 Aug 24, 2024
3c4367a
Fix `elided_named_lifetimes` in code
GrigorenkoPV Aug 22, 2024
3474df6
Rewrite empty_line_after_doc_comments and empty_line_after_outer_attr
Alexendoo Aug 24, 2024
8b8a3c9
Rollup merge of #129510 - GrigorenkoPV:fix-elided-named-lifetimes, r=…
matthiaskrgr Aug 24, 2024
173d5a6
Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyup
Jarcho Aug 24, 2024
40bca0d
Auto merge of #13285 - alex-semenyuk:ignore_todo_for_diverging_sub_ex…
bors Aug 25, 2024
508a7b4
Auto merge of #129531 - Jarcho:clippyup, r=Manishearth
bors Aug 25, 2024
d40e04a
`used_underscore_items` will not lint exteranl item
WeiTheShinobi Aug 25, 2024
083e20a
Auto merge of #13113 - nyurik:ignore-pass-by-val-for-pfx, r=blyxyas
bors Aug 25, 2024
ebcd6bc
Auto merge of #13091 - Alexendoo:empty-line-after-rewrite, r=dswij
bors Aug 25, 2024
b3fc578
Auto merge of #13300 - kyoto7250:issue_13292, r=llogiq
bors Aug 26, 2024
494112e
Fix manual_range_patterns case with one element at OR
alex-semenyuk Aug 26, 2024
f194e68
Auto merge of #13311 - alex-semenyuk:fix_manual_range_patterns, r=Man…
bors Aug 26, 2024
603d5a1
Auto merge of #13294 - WeiTheShinobi:new_lint_used_underscore_items, …
bors Aug 27, 2024
e8ac4ea
new lint: `zombie_processes`
y21 Sep 10, 2023
9e260ff
Auto merge of #11476 - y21:zombie_processes, r=xFrednet
bors Aug 28, 2024
04bded5
Auto merge of #13235 - kyoto7250:fix_issue_13191, r=llogiq
bors Aug 28, 2024
5bbb0d4
Stop using ty::GenericPredicates for non-predicates_of queries
compiler-errors Aug 29, 2024
b86a202
Auto merge of #13246 - xFrednet:12292-remove-cargo-clippy-feature, r=…
bors Aug 29, 2024
74a2344
Extend `implicit_saturation_sub` lint
GuillaumeGomez Mar 19, 2024
2622a87
Add ui regression tests for `implicit_saturation_sub` lint extension
GuillaumeGomez Mar 19, 2024
27c6343
Add ui test to ensure that if `0` is returned from both `if` and `els…
GuillaumeGomez Mar 19, 2024
d20fc38
Create new `inverted_saturating_sub` lint
GuillaumeGomez Jul 19, 2024
9e7473f
Update version attribute for 1.81 lints
xFrednet Aug 29, 2024
9aa23b8
Changelog for Clippy 1.81 :beginner:
xFrednet Aug 29, 2024
cbc6910
Changelog: Correct lint level
xFrednet Aug 29, 2024
9957101
elided_named_lifetimes: bless & add tests
GrigorenkoPV Aug 31, 2024
e845366
Add MSRV check for `saturating_sub` lints in const contexts
GuillaumeGomez Jul 22, 2024
2832faf
Move MSRV check later in `implicit_saturating_sub`
GuillaumeGomez Aug 2, 2024
ac914d3
Auto merge of #12476 - GuillaumeGomez:add-manual_arithmetic_check, r=y21
bors Aug 31, 2024
989ebae
Provide more clear example for WRONG_SELF_CONVENTION
alex-semenyuk Aug 29, 2024
663f200
Rollup merge of #129207 - GrigorenkoPV:elided-is-named, r=cjgillot
matthiaskrgr Sep 1, 2024
a81f1c8
Auto merge of #13325 - alex-semenyuk:wrong_self_convention_doc_fix, r…
bors Sep 1, 2024
cd28176
Minor code simplification
nyurik Sep 2, 2024
273b561
add pointers_in_nomem_asm_block lint
Soveu Jul 12, 2024
e8ba5d1
Auto merge of #13247 - Soveu:sus-asm-options, r=y21
bors Sep 3, 2024
f2ef26d
Auto merge of #13263 - y21:warn_manual_c_str_literals, r=Centri3
bors Sep 3, 2024
58cbf09
Auto merge of #13332 - nyurik:nits, r=xFrednet
bors Sep 3, 2024
cdb4423
Bump actions/download-artifact from 3 to 4
flip1995 Sep 4, 2024
aec61c4
Auto merge of #13343 - flip1995:aftifacts-action-update, r=flip1995
bors Sep 4, 2024
c95c767
Auto merge of #13323 - xFrednet:chnagelog-1-81, r=flip1995
bors Sep 5, 2024
87ce1d8
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Sep 5, 2024
40fca8f
Bump Clippy version -> 0.1.83
flip1995 Sep 5, 2024
3d027d7
Bump nightly version -> 2024-09-05
flip1995 Sep 5, 2024
a95afe2
Auto merge of #13347 - flip1995:rustup, r=flip1995
bors Sep 5, 2024
3b70a9c
Merge commit 'a95afe2d0a2051d97b723b0b197393b7811bc4e4' into clippy-s…
flip1995 Sep 5, 2024
cbf09cd
Update Cargo.lock
flip1995 Sep 5, 2024
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
10 changes: 5 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"

[[package]]
name = "clippy"
version = "0.1.82"
version = "0.1.83"
dependencies = [
"anstream",
"cargo_metadata 0.18.1",
Expand Down Expand Up @@ -562,7 +562,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.82"
version = "0.1.83"
dependencies = [
"itertools",
"serde",
Expand All @@ -585,7 +585,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.82"
version = "0.1.83"
dependencies = [
"arrayvec",
"cargo_metadata 0.18.1",
Expand All @@ -609,7 +609,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.82"
version = "0.1.83"
dependencies = [
"arrayvec",
"clippy_config",
Expand Down Expand Up @@ -911,7 +911,7 @@ dependencies = [

[[package]]
name = "declare_clippy_lint"
version = "0.1.82"
version = "0.1.83"
dependencies = [
"itertools",
"quote",
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/.github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf

- name: Upload Binaries
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: binaries
path: target/debug
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:

# Download
- name: Download target dir
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: binaries
path: target/debug
Expand Down
60 changes: 59 additions & 1 deletion src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,61 @@ document.

## Unreleased / Beta / In Rust Nightly

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

## Rust 1.81

Current stable, released 2024-09-05

### New Lints

* Added [`cfg_not_test`] to `restriction`
[#11293](https://github.com/rust-lang/rust-clippy/pull/11293)
* Added [`byte_char_slices`] to `style`
[#10155](https://github.com/rust-lang/rust-clippy/pull/10155)
* Added [`set_contains_or_insert`] to `nursery`
[#12873](https://github.com/rust-lang/rust-clippy/pull/12873)
* Added [`manual_rotate`] to `style`
[#12983](https://github.com/rust-lang/rust-clippy/pull/12983)
* Added [`unnecessary_min_or_max`] to `complexity`
[#12368](https://github.com/rust-lang/rust-clippy/pull/12368)
* Added [`manual_inspect`] to `complexity`
[#12287](https://github.com/rust-lang/rust-clippy/pull/12287)
* Added [`field_scoped_visibility_modifiers`] to `restriction`
[#12893](https://github.com/rust-lang/rust-clippy/pull/12893)
* Added [`manual_pattern_char_comparison`] to `style`
[#12849](https://github.com/rust-lang/rust-clippy/pull/12849)
* Added [`needless_maybe_sized`] to `suspicious`
[#10632](https://github.com/rust-lang/rust-clippy/pull/10632)
* Added [`needless_character_iteration`] to `suspicious`
[#12815](https://github.com/rust-lang/rust-clippy/pull/12815)

### Moves and Deprecations

* [`allow_attributes`], [`allow_attributes_without_reason`]: Now work on stable
[rust#120924](https://github.com/rust-lang/rust/pull/120924)
* Renamed `overflow_check_conditional` to [`panicking_overflow_checks`]
[#12944](https://github.com/rust-lang/rust-clippy/pull/12944)
* Moved [`panicking_overflow_checks`] to `correctness` (From `complexity` now deny-by-default)
[#12944](https://github.com/rust-lang/rust-clippy/pull/12944)
* Renamed `thread_local_initializer_can_be_made_const` to [`missing_const_for_thread_local`]
[#12974](https://github.com/rust-lang/rust-clippy/pull/12974)
* Deprecated [`maybe_misused_cfg`] and [`mismatched_target_os`] as they are now caught by cargo
and rustc
[#12875](https://github.com/rust-lang/rust-clippy/pull/12875)

### Enhancements

* [`significant_drop_in_scrutinee`]: Now also checks scrutinies of `while let` and `for let`
expressions
[#12870](https://github.com/rust-lang/rust-clippy/pull/12870)
* [`std_instead_of_core`]: Now respects the `msrv` configuration
[#13168](https://github.com/rust-lang/rust-clippy/pull/13168)

### ICE Fixes

* [`suboptimal_flops`]: No longer crashes on custom `.log()` functions
[#12884](https://github.com/rust-lang/rust-clippy/pull/12884)

## Rust 1.80

Expand Down Expand Up @@ -5500,6 +5554,7 @@ Released 2018-09-13
[`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
[`invalid_utf8_in_unchecked`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_utf8_in_unchecked
[`inverted_saturating_sub`]: https://rust-lang.github.io/rust-clippy/master/index.html#inverted_saturating_sub
[`invisible_characters`]: https://rust-lang.github.io/rust-clippy/master/index.html#invisible_characters
[`is_digit_ascii_radix`]: https://rust-lang.github.io/rust-clippy/master/index.html#is_digit_ascii_radix
[`items_after_statements`]: https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
Expand Down Expand Up @@ -5757,6 +5812,7 @@ Released 2018-09-13
[`pathbuf_init_then_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#pathbuf_init_then_push
[`pattern_type_mismatch`]: https://rust-lang.github.io/rust-clippy/master/index.html#pattern_type_mismatch
[`permissions_set_readonly_false`]: https://rust-lang.github.io/rust-clippy/master/index.html#permissions_set_readonly_false
[`pointers_in_nomem_asm_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#pointers_in_nomem_asm_block
[`positional_named_format_parameters`]: https://rust-lang.github.io/rust-clippy/master/index.html#positional_named_format_parameters
[`possible_missing_comma`]: https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_comma
[`precedence`]: https://rust-lang.github.io/rust-clippy/master/index.html#precedence
Expand Down Expand Up @@ -6013,6 +6069,7 @@ Released 2018-09-13
[`use_debug`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_debug
[`use_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_self
[`used_underscore_binding`]: https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_binding
[`used_underscore_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_items
[`useless_asref`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
[`useless_attribute`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_attribute
[`useless_conversion`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Expand Down Expand Up @@ -6047,6 +6104,7 @@ Released 2018-09-13
[`zero_repeat_side_effects`]: https://rust-lang.github.io/rust-clippy/master/index.html#zero_repeat_side_effects
[`zero_sized_map_values`]: https://rust-lang.github.io/rust-clippy/master/index.html#zero_sized_map_values
[`zero_width_space`]: https://rust-lang.github.io/rust-clippy/master/index.html#zero_width_space
[`zombie_processes`]: https://rust-lang.github.io/rust-clippy/master/index.html#zombie_processes
[`zst_offset`]: https://rust-lang.github.io/rust-clippy/master/index.html#zst_offset
<!-- end autogenerated links to lint list -->
<!-- begin autogenerated links to configuration documentation -->
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.82"
version = "0.1.83"
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
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.82"
version = "0.1.83"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/src/msrvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ msrv_aliases! {
1,52,0 { STR_SPLIT_ONCE, REM_EUCLID_CONST }
1,51,0 { BORROW_AS_PTR, SEEK_FROM_CURRENT, UNSIGNED_ABS }
1,50,0 { BOOL_THEN, CLAMP }
1,47,0 { TAU, IS_ASCII_DIGIT_CONST, ARRAY_IMPL_ANY_LEN }
1,47,0 { TAU, IS_ASCII_DIGIT_CONST, ARRAY_IMPL_ANY_LEN, SATURATING_SUB_CONST }
1,46,0 { CONST_IF_MATCH }
1,45,0 { STR_STRIP_PREFIX }
1,43,0 { LOG2_10, LOG10_2, NUMERIC_ASSOCIATED_CONSTANTS }
Expand Down
3 changes: 2 additions & 1 deletion src/tools/clippy/clippy_dev/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn run(port: u16, lint: Option<String>) -> ! {
}
if let Some(url) = url.take() {
thread::spawn(move || {
Command::new(PYTHON)
let mut child = Command::new(PYTHON)
.arg("-m")
.arg("http.server")
.arg(port.to_string())
Expand All @@ -40,6 +40,7 @@ pub fn run(port: u16, lint: Option<String>) -> ! {
thread::sleep(Duration::from_millis(500));
// Launch browser after first export.py has completed and http.server is up
let _result = opener::open(url);
child.wait().unwrap();
});
}
thread::sleep(Duration::from_millis(1000));
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.82"
version = "0.1.83"
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(super) fn check<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMet
cx,
ALLOW_ATTRIBUTES_WITHOUT_REASON,
attr.span,
format!("`{}` attribute without specifying a reason", name.as_str()),
format!("`{name}` attribute without specifying a reason"),
|diag| {
diag.help("try adding a reason at the end with `, reason = \"..\"`");
},
Expand Down
52 changes: 0 additions & 52 deletions src/tools/clippy/clippy_lints/src/attrs/empty_line_after.rs

This file was deleted.

95 changes: 0 additions & 95 deletions src/tools/clippy/clippy_lints/src/attrs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod blanket_clippy_restriction_lints;
mod deprecated_cfg_attr;
mod deprecated_semver;
mod duplicated_attributes;
mod empty_line_after;
mod inline_always;
mod mixed_attributes_style;
mod non_minimal_cfg;
Expand Down Expand Up @@ -126,94 +125,6 @@ declare_clippy_lint! {
"use of `#[deprecated(since = \"x\")]` where x is not semver"
}

declare_clippy_lint! {
/// ### What it does
/// Checks for empty lines after outer attributes
///
/// ### Why is this bad?
/// Most likely the attribute was meant to be an inner attribute using a '!'.
/// If it was meant to be an outer attribute, then the following item
/// should not be separated by empty lines.
///
/// ### Known problems
/// Can cause false positives.
///
/// From the clippy side it's difficult to detect empty lines between an attributes and the
/// following item because empty lines and comments are not part of the AST. The parsing
/// currently works for basic cases but is not perfect.
///
/// ### Example
/// ```no_run
/// #[allow(dead_code)]
///
/// fn not_quite_good_code() { }
/// ```
///
/// Use instead:
/// ```no_run
/// // Good (as inner attribute)
/// #![allow(dead_code)]
///
/// fn this_is_fine() { }
///
/// // or
///
/// // Good (as outer attribute)
/// #[allow(dead_code)]
/// fn this_is_fine_too() { }
/// ```
#[clippy::version = "pre 1.29.0"]
pub EMPTY_LINE_AFTER_OUTER_ATTR,
nursery,
"empty line after outer attribute"
}

declare_clippy_lint! {
/// ### What it does
/// Checks for empty lines after documentation comments.
///
/// ### Why is this bad?
/// The documentation comment was most likely meant to be an inner attribute or regular comment.
/// If it was intended to be a documentation comment, then the empty line should be removed to
/// be more idiomatic.
///
/// ### Known problems
/// Only detects empty lines immediately following the documentation. If the doc comment is followed
/// by an attribute and then an empty line, this lint will not trigger. Use `empty_line_after_outer_attr`
/// in combination with this lint to detect both cases.
///
/// Does not detect empty lines after doc attributes (e.g. `#[doc = ""]`).
///
/// ### Example
/// ```no_run
/// /// Some doc comment with a blank line after it.
///
/// fn not_quite_good_code() { }
/// ```
///
/// Use instead:
/// ```no_run
/// /// Good (no blank line)
/// fn this_is_fine() { }
/// ```
///
/// ```no_run
/// // Good (convert to a regular comment)
///
/// fn this_is_fine_too() { }
/// ```
///
/// ```no_run
/// //! Good (convert to a comment on an inner attribute)
///
/// fn this_is_fine_as_well() { }
/// ```
#[clippy::version = "1.70.0"]
pub EMPTY_LINE_AFTER_DOC_COMMENTS,
nursery,
"empty line after documentation comments"
}

declare_clippy_lint! {
/// ### What it does
/// Checks for `warn`/`deny`/`forbid` attributes targeting the whole clippy::restriction category.
Expand Down Expand Up @@ -601,18 +512,12 @@ impl EarlyAttributes {

impl_lint_pass!(EarlyAttributes => [
DEPRECATED_CFG_ATTR,
EMPTY_LINE_AFTER_OUTER_ATTR,
EMPTY_LINE_AFTER_DOC_COMMENTS,
NON_MINIMAL_CFG,
DEPRECATED_CLIPPY_CFG_ATTR,
UNNECESSARY_CLIPPY_CFG,
]);

impl EarlyLintPass for EarlyAttributes {
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &rustc_ast::Item) {
empty_line_after::check(cx, item);
}

fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) {
deprecated_cfg_attr::check(cx, attr, &self.msrv);
deprecated_cfg_attr::check_clippy(cx, attr);
Expand Down
Loading
Loading