Skip to content

Clippy subtree update #140540

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

Merged
merged 36 commits into from
May 2, 2025
Merged

Clippy subtree update #140540

merged 36 commits into from
May 2, 2025

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented May 1, 2025

samueltardieu and others added 30 commits April 8, 2025 18:16
`ptr_eq` was recently enhanced to lint on more cases of raw pointers
comparison:

- lint on all raw pointer comparison, by proposing to use
  `[core|std]::ptr::eq(lhs, rhs)` instead of `lhs == rhs`;
- removing one symetric `as usize` on each size if needed
- peeling any level of `as *[const|mut] _` if the remaining expression
  can still be coerced into the original one (i.e., is a ref or raw
  pointer to the same type as before)

The current change restricts the lint to the cases where at least one
level of symetric `as usize`, or any conversion to a raw pointer, could
be removed. For example, a direct comparaison of two raw pointers will
not trigger the lint anymore.
`ptr_eq` was recently enhanced to lint on more cases of raw pointers
comparison:

- lint on all raw pointer comparison, by proposing to use
`[core|std]::ptr::eq(lhs, rhs)` instead of `lhs == rhs`;
- removing one symetric `as usize` on each size if needed
- peeling any level of `as *[const|mut] _` if the remaining expression
can still be coerced into the original one (i.e., is a ref or raw
pointer to the same type as before)

The current change restricts the lint to the cases where at least one
level of symetric `as usize`, or any conversion to a raw pointer, could
be removed. For example, a direct comparaison of two raw pointers will
not trigger the lint anymore.

changelog: [`ptr_eq`]: do not lint when comparing two raw pointers
directly with no casts involved

Fixes rust-lang/rust-clippy#14525
Fixes rust-lang/rust-clippy#14675 by making it
clearer that the constructor needs to be removed as well
Also fixes rust-lang/rust-clippy#8392

changelog: none
`cargo dev fmt` seems to not work for some reason (possibly because of
all the comments in the let-chain), so I formatted it manually -- I hope
it's right

changelog: none
Matches the `rustc` terminology

changelog: none
…ang#14643)

Closes rust-lang/rust-clippy#14640

changelog: [`unnecessary_cast`] fix extra brackets in suggestions when
in macro
…st-lang#14504)

Closes rust-lang#8710

changelog: [`equatable_if_let`] fix wrong suggestions when involving
reference
…14666)

here is my small fix

changelog: fix suggestion span to avoid showing macro name in
`.div_ceil()` suggestion

i changed this line
`let divisor_snippet = snippet_with_applicability(cx,
rhs.spansource_callsite(), "..", applicability);`
to this line
`let divisor_snippet = snippet_with_applicability(cx, rhs.span, "..",
applicability);`
to fix problem where this warning in macro expands like this
```rust
4  |         let _ = (x + 7) / 8;
   |                 ^^^^^^^^^^^ help: consider using `.div_ceil()`: `x.div_ceil(y!())`
```
[play it
yourself](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=397aa8cd2ffffb24a286fbddbc75446c)

as you can see here it looks like `x.div_ceil(y!())` and contains macro
signature
so i fixed this problem, i will look closely if there any more problems
like this and fix them in order

**Related issue**

fixes
[rust-lang/rust-clippy#14665](rust-lang/rust-clippy#14665)
Follow up to rust-lang/rust-clippy#14650

Replaces uses in the form `s.as_str() == "literal"`

r? @y21

changelog: none
…st-lang#14609)

Closes rust-lang/rust-clippy#14577.

Migrate this lint to late pass and avoids `unit_never_type_fallback`
since it is no longer permitted in Rust 2024.

changelog: [`unused_unit`] fix wrong suggestions when unit never type
fallback
…ogy, r=oli-obk

Remove `weak` alias terminology

I find the "weak" alias terminology to be quite confusing. It implies the existence of "strong" aliases (which do not exist) and I'm not really sure what about weak aliases is "weak". I much prefer "free alias" as the term. I think it's much more obvious what it means as "free function" is a well defined term that already exists in rust.

It's also a little confusing given "weak alias" is already a term in linker/codegen spaces which are part of the compiler too. Though I'm not particularly worried about that as it's usually very obvious if you're talking about the type system or not lol. I'm also currently trying to write documentation about aliases and it's somewhat awkward/confusing to be talking about *weak* aliases, when I'm not really sure what the basis for that as the term actually *is*.

I would also be happy to just find out there's a nice meaning behind calling them "weak" aliases :-)

r? `@oli-obk`

maybe we want a types MCP to decide on a specific naming here? or maybe we think its just too late to go back on this naming decision ^^'
Closes rust-lang/rust-clippy#14677

changelog: [`zombie_processes`] fix FP inside closures
The Miri Cronjob Bot and others added 6 commits April 29, 2025 06:23
implement or-patterns for pattern types

These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion

cc rust-lang#123646

r? `@BoxyUwU`
r? @ghost

changelog: none
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 1, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Manishearth
Copy link
Member

@bors r+ p=1 rollup=never

@bors
Copy link
Collaborator

bors commented May 1, 2025

📌 Commit c9992d6 has been approved by Manishearth

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2025
@bors
Copy link
Collaborator

bors commented May 1, 2025

⌛ Testing commit c9992d6 with merge 778978f...

bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2025
…nishearth

Clippy subtree update

r? `@Manishearth`
@Zalathar
Copy link
Contributor

Zalathar commented May 2, 2025

The CI job “succeeded” hours ago, but bors seems to be stuck thinking it's still running.

@bors retry

VlaDexa added a commit to VlaDexa/rust that referenced this pull request May 2, 2025
…Manishearth

Clippy subtree update

r? `@Manishearth`
@bors
Copy link
Collaborator

bors commented May 2, 2025

⌛ Testing commit c9992d6 with merge db074a0...

@bors
Copy link
Collaborator

bors commented May 2, 2025

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing db074a0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 2, 2025
@bors bors merged commit db074a0 into rust-lang:master May 2, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 2, 2025
Copy link

github-actions bot commented May 2, 2025

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing cb0d6e7 (parent) -> db074a0 (this PR)

Test differences

Show 33078 test diffs

Stage 1

  • ascii::test_is_ascii_align_size_thoroughly: pass -> [missing] (J0)
  • f32::test_is_infinite: pass -> [missing] (J0)
  • f64::test_sqrt_domain: pass -> [missing] (J0)
  • mpsc::very_long_recv_timeout_wont_panic: pass -> [missing] (J0)
  • mpsc_sync::recv_a_lot: pass -> [missing] (J0)
  • net::parser::parse_socket_v4: pass -> [missing] (J0)
  • num::dec2flt::infinity: pass -> [missing] (J0)
  • num::i128::test_isolate_least_significant_one: pass -> [missing] (J0)
  • num::ops::test_bitxor_defined: pass -> [missing] (J0)
  • num::ops::test_neg_defined: pass -> [missing] (J0)
  • os::raw::tests::same: pass -> [missing] (J0)
  • slice::slice_index::boundpair_overflow_end::index_mut_fail: pass -> [missing] (J0)
  • slice::test_get_disjoint_mut_normal_2: pass -> [missing] (J0)
  • slice::test_iter_folds: pass -> [missing] (J0)
  • sys_common::wtf8::tests::code_point_to_string: pass -> [missing] (J0)
  • time::debug_formatting_precision_two: pass -> [missing] (J0)
  • time::div_duration_f64: pass -> [missing] (J0)
  • vec_deque::test_partial_eq_array: pass -> [missing] (J0)
  • clean::cfg::tests::test_simplify_with: pass -> [missing] (J1)
  • errors::verify_codegen_ssa_compiler_builtins_cannot_call_135: pass -> [missing] (J1)
  • errors::verify_codegen_ssa_ignoring_emit_path_35: pass -> [missing] (J1)
  • errors::verify_expand_macro_body_stability_9: pass -> [missing] (J1)
  • errors::verify_lint_builtin_ellipsis_inclusive_range_patterns_1: pass -> [missing] (J1)
  • errors::verify_metadata_lib_filename_form_70: pass -> [missing] (J1)
  • errors::verify_passes_deprecated_92: pass -> [missing] (J1)
  • errors::verify_passes_doc_test_unknown_include_48: pass -> [missing] (J1)
  • errors::verify_passes_layout_align_116: pass -> [missing] (J1)
  • errors::verify_trait_selection_lf_bound_not_satisfied_23: pass -> [missing] (J1)
  • lints::verify_lint_unused_extern_crate_141: pass -> [missing] (J1)
  • maybe_transmutable::tests::r#ref::should_permit_identity_transmutation: pass -> [missing] (J1)
  • opaque::tests::test_usize: pass -> [missing] (J1)
  • parser::tests::different_note_spanned_3: pass -> [missing] (J1)
  • spec::tests::thumbv7a_nuttx_eabihf: pass -> [missing] (J1)
  • tests::test_derive_empty: pass -> [missing] (J1)
  • ascii::is_ascii::unaligned_head_long::case03_align_to_unrolled: pass -> [missing] (J2)
  • ascii::long::case08_fake_simd_u64: pass -> [missing] (J2)
  • btree::map::clone_slim_100_and_drain_all: pass -> [missing] (J2)
  • num::midpoint::midpoint_obvious_impl_u8: pass -> [missing] (J2)
  • os::unix::net::tests::test_unix_datagram_peek_from: pass -> [missing] (J2)
  • slice::contains_last_element: pass -> [missing] (J2)
  • slice::rotate_huge_half: pass -> [missing] (J2)
  • sort::tests::unstable::correct_f128_random_d20: pass -> [missing] (J2)
  • sort::tests::unstable::panic_retain_orig_set_cell_i32_random_d20: pass -> [missing] (J2)
  • str::debug::ascii_escapes: pass -> [missing] (J2)
  • str::starts_with_str::short_pile_of_poo: pass -> [missing] (J2)
  • vec::bench_clone_from_01_0000_0010: pass -> [missing] (J2)
  • sort::tests::unstable::correct_1k_random: ignore -> [missing] (J3)

Stage 2

  • c_str2::into_boxed: [missing] -> pass (J0)
  • cell::as_ptr: [missing] -> pass (J0)
  • cell::cell_exterior: [missing] -> pass (J0)
  • collections::btree::map::tests::test_cursor_mut_insert_after_3: [missing] -> pass (J0)
  • collections::btree::map::tests::test_levels: [missing] -> pass (J0)
  • f16::test_to_degrees: [missing] -> pass (J0)
  • f32::test_exp2: [missing] -> pass (J0)
  • f64::test_log10: [missing] -> pass (J0)
  • fmt::builders::debug_list::test_empty: [missing] -> pass (J0)
  • iter::traits::double_ended::test_rposition_panic: [missing] -> pass (J0)
  • iter::traits::iterator::test_try_reduce: [missing] -> pass (J0)
  • mpsc::drop_full: [missing] -> pass (J0)
  • mpsc_sync::oneshot_single_thread_try_send_closed: [missing] -> pass (J0)
  • net::socket_addr::is_v4: [missing] -> pass (J0)
  • num::bignum::test_from_u64_overflow: [missing] -> pass (J0)
  • num::f32::midpoint: [missing] -> pass (J0)
  • num::test_try_u64u8: [missing] -> pass (J0)
  • slice::test_capacity: [missing] -> pass (J0)
  • slice::test_rchunks_exact_mut_count: [missing] -> pass (J0)
  • str::slice_index::assert_range_eq_can_fail_by_inequality: [missing] -> pass (J0)
  • test_boxed_hasher: [missing] -> pass (J0)
  • time::duration_const: [missing] -> pass (J0)
  • vec::test_clone: [missing] -> pass (J0)
  • vec::test_index_out_of_bounds: [missing] -> pass (J0)
  • coverage::tests::test_covgraph_goto_switchint: [missing] -> pass (J1)
  • errors::verify_codegen_ssa_extract_bundled_libs_open_file_68: [missing] -> pass (J1)
  • errors::verify_codegen_ssa_xcrun_unsuccessful_140: [missing] -> pass (J1)
  • errors::verify_mir_build_const_param_in_pattern_1: [missing] -> pass (J1)
  • errors::verify_monomorphize_abi_required_target_feature_10: [missing] -> pass (J1)
  • hir::tests::cast_array: [missing] -> pass (J1)
  • html::render::ordered_json::tests::serialize_array: [missing] -> pass (J1)
  • lints::verify_lint_useless_ptr_null_checks_fn_ret_44: [missing] -> pass (J1)
  • parser::tests::long_snippet_multiple_spans: [missing] -> pass (J1)
  • sorted_map::tests::test_get_and_index: [missing] -> pass (J1)
  • spec::tests::i686_unknown_freebsd: [missing] -> pass (J1)
  • tests::test_unused: [missing] -> pass (J1)
  • theme::tests::test_comparison: [missing] -> pass (J1)
  • ascii::long::case03_branch_and_subtract: [missing] -> pass (J2)
  • ascii::medium::case10_mask_mult_bool_lookup_table: [missing] -> pass (J2)
  • btree::map::clone_slim_10k_and_into_iter: [missing] -> pass (J2)
  • iter::bench_take_while_chain_sum: [missing] -> pass (J2)
  • num::bench_i16_from_str_radix_2: [missing] -> pass (J2)
  • sort::tests::stable::correct_f128_random_d2: [missing] -> pass (J2)
  • sort::tests::stable::deterministic_cell_i32_random_d2: [missing] -> pass (J2)
  • sort::tests::stable::self_cmp_string_ascending: [missing] -> pass (J2)
  • str::rfind_zzz_char::long_lorem_ipsum: [missing] -> pass (J2)
  • str::starts_with_str::long_lorem_ipsum: [missing] -> pass (J2)
  • vec::bench_clone_0000: [missing] -> pass (J2)
  • sort::tests::stable::correct_cell_i32_descending: [missing] -> ignore (J3)
  • sort::tests::stable::correct_u128_random: [missing] -> ignore (J3)
  • sort::tests::stable::self_cmp_string_ascending: [missing] -> ignore (J3)
  • sort::tests::unstable::stability_cell_i32_random_d2: [missing] -> ignore (J3)
  • sys::pal::unix::kernel_copy::tests::bench_file_to_uds_copy: [missing] -> pass (J4)

(and 16444 additional test diffs)

Additionally, 16534 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard db074a06fe6649f9455dff8ad3eddd60683036f3 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-2: 6091.1s -> 1127.5s (-81.5%)
  2. test-various: 4289.3s -> 2263.9s (-47.2%)
  3. x86_64-gnu-aux: 5988.0s -> 4161.3s (-30.5%)
  4. x86_64-apple-1: 8883.0s -> 6621.1s (-25.5%)
  5. aarch64-apple: 4174.5s -> 3118.0s (-25.3%)
  6. dist-aarch64-apple: 6130.0s -> 5028.8s (-18.0%)
  7. dist-apple-various: 6344.9s -> 7266.3s (14.5%)
  8. dist-arm-linux: 5176.9s -> 4705.4s (-9.1%)
  9. dist-x86_64-netbsd: 5422.6s -> 5086.7s (-6.2%)
  10. x86_64-msvc-1: 8577.9s -> 9080.4s (5.9%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (db074a0): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.3% [-1.3%, -1.3%] 1

Max RSS (memory usage)

Results (primary 0.1%, secondary 2.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.5%, 1.0%] 7
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
-0.9% [-1.8%, -0.6%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-1.8%, 1.0%] 11

Cycles

Results (primary 0.4%, secondary 3.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.6% [0.4%, 4.0%] 8
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
-0.7% [-1.2%, -0.4%] 8
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-1.2%, 4.0%] 16

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 768.128s -> 767.923s (-0.03%)
Artifact size: 365.57 MiB -> 365.55 MiB (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.