| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Update the test `redundant_pattern_matching`: check if `is_some` and `is_none` are suggested within const contexts.
|
|
Stabilize some Result methods as const
Stabilize the following methods of Result as const:
- `is_ok`
- `is_err`
- `as_ref`
A test is also included, analogous to the test for `const_option`.
These methods are currently const under the unstable feature `const_result` (tracking issue: #67520).
I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](https://github.com/rust-lang/rust/pull/75463) and [PR#76135](https://github.com/rust-lang/rust/pull/76135).
Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature.
Related: #76225
|
|
Update the test `redundant_pattern_matching`: check if `is_ok` and `is_err` are suggested within const contexts.
Also removes the `redundant_pattern_matching_const_result` test, as it is no longer needed.
|
|
|
|
We no longer lint assignments to const item fields in the
`temporary_assignment` lint, since this is now covered by the
`CONST_ITEM_MUTATION` lint.
Additionally, we `#![allow(const_item_mutation)]` in the
`borrow_interior_mutable_const.rs` test. Clippy UI tests are run with
`-D warnings`, which seems to cause builtin lints to prevent Clippy
lints from running.
|
|
If a comma in a format call is replaced with a similar token, then we
emit an error and continue parsing, instead of stopping at this point.
|
|
|
|
|
|
This commit updates clippy with the introduction of `QPath::LangItem` so
that it still compiles.
Signed-off-by: David Wood <david@davidtw.co>
|
|
|
|
Clippy pointer cast lint experiment
This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.
This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).
r? @oli-obk
|
|
|
|
|
|
suggest anything
|
|
|
|
Check whether locals are too large instead of whether accesses into them are too large
Essentially this stops const prop from attempting to optimize
```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```
I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).
r? @wesleywiser
|
|
|
|
Co-authored-by: Philipp Krones <hello@philkrones.com>
|
|
|
|
transmutes_expressible_as_ptr_casts test
|
|
lint ordering changing
|
|
covering the same ground
|
|
still get an ICE
|
|
There are 5 errors, when there should be 7.
|
|
transmute module
|
|
|
|
The reason we do not trigger these lints anymore is that clippy sets the mir-opt-level to 0, and the recent changes subtly changed how the const propagator works.
|
|
|
|
|
|
Stabilize `transmute` in constants and statics but not const fn
cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)
Previous attempt: #64011
r? @RalfJung
cc @rust-lang/wg-const-eval
|
|
|
|
Other terms are more inclusive and precise.
|
|
|
|
|
|
|
|
None of the tools seem to need syn 0.15.35, so we can just build syn
1.0.
This was causing an issue with clippy's `compile-test` program: since
multiple versions of `syn` would exist in the build directory, we would
non-deterministically pick one based on filesystem iteration order. If
the pre-1.0 version of `syn` was picked, a strange build error would
occur (see
https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463)
To prevent this kind of issue from happening again, we now panic if we
find multiple versions of a crate in the build directly, instead of
silently picking the first version we find.
|
|
|
|
|
|
|
|
|
|
Stabilize fn-like proc macros in expression, pattern and statement positions
I.e. all the positions in which stable `macro_rules` macros are supported.
Depends on https://github.com/rust-lang/rust/pull/68716 ("Stabilize `Span::mixed_site`").
cc https://github.com/rust-lang/rust/issues/54727
cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446
Stabilization report: https://github.com/rust-lang/rust/pull/68717#issuecomment-623197503.
|
|
|
|
|
|
|
|
git-subtree-dir: src/tools/clippy
git-subtree-mainline: 06c44816c1532e5ff08ad072f581fc068eb60e2e
git-subtree-split: d2708873ef711ec8ab45df1e984ecf24a96cd369
|