Fix rustc breaking change: convert to Place's new boxed slice projection
Addressed breaking changes from rust-lang PR https://github.com/rust-lang/rust/pull/63420/
I'm not entirely sure the semantics are preserved as I don't have much knowledge about MIR yet. So this code was largely reverse-engineered from the PR above. I wouldn't be surprised if I did something wrong :).
I followed the instructions to pull latest rustc from master and verified the build break I was seeing in my PR for cast-lossless in Travis CI. With these changes, it compiles again and all tests pass.
Fixes https://github.com/rust-lang/rust/issues/64440
changelog: none
Fix incorrect swap suggestion
Clippy suggests using swap on fields belonging to the same owner causing two mutable borrows of the owner.
Disclosure: This is my first time working with clippy and rusts HIR. I'm very grateful for assistance and suggestions to improve the PR.
fixes#981
changelog: Fix false positive in `manual_swap` lint
New `is_integer_const` to check more const ints
This mostly affects loop checks and the modulo_one lint. Tests were also updated where applicable.
changelog: none
Changed more `Vec` paths to diagnostic_items
In #4519, I missed a few instances of path matching for `Vec`, so here they are.
r? @oli-obk
changelog: none
Allow block_in_if_{stmt,expr} in external macro
I found this by running `cargo fix --clippy` on quite a big codebase.
You could refactor this assert to
```rust
let block_expr = _;
assert!(block_expr);
```
but,
1. it doesn't increase the readability IMO
2. That isn't possible in a `debug_assert!`
I'm not sure though, if we should allow this for macros in general or just for external macros.
changelog: Allow `block_in_if_{stmt,expr}` in external macros
Stop using the HIR CFG
This does slightly change the behavior:
* Functions with unreachable code don't end up being ignored
* `match` guards are counted as +1 for each guard, rather than +1 for each pattern with a guard
* Or patterns don't add to the complexity
changelog: none
Simplify `utils::match_def_path`, removing a FIXME
changelog: none
This removes the `Vec<Symbol>` allocation. We still need to call `cx.get_def_path`, but this should already have been interned, and I don't see how we can keep ergonomics of that function without allocating a `Vec`.
r? @phansch
Fix two occurences of TESTNAME=ui/foo_functions
changelog: Fix two occurrences of the wrong path to the foo_functions test in doc/adding_lints.md
This PR fixes the other two wrong paths to the example test. I already created a PR yesterday but only changed one. The old command was `TESTNAME=ui/foo_functions cargo uitest` and is now `TESTNAME=foo_functions cargo uitest`.
Remove ui/ from TESTNAME for foo lint example
changelog: Remove ui/ from TESTNAME in doc/adding-lints.md
This PR remove the `ui/` from the TESTNAME of the example foo lint in the 'Adding lints' documentation.