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 #135297

Merged
merged 82 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
a5d5edc
Do not trigger trailing_empty_array in tests
alex-semenyuk Dec 17, 2024
639f405
Remove obsolete comment
samueltardieu Dec 17, 2024
15ab2ff
use the correct `ParamEnv` when checking future's return type in `mis…
y21 Dec 21, 2024
de86302
correct suggestion for manual_div_ceil lint
lapla-cogito Dec 22, 2024
71f1a87
remove known problems section from match_same_arms
lapla-cogito Dec 24, 2024
be09596
Examples fixes for regex
alex-semenyuk Dec 24, 2024
1cc5051
Merge commit '609cd310be44677ae31d452a17b0f8207e1abfe1' into clippy-s…
flip1995 Dec 26, 2024
8a38bcc
Make "all fields are shorthand" requirement configurable
smoelius Nov 26, 2024
553a381
Remove obsolete comment (#13850)
y21 Dec 27, 2024
4be0e62
correct suggestion for `manual_div_ceil` lint (#13864)
xFrednet Dec 27, 2024
363e61d
remove description of known problems in `match_same_arms` that have a…
xFrednet Dec 27, 2024
a8968e5
Make `inconsistent_struct_constructor` "all fields are shorthand" req…
y21 Dec 27, 2024
09022bb
fix arguments of ExprKind::MethodCall
lapla-cogito Dec 28, 2024
998c780
fix arguments of `ExprKind::MethodCall` (#13890)
flip1995 Dec 28, 2024
e582fcd
[`needless_continue`]: lint if the last stmt in for/while/loop is `co…
lengyijun Sep 20, 2023
d7cc6c4
borrow_interior_mutable_const ICE into FN
blyxyas Dec 25, 2024
786f090
Do not trigger `trailing_empty_array` in tests (#13844)
llogiq Dec 29, 2024
aef4772
Examples fixes for regex (#13874)
dswij Dec 29, 2024
c8ba3e1
use the correct `ParamEnv` when checking future's output type (#13863)
dswij Dec 29, 2024
eef47fc
Do not remove required parentheses in `borrow_as_ptr` suggestion
samueltardieu Dec 27, 2024
f5f1abd
`borrow_interior_mutable_const` ICE into FN (#13877)
xFrednet Dec 29, 2024
b57d98b
Do not remove required parentheses in `borrow_as_ptr` suggestion (#13…
blyxyas Dec 29, 2024
34b1765
Move more def paths into `clippy_utils::paths`
GuillaumeGomez Dec 29, 2024
a9fe043
Do not remove identity mapping if mandatory mutability would be lost
samueltardieu Dec 29, 2024
e4b11a7
Fix parentheses when replacing `matches!(…, None)` with `.is_none()`
samueltardieu Dec 29, 2024
a657fcc
Use the full lifetime name in suggestions
samueltardieu Dec 29, 2024
b515064
Correctly handle `char` paths
GuillaumeGomez Dec 30, 2024
be49f86
Move more def paths into `clippy_utils::paths` (#13903)
y21 Dec 30, 2024
2aea7a0
Fix parentheses when replacing `matches!(…, None)` with `.is_none()` …
y21 Dec 30, 2024
7a834b5
Use the full lifetime name in suggestions (#13907)
Manishearth Dec 30, 2024
4899333
better suggestion for slow_vector_initialization
lapla-cogito Dec 31, 2024
1e0b782
add test for ICE
matthiaskrgr Dec 31, 2024
2a4dadd
fix type suggestion for manual_is_ascii_check (#13913)
Otto-AA Dec 31, 2024
c52740c
add test for ICE (#13914)
dswij Dec 31, 2024
3bc089e
refactor manual_is_ascii_check to remove unused parameter
Otto-AA Dec 31, 2024
54e5116
cover guard patterns in clippy lints
max-niederman Oct 6, 2024
4c9c2cc
Check if deref target implements `is_empty` for `len_zero` lint
samueltardieu Dec 23, 2024
33a6590
Check if deref target implements `is_empty` for `len_zero` lint (#13871)
blyxyas Jan 1, 2025
707653f
Add lint for calling last() on DoubleEndedIterator
qsantos Jan 1, 2025
458c955
Fix conflicts with double_ended_iterator_last
qsantos Jan 1, 2025
09c5d34
Dogfood double_ended_iterator_last
qsantos Jan 1, 2025
034f3d2
Improve `slow_vector_initialization` suggestion (#13912)
blyxyas Jan 1, 2025
27acfd8
Prefer if chain to let-else
qsantos Jan 1, 2025
7331cc0
Only complain about default Iterator::last()
qsantos Jan 1, 2025
0d213aa
Revert "Dogfood double_ended_iterator_last"
qsantos Jan 1, 2025
d67c00f
Dogfood double_ended_iterator_last
qsantos Jan 1, 2025
f18399f
Emit redundant if when duplicated in `needless_continue`
profetia Dec 28, 2024
631d9a2
Add lint for calling `Iterator::last()` on `DoubleEndedIterator` (#13…
Manishearth Jan 2, 2025
9c46e11
Remove unneeded parentheses in `unnecessary_map_or` lint output
samueltardieu Jan 2, 2025
7ac1515
Make CI a little bit safer
blyxyas Jan 2, 2025
7a01033
Make CI a little bit safer (#13933)
blyxyas Jan 3, 2025
ad36f2b
turn rustc_box into an intrinsic
RalfJung Jan 2, 2025
4736004
Update version attribute for 1.84 clippy lints
xFrednet Jan 3, 2025
4e4a2d0
Changelog for Clippy 1.84 :firecracker:
xFrednet Jan 3, 2025
1b85ae3
Only emit `useless_vec` suggestion if the macro does not contain code…
GuillaumeGomez Dec 30, 2024
b76e042
Add regression test for `useless_vec` with code comments
GuillaumeGomez Dec 30, 2024
f416f26
turn hir::ItemKind::Fn into a named-field variant
RalfJung Jan 4, 2025
5262111
Rollup merge of #135046 - RalfJung:rustc_box_intrinsic, r=compiler-er…
workingjubilee Jan 4, 2025
622382b
Fix year in CHANGELOG.md
xFrednet Jan 4, 2025
54f88c3
[`needless_continue`]: lint if the last stmt in loop is `continue` re…
blyxyas Jan 4, 2025
12d3137
CI: be compatible with both Rustup pre-1.28.0 and 1.28.0
samueltardieu Jan 4, 2025
ad69c65
Only emit `useless_vec` suggestion if the macro does not contain code…
xFrednet Jan 4, 2025
ca55534
Do not trigger clippy::missing_const_for_fn triggering for tests
alex-semenyuk Jan 4, 2025
a9c0e22
Changelog for Clippy 1.84 🧨 (#13937)
Centri3 Jan 6, 2025
891e387
Don't emit machine applicable `map_flatten` lint if there are code co…
GuillaumeGomez Jan 4, 2025
78225cc
Add regression test for #8528
GuillaumeGomez Jan 4, 2025
0e2505b
Do not trigger `missing_const_for_fn` for tests (#13945)
Manishearth Jan 6, 2025
63487dd
`clippy::redundant_locals` is not a correctness lint
hrxi Nov 28, 2024
98b9a26
`clippy::redundant_locals` is not a correctness lint (#13747)
Centri3 Jan 7, 2025
d0d5b8a
Don't emit machine applicable `map_flatten` lint if there are code co…
xFrednet Jan 7, 2025
4ef9177
CI: be compatible with both Rustup pre-1.28.0 and 1.28.0 (#13944)
flip1995 Jan 7, 2025
b7b69b1
Remove unneeded parentheses in `unnecessary_map_or` lint output (#13932)
Alexendoo Jan 7, 2025
f5ca68f
Do not remove identity mapping if mandatory mutability would be lost …
Alexendoo Jan 7, 2025
11f38ad
Rollup merge of #134989 - max-niederman:guard-patterns-hir, r=oli-obk
matthiaskrgr Jan 7, 2025
8461d3f
Remove unnecessary string allocation
Otto-AA Jan 8, 2025
894e87c
Fix type suggestion for manual_is_ascii_check (#13916)
Alexendoo Jan 8, 2025
b5bf09e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jan 9, 2025
bb4a259
Bump nightly version -> 2024-01-09
flip1995 Jan 9, 2025
663892b
Bump Clippy version -> 0.1.86
flip1995 Jan 9, 2025
19e305b
Rustup (#13970)
flip1995 Jan 9, 2025
573db1c
Merge commit '19e305bb57a7595f2a8d81f521c0dd8bf854e739' into clippy-s…
flip1995 Jan 9, 2025
43c3b30
Update Cargo.lock
flip1995 Jan 9, 2025
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
Next Next commit
Do not trigger trailing_empty_array in tests
  • Loading branch information
alex-semenyuk committed Dec 17, 2024
commit a5d5edc581be1ba1c598f9313e309263bc7360b3
7 changes: 5 additions & 2 deletions clippy_lints/src/trailing_empty_array.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::has_repr_attr;
use clippy_utils::{has_repr_attr, is_in_test};
use rustc_hir::{Item, ItemKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
Expand Down Expand Up @@ -37,7 +37,10 @@ declare_lint_pass!(TrailingEmptyArray => [TRAILING_EMPTY_ARRAY]);

impl<'tcx> LateLintPass<'tcx> for TrailingEmptyArray {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
if is_struct_with_trailing_zero_sized_array(cx, item) && !has_repr_attr(cx, item.hir_id()) {
if is_struct_with_trailing_zero_sized_array(cx, item)
&& !has_repr_attr(cx, item.hir_id())
&& !is_in_test(cx.tcx, item.hir_id())
{
span_lint_and_help(
cx,
TRAILING_EMPTY_ARRAY,
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/trailing_empty_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,17 @@ type C = ConstParamNoDefault<0>;
type D = ConstParamNonZeroDefault<0>;

fn main() {}

#[cfg(test)]
mod tests {
pub struct Friend {
age: u8,
}

#[test]
fn oldest_empty_is_none() {
struct Michael {
friends: [Friend; 0],
}
}
}