Commit Graph

19128 Commits

Author SHA1 Message Date
Hamir Mahal
30ee7af2ca
style: sync GitHub Corner colors 2024-02-25 12:54:46 -08:00
bors
10c99031ce Auto merge of #12348 - Alexendoo:remove-get-parent-node, r=y21
Remove `clippy_utils::get_parent_node`

Since it's forwarding to a single method it seems reasonable to use that one directly instead

changelog: none
2024-02-25 17:43:59 +00:00
Alex Macleod
bee4111a61 Remove clippy_utils::get_parent_node 2024-02-25 16:35:17 +00:00
bors
c469cb0023 Auto merge of #12336 - not-elm:fix/issue-12243, r=y21
FIX(12243): redundant_guards

Fixed #12243

changelog: Fix[`redundant_guards`]

I have made a correction so that no warning does  appear when y.is_empty() is used within a constant function as follows.

```rust
pub const fn const_fn(x: &str) {
    match x {
        // Shouldn't lint.
        y if y.is_empty() => {},
        _ => {},
    }
}
```
2024-02-25 14:56:07 +00:00
bors
76e4864119 Auto merge of #12339 - GuillaumeGomez:add-unnecessary_get_then_check, r=llogiq
Add new `unnecessary_get_then_check` lint

No issue linked to this as far as I can see. It's a lint I discovered that could be added when I worked on another lint.

r? `@llogiq`

changelog: Add new `unnecessary_get_then_check` lint
2024-02-25 10:39:24 +00:00
bors
8ef1b73442 Auto merge of #12346 - klensy:itertools-bump, r=llogiq
bump itertools to 0.12

Bumps itertools to newer 0.12 version, https://github.com/rust-itertools/itertools/blob/v0.12.1/CHANGELOG.md

changelog: none
2024-02-25 10:25:16 +00:00
klensy
cdaccd7fce bump itertools to 0.12 2024-02-25 13:14:07 +03:00
bors
0d1ba48cb4 Auto merge of #12345 - xFrednet:00000-some-healthy-life-choices, r=xFrednet
Pause PR assignments for xFrednet :)

My life is currently a bit chaotic, and it feels like I can't give reviews the attention they need. I'll finish the PRs I'm assigned to, write the changelogs, and am available when I get pinged etc.

This is only intended as a temporary pause, as I still genuinely enjoy working with everyone in this repo and seeing Clippy grow day by day.

---

changelog: none

r? `@ghost`
2024-02-25 09:57:59 +00:00
xFrednet
6b7700ef49
Pause PR assignments for xFrednet :) 2024-02-25 10:18:55 +01:00
not-elm
5a63cd82cb FIX(12243): redundant_guard
A warning is now suppressed when "<str_va> if <str_var>.is_empty" is used in a constant function.

FIX: instead of clippy_util::in_const

FIX: Merged `redundant_guards_const_fn.rs` into `redundant_guards.rs`.
2024-02-25 15:38:18 +09:00
Guillaume Gomez
5e2707d343 Fix new lint warnings 2024-02-24 15:02:10 +01:00
Guillaume Gomez
a1971414ec Update ui tests 2024-02-24 15:02:10 +01:00
Guillaume Gomez
40cff2d99f Add ui test for unnecessary_get_then_check 2024-02-24 15:02:10 +01:00
Guillaume Gomez
ad319484f1 Add new unnecessary_get_then_check clippy lint 2024-02-24 15:02:10 +01:00
bors
a2c1d565e5 Auto merge of #12259 - GuillaumeGomez:multiple-bound-locations, r=llogiq
Add new `multiple_bound_locations` lint

Fixes #7181.

r? `@llogiq`

changelog: Add new `multiple_bound_locations` lint
2024-02-24 13:43:34 +00:00
bors
64054693eb Auto merge of #12322 - sanxiyn:expression-with-attribute, r=llogiq
Be careful with expressions with attributes

Fix #9949.

changelog: [`unused_unit`]: skip expressions with attributes
2024-02-24 10:52:55 +00:00
bors
0597838892 Auto merge of #12260 - Jarcho:issue_12255, r=llogiq
Take lifetime extension into account in `ref_as_ptr`

fixes #12255

This should be merged upstream as well. Changing `let x = &temp as *const _` into `let x = from_ref(&temp)` is UB.

changelog: `ref_as_ptr`: Take lifetime extension into account
2024-02-24 04:28:53 +00:00
Jason Newcomb
5ab42d8e6a Take lifetime extension into account in ref_as_ptr 2024-02-23 21:33:53 -05:00
Guillaume Gomez
762448bc55 Update ui tests 2024-02-23 17:38:39 +01:00
Guillaume Gomez
6955a8ac4e Add ui test for multiple_bound_locations lint 2024-02-23 16:40:21 +01:00
Guillaume Gomez
d654acd554 Add new multiple_bound_locations lint 2024-02-23 13:22:21 +01:00
bors
5a52c8aee9 Auto merge of #12333 - MarcusGrass:issue-12223, r=Manishearth
Allow unused_imports, and unused_import_braces on `use`

Fixes https://github.com/rust-lang/rust-clippy/issues/12223.

Both `unused_import_braces` and `unused_imports` are valid on `use`-items, additional to the two previously allowed.

changelog: [`useless_attribute`]: Allow `rustc_lint` `unused_import_braces` and `unused_imports` on `use`-items
2024-02-22 22:47:03 +00:00
MarcusGrass
f1974593c9
Remove double unused_imports check 2024-02-22 23:12:38 +01:00
MarcusGrass
97a3ac5b86
Allow unused_imports, and unused_import_braces on use 2024-02-22 21:53:04 +01:00
bors
341ae30a85 Auto merge of #12332 - blyxyas:not-on-vacation, r=blyxyas
Coming back to reviewer rotation

After this current CPP period, in which I set myself as on-vacation to focus on performance, I'm now available again. I'd love if my vacation status wasn't present in version control

changelog:none
r? ghost
2024-02-22 16:06:38 +00:00
blyxyas
c6a720f2f2
Coming back to reviewer rotation 2024-02-22 16:41:01 +01:00
bors
379342cf7a Auto merge of #12331 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-02-22 15:38:27 +00:00
Philipp Krones
8a58b7613d
Update i686 asm test stderr 2024-02-22 16:27:24 +01:00
Philipp Krones
cc6dcaae57
Use Level::from_symbol in unnecessary_clippy_cfg 2024-02-22 16:07:28 +01:00
Philipp Krones
6591dc683e
Bump nightly version -> 2024-02-22 2024-02-22 15:59:39 +01:00
Philipp Krones
dc0bb69e66
Merge remote-tracking branch 'upstream/master' into rustup 2024-02-22 15:59:29 +01:00
bors
d554bcad79 Auto merge of #12303 - GuillaumeGomez:unneedeed_clippy_cfg_attr, r=flip1995
Add `unnecessary_clippy_cfg` lint

Follow-up of https://github.com/rust-lang/rust-clippy/pull/12292.

r? `@flip1995`

changelog: Add `unnecessary_clippy_cfg` lint
2024-02-22 11:00:52 +00:00
Guillaume Gomez
cf6a14cea1 Add ui test for unneeded_clippy_cfg_attr 2024-02-22 11:55:31 +01:00
Guillaume Gomez
f35d87f211 Add unneeded_clippy_cfg_attr lint 2024-02-22 11:52:58 +01:00
bors
422f9c5b65 Auto merge of #12317 - CBSpeir:issue_12291, r=y21
Add check for 'in_external_macro' and 'is_from_proc_macro' inside

changelog: Fix #12291 #[tracing::instrument()] triggers infinite_loop

Added an in_external_macro and is_from_proc_macro check to the [infinite_loop] lint
2024-02-21 22:53:46 +00:00
Christopher B. Speir
b72996e322 Add check for 'in_external_macro' and 'is_from_proc_macro' inside [infinite_loop] lint. 2024-02-21 16:34:07 -06:00
bors
250fd09405 Auto merge of #12324 - GuillaumeGomez:useless_allocation2, r=y21
Extend `unnecessary_to_owned` to handle `Borrow` trait in map types

Fixes https://github.com/rust-lang/rust-clippy/issues/8088.

Alternative to #12315.

r? `@y21`

changelog: Extend `unnecessary_to_owned` to handle `Borrow` trait in map types
2024-02-21 21:38:41 +00:00
Guillaume Gomez
635acb6804 Fix newly detected lint issues 2024-02-21 19:32:08 +01:00
Guillaume Gomez
d28146133c Add more ui tests for unnecessary_to_owned 2024-02-21 19:32:08 +01:00
bors
a056ff37c7 Auto merge of #12323 - not-elm:fix/issue-12279, r=y21
Fix: no_effect_underscore_binding fires on ignored parameters of async fns

Fixes #12279
changelog: Fix [`no_effect_underscore_binding`])

The warning is no longer displayed when an underscore is given in the parameter name of an asynchronous function.
2024-02-21 16:08:37 +00:00
Guillaume Gomez
9cde201ba1 Extend unnecessary_to_owned to handle Borrow trait in map types 2024-02-21 16:23:54 +01:00
taiga.watanabe
672bd5e387 DELETE: Known problems Section
The `Known problems` section was removed because it is old information.
2024-02-21 23:26:30 +09:00
taiga.watanabe
aa8a82ec26 FIX: issue-12279
----
UPDATE: add async block into test.

FIX: no_effect

Fixed asynchronous function parameter names with underscores so that warnings are not displayed when underscores are added to parameter names

ADD: test case
2024-02-21 23:26:29 +09:00
Seo Sanghyeon
cd45d5a81c Be careful with expressions with attributes 2024-02-20 22:18:49 +09:00
bors
31b551fee9 Auto merge of #120576 - nnethercote:merge-Diagnostic-DiagnosticBuilder, r=davidtwco
Overhaul `Diagnostic` and `DiagnosticBuilder`

Implements the first part of https://github.com/rust-lang/compiler-team/issues/722, which moves functionality and use away from `Diagnostic`, onto `DiagnosticBuilder`.

Likely follow-ups:
- Move things around, because this PR was written to minimize diff size, so some things end up in sub-optimal places. E.g. `DiagnosticBuilder` has impls in both `diagnostic.rs` and `diagnostic_builder.rs`.
- Rename `Diagnostic` as `DiagInner` and `DiagnosticBuilder` as `Diag`.

r? `@davidtwco`
2024-02-20 12:05:09 +00:00
bors
ba2139afd6 Auto merge of #121087 - oli-obk:eager_const_failures, r=lcnr
Always evaluate free constants and statics, even if previous errors occurred

work towards https://github.com/rust-lang/rust/issues/79738

We will need to evaluate static items before the `definitions.freeze()` below, as we will start creating new `DefId`s (for nested allocations) within the `eval_static_initializer` query.

But even without that motivation, this is a good change. Hard errors should always be reported and not silenced if other errors happened earlier.
2024-02-20 09:02:34 +00:00
Nicholas Nethercote
86cb711b96 Reduce capabilities of Diagnostic.
Currently many diagnostic modifier methods are available on both
`Diagnostic` and `DiagnosticBuilder`. This commit removes most of them
from `Diagnostic`. To minimize the diff size, it keeps them within
`diagnostic.rs` but changes the surrounding `impl Diagnostic` block to
`impl DiagnosticBuilder`. (I intend to move things around later, to give
a more sensible code layout.)

`Diagnostic` keeps a few methods that it still needs, like `sub`,
`arg`, and `replace_args`.

The `forward!` macro, which defined two additional methods per call
(e.g. `note` and `with_note`), is replaced by the `with_fn!` macro,
which defines one additional method per call (e.g. `with_note`). It's
now also only used when necessary -- not all modifier methods currently
need a `with_*` form. (New ones can be easily added as necessary.)

All this also requires changing `trait AddToDiagnostic` so its methods
take `DiagnosticBuilder` instead of `Diagnostic`, which leads to many
mechanical changes. `SubdiagnosticMessageOp` gains a type parameter `G`.

There are three subdiagnostics -- `DelayedAtWithoutNewline`,
`DelayedAtWithNewline`, and `InvalidFlushedDelayedDiagnosticLevel` --
that are created within the diagnostics machinery and appended to
external diagnostics. These are handled at the `Diagnostic` level, which
means it's now hard to construct them via `derive(Diagnostic)`, so
instead we construct them by hand. This has no effect on what they look
like when printed.

There are lots of new `allow` markers for `untranslatable_diagnostics`
and `diagnostics_outside_of_impl`. This is because
`#[rustc_lint_diagnostics]` annotations were present on the `Diagnostic`
modifier methods, but missing from the `DiagnosticBuilder` modifier
methods. They're now present.
2024-02-20 13:22:17 +11:00
Oli Scherer
d136b05c1b Always evaluate free constants and statics, even if previous errors occurred 2024-02-19 22:11:13 +00:00
Santiago Pastorino
16d5a2be3d Remove suspicious auto trait lint 2024-02-19 17:41:48 -03:00
bors
6aa5f1ac6f Auto merge of #12314 - Alexendoo:output-conflict-handling, r=flip1995
Default test output conflict handling to error

https://github.com/oli-obk/ui_test/pull/175 got rid of the `bool` that controlled the default handling so we need to specify it ourselves

r? `@flip1995`

changelog: none
2024-02-19 14:30:35 +00:00