Update Clippy
Out of cycle sync: I want to get https://github.com/rust-lang/rust-clippy/pull/7129 into beta that is branched next week.
This sync only adds one new feature in efc4c6c, which looks fine to me. Otherwise it only contains bug fixes and/or restricts lints further.
r? `@Manishearth`
Reuse modules on `hermit`
Reuse the following modules on `hermit`:
- `unix::path` (contents identical)
- `unsupported::io` (contents identical)
- `unsupported::thread_local_key` (contents functionally identical, only changes are the panic error messages)
`@rustbot` label: +T-libs-impl
Fix FN in `iter_cloned_collect` with a large array
fixes#6808
changelog: Fix FN in `iter_cloned_collect` with a large array
I spotted that [is_iterable_array](a362a4d1d0/clippy_lints/src/loops/explicit_iter_loop.rs (L67-L75)) function that `explicit_iter_loop` lint is using only works for array sizes <= 32.
There is this comment:
> IntoIterator is currently only implemented for array sizes <= 32 in rustc
I'm a bit confused, because I read that [IntoIterator for arrays](https://doc.rust-lang.org/src/core/array/mod.rs.html#194-201) with const generic `N` is stable since = "1.0.0". Although Const Generics MVP were stabilized in Rust 1.51.
Should I set MSRV for the current change? I will try to test with older compilers soon.
Reorder the parameter descriptions of map_or and map_or_else
They were described backwards, probably leading users to write arguments in the wrong order. Bug: #84608
check item.is_fake() instead of self_id.is_some()
Remove empty branching in Attributes::from_ast
diverse small refacto after Josha review
cfg computation moved in merge_attrs
refacto use from_ast twice for coherence
take cfg out of Attributes and move it to Item
refacto use from_def_id_and_attrs_and_parts instead of an old trick
most of josha suggestions + check if def_id is not fake before using it in a query
Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
Fix coverage ICE because fn_sig can have a span that crosses file bou…
Fixes: #83792
MIR `InstrumentCoverage` assumed the `FnSig` span was contained within a
single file, but this is not always the case. Some macro constructions
can result in a span that starts in one `SourceFile` and ends in a
different one.
The `FnSig` span is included in coverage results as long as that span is
in the same `SourceFile` and the same macro context, but by assuming the
`FnSig` span's `hi()` and `lo()` were in the same file, I took this for
granted, and checked only that the `FnSig` `hi()` was in the same
`SourceFile` as the `body_span`.
I actually drop the `hi()` though, and extend the `FnSig` span to the
`body_span.lo()`, so I really should have simply checked that the
`FnSig` span's `lo()` was in the `SourceFile` of the `body_span`.
r? `@tmandry`
cc: `@wesleywiser`
Add the `try_trait_v2` library basics
No compiler changes as part of this -- just new unstable traits and impls thereof.
The goal here is to add the things that aren't going to break anything, to keep the feature implementation simpler in the next PR.
(Draft since the FCP won't end until Saturday, but I was feeling optimistic today -- and had forgotten that FCP was 10 days, not 7 days.)
manual_unwrap_or: fix invalid code suggestion, due to macro expansion
fixes#6965
changelog: fix invalid code suggestion in `manual_unwrap_or` lint, due to macro expansion
Refactor MSRV aliases
changelog: Remove MSRV from `needless_question_mark` and change MSRV for `missing_const_for_fn` from 1.37.0 to 1.46.0.
First [mentioned on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Better.20MSRV.20testing.20idea/near/236215074).
* Moves MSRV constants into `clippy_utils::msrvs`. Now they are named to represent a stabilized feature flag or library item that is required for a lint's suggestion.
* `needless_question_mark` no longer has MSRV. Not needed since it does not suggest adding `?`.
* `missing_const_for_fn` MSRV was changed from 1.37.0 to 1.46.0. This seems to be a past mistake.
Unify the docs of std::env::{args_os, args} more
I noticed that `args_os` was missing some information and I thought it should mention `args` for when you want more safety just like how `args` mentions `args_os` if you don't want it to panic on invalid Unicode.
Stabilize Duration::MAX
Following the suggested direction from https://github.com/rust-lang/rust/issues/76416#issuecomment-817278338, this PR proposes that `Duration::MAX` should have been part of the `duration_saturating_ops` feature flag all along, having been
0. heavily referenced by that feature flag
1. an odd duck next to most of `duration_constants`, as I expressed in https://github.com/rust-lang/rust/issues/57391#issuecomment-717681193
2. introduced in #76114 which added `duration_saturating_ops`
and accordingly should be folded into `duration_saturating_ops` and therefore stabilized.
r? `@m-ou-se`
Remove slice diagnostic item
...because it is unusally placed on an impl and is redundant with a lang item.
Depends on rust-lang/rust-clippy#7074 (next clippy sync). ~I expect clippy tests to fail in the meantime.~ Nope tests passed...
CC `@flip1995`
extend `single_element_loop` to match `.iter()`
This extends `single_element_loop` to also match `[..].iter()` in the loop argument. Related to #7125, but not completely fixing it due to the lint only firing if the array expression contains a local variable.
---
changelog: none
Fix typo in report_unsed_assign
The function was called `report_unsed_assign`, which I assume is a typo, considering the rest of the file.
This replaces `report_unsed_assign` with `report_unused_assign`.