yanglsh
d027ca95de
Add regression test for #11709
2025-03-01 20:45:46 +08:00
yanglsh
3899488e53
fix undocumented_unsafe_blocks FP in long assignment
2025-03-01 20:35:48 +08:00
yanglsh
91d20cbb82
Use inner span in undocumented_unsafe_blocks
2025-03-01 20:35:18 +08:00
J-ZhengLi
d395646a60
fix [undocumented_unsafe_blocks] FP with trait/impl items
2025-03-01 20:33:24 +08:00
Samuel Tardieu
029a6db879
Apply implicit_saturating_sub to Clippy sources
2025-02-28 23:50:43 +01:00
Samuel Tardieu
60e1d7ec2d
Extend {implicit,inverted}_saturating_sub to expressions
...
Side-effect free expressions are eligible to these lints,
whereas previously only local variables were checked.
2025-02-28 23:50:43 +01:00
Alex Macleod
5b0004c45f
Migrate clippy_lints to new MSRV API
2025-02-28 18:15:11 +00:00
Timo
2cdb90d961
New lint: manual_midpoint ( #13851 )
...
changelog: [`manual_midpoint`]: new lint
Closes #13849
2025-02-28 16:27:34 +00:00
Alejandra González
e1c1ac1592
configuration option to lint incompatible_msrv in test code ( #14279 )
...
fixes #14277
changelog: [`incompatible_msrv`]: add config option
[`check-incompatible-msrv-in-tests`] to enable in `#[test]` and
`#[cfg(test)]` code.
2025-02-28 12:41:46 +00:00
Samuel Tardieu
baadee8fd3
New lint: manual_midpoint
2025-02-27 22:12:16 +01:00
Philipp Krones
53a1ff70e8
Check os_str_display MSRV instead of feature
...
This feature was stabilized, so the FormatArgs lints should check if the MSRV of
the stabilization is met, rather than checking if the feature is enabled.
2025-02-27 21:51:42 +01:00
Philipp Krones
02e812af4d
Merge remote-tracking branch 'upstream/master' into rustup
2025-02-27 21:51:42 +01:00
Philipp Krones
063d6aef0e
macro_use_import: Don't check is attribute comes from expansion
...
It is not possible to write a declarative macro, that produces an attribute w/o
an item attached to it. This means that the `check_item` will already insert the
span in the map, if it came from an expansion. So additionally checking if the
macro came from an expansion doesn't add anything here. So the
`check_attribute` function, and with that the problematic `attr.span()` call can
be completely removed.
Fixes #14303
2025-02-27 20:42:56 +01:00
Alex Macleod
4a9b8c6415
fix: map_entry FP inside closure ( #14307 )
...
Closes #11976
changelog: [`map_entry`]: fix FP inside closure
2025-02-27 14:42:00 +00:00
yanglsh
329acde93e
fix: map_entry FP inside closure
2025-02-27 21:28:00 +08:00
dswij
527ab050fa
fix: Avoid ICE in doc_nested_refdefs check by checking range ( #14308 )
...
The `looks_like_refdef` function was assuming the range was valid, this
just adds a check to ensure that is the case. It also works around a
subtraction underflow due to the same invalid range.
changelog: [`doc_nested_refdefs`]: Fix #14287 by avoiding invalid ranges
2025-02-27 10:45:31 +00:00
Fridtjof Stoldt
f50266a423
Split needless_lifetime '_ suggestions into elidable_lifetime_names ( #13960 )
...
Fixes https://github.com/rust-lang/rust-clippy/issues/13514
changelog: Added [`elidable_lifetime_names`] to `pedantic` (Split off
from [`needless_lifetime`] for suggestions with `'_`)
[#13960 ](https://github.com/rust-lang/rust-clippy/pull/13960 )
changelog: Enhancement: [`needless_lifetime`] No longer lints for
elidable lifetimes `'_`, use [`elidable_lifetime_names`] to lint these.
[#13960 ](https://github.com/rust-lang/rust-clippy/pull/13960 )
2025-02-27 09:21:50 +00:00
Jake Shadle
e399e152e8
Fix ICE
2025-02-27 10:18:44 +01:00
Samuel Tardieu
e9561289d6
Remove obsolete TODO
2025-02-26 23:36:31 +01:00
Alejandra González
b583568e72
Add unnecessary_debug_formatting lint ( #13893 )
...
Fixes #12674 , i.e., adds a lint to flag `Path`s printed with `{:?}`.
Nits are welcome.
changelog: Add `unnecessary_debug_formatting` lint
2025-02-26 15:03:57 +00:00
Alex Macleod
b821f972b6
manual_strip: use existing identifier instead of placeholder (#14188 )
...
When the manually stripped entity receives a name as the first use
through a simple `let` statement, this name can be used in the generated
`if let Some(…)` expression instead of a placeholder.
Fix #14183
changelog: [`manual_strip`]: reuse existing identifier in suggestion
when possible
2025-02-26 14:41:41 +00:00
Samuel Moelius
6af901c51e
Add unnecessary_debug_formatting lint
...
Address review comments
Fix adjacent code
Required now that the lint is pedantic
Add inline formatting tests
Add note re formatting changes
Address `unnecessary_map_or` warnings
Address additional review comments
Typo
Update Clippy version
2025-02-26 14:25:58 +00:00
Bryce Berger
325bfef88d
configuration option to lint incompatible_msrv in test code
2025-02-25 19:54:05 -05:00
Alejandra González
0fb004dd56
extend obfuscated_if_else to support {then(), then_some()}.unwrap_or_else() ( #14165 )
...
These method chains can be expressed concisely with `if`/`else`.
changelog: [`obfuscated_if_else`]: support `then().unwrap_or_else()` and
`then_some().unwrap_or_else()`
2025-02-24 19:27:56 +00:00
Alex Macleod
efcf1f5730
Split needless_lifetime '_ suggestions into elidable_lifetime_names
2025-02-24 14:23:33 +00:00
Jana Dönszelmann
17bda0c0fe
simplify must-use lint slightly
2025-02-24 14:31:19 +01:00
Jana Dönszelmann
443b0f5ccf
Fix rustdoc and clippy
2025-02-24 14:31:19 +01:00
Jason Newcomb
0fa170621d
fix: too_long_first_doc_paragraph suggests wrongly when first line too long ( #14276 )
...
Fixes #14274
changelog: [`too_long_first_doc_paragraph`]: fix wrong suggestion when
first line too long
2025-02-24 10:04:01 +00:00
Manish Goregaokar
35d5ee0e41
add MSRV check for repeat_vec_with_capacity ( #14126 )
...
changelog: [`repeat_vec_with_capacity`]: add MSRV check
2025-02-23 15:50:44 +00:00
dswij
d92da0fb32
manual_slice_fill: do not initialize from the iterator (#14191 )
...
```rust
let mut tmp = vec![1, 2, 3];
for b in &mut tmp {
*b = !*b;
}
```
must not suggest the invalid `tmp.fill(!*b)`.
In addition, there is another commit which cleans up two function calls
with no effect.
Fix #14189
changelog: [`manual_slice_fill`]: ensure that the initialization
expression doesn't reference the iterator
2025-02-22 15:28:15 +00:00
Timo
d5488b3b63
useless_asref: add a check for Clone before suggesting the use of .clone() (#14174 )
...
fixes #12357
changelog: [`useless_asref`]: don't suggest to use `.clone()` if the
target type doesn't implement the `Clone` trait
2025-02-22 14:04:57 +00:00
yanglsh
2ad3520d51
fix: too_long_first_doc_paragraph suggests wrongly when first line too long
2025-02-22 19:05:07 +08:00
Michael Goulet
ba8079d0db
Make a fake body to store typeck results for global_asm
2025-02-22 00:12:07 +00:00
Michael Goulet
e5dbcc2c16
Make asm a named field
2025-02-22 00:05:09 +00:00
Andre Bogus
6366cca439
add io_other_error lint
2025-02-21 22:08:31 +01:00
bors
49082f94fc
Auto merge of #137397 - matthiaskrgr:rollup-ls2pilo, r=matthiaskrgr
...
Rollup of 10 pull requests
Successful merges:
- #132876 (rustdoc book: acknowledge --document-hidden-items)
- #136148 (Optionally add type names to `TypeId`s.)
- #136609 (libcore/net: `IpAddr::as_octets()`)
- #137336 (Stabilise `os_str_display`)
- #137350 (Move methods from Map to TyCtxt, part 3.)
- #137353 (Implement `read_buf` for WASI stdin)
- #137361 (Refactor `OperandRef::extract_field` to prep for MCP838)
- #137367 (Do not exempt nonexistent platforms from platform policy)
- #137374 (Stacker now handles miri using a noop impl itself)
- #137392 (remove few unused fields)
r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-21 19:57:50 +00:00
lapla-cogito
6c6ffd27a2
extend obfuscated_if_else to support then().unwrap_or_else() and then_some().unwrap_or_else()
2025-02-22 03:22:23 +09:00
Alejandra González
649cef0e81
rename MANUAL_DIV_CEIL MSRV alias and add missing conf info for manual_div_ceil ( #14263 )
...
- The name of an MSRV alias should describe its functionality, and it is
not appropriate for it to be the same as the name of the lint that uses
it.
- Additionally, while `manual_div_ceil` allows setting MSRV, this is not
correctly reflected in the configuration information.
changelog: none
2025-02-21 18:02:30 +00:00
Matthias Krüger
8113d54600
Rollup merge of #137305 - nnethercote:rustc_middle-2, r=lcnr
...
Tweaks in and around `rustc_middle`
A bunch of tiny improvements I found while working on bigger things.
r? ```@lcnr```
2025-02-21 12:45:25 +01:00
Samuel Tardieu
4ac7a5361b
Represent the capability instead of the lint name in msrv aliases
...
`INTEGER_BITS` better represents the addition of the `BITS` value on the
primitive integer types.
2025-02-21 09:44:18 +01:00
Nicholas Nethercote
c2d75cff47
Move methods from Map to TyCtxt, part 3.
...
Continuing the work from #137162 .
Every method gains a `hir_` prefix.
2025-02-21 14:31:09 +11:00
Nicholas Nethercote
41a34552c7
Rename ClearCrossCrate::assert_crate_local.
...
As `unwrap_crate_local`, because it follows exactly the standard form of
an `unwrap` function.
2025-02-21 07:12:13 +11:00
Samuel Tardieu
acfbbc65b5
Remove obsolete comment and simplify code
...
The `IoBufRead` diagnostic has been added during the latest rustup.
2025-02-20 18:03:40 +01:00
Philipp Krones
238edf273d
Rustup ( #14262 )
...
r? @ghost
changelog: none
2025-02-20 14:59:15 +00:00
Timo
bbf65f008d
add owned_cow lint ( #13948 )
...
Closes #13697 .
---
changelog: add [`owned_cow`] lint
2025-02-20 14:53:45 +00:00
Fridtjof Stoldt
7c889ac449
Changelog for Clippy 1.85 🦜 ( #14229 )
...
Roses are red,
Biolets are blue,
A typo happened,
too late now
You might be asking,
what are Biolets now?
And to be honest,
I have no clue
---
The cat of this release is `Vera` nominated by @and-reas-se
<img height=500
src="https://github.com/user-attachments/assets/82e6fccc-1f6d-4d29-b6bb-0bd4f3584593 "
alt="The cats of this Clippy release" />
Cats for the next release can be nominated in the comments :D
---
changelog: none
2025-02-20 14:32:01 +00:00
lapla-cogito
3c9a0ab38c
rename the MSRV alias MANUAL_DIV_CEIL to DIV_CEIL
2025-02-20 23:26:51 +09:00
Philipp Krones
12025085b9
Merge remote-tracking branch 'upstream/master' into rustup
2025-02-20 15:26:07 +01:00
Andre Bogus
83f5cbad18
add owned_cow lint
2025-02-19 23:12:46 +01:00
Matthias Krüger
a81c2648dc
Rollup merge of #136923 - samueltardieu:push-vxxqvqwspssv, r=davidtwco
...
Lint `#[must_use]` attributes applied to methods in trait impls
The `#[must_use]` attribute has no effect when applied to methods in trait implementations. This PR adds it to the unused `#[must_use]` lint, and cleans the extra attributes in portable-simd and Clippy.
2025-02-19 21:16:11 +01:00