Macro use sugg
changelog: Add auto applicable suggstion to macro_use_imports
fixes#5275
<s>Where exactly is the `wildcard_imports_helper` I haven't been able to import anything ex.
`use lazy_static;` or something like for that I get version/compiler conflicts?</s>
Found it.
Should we also check for `#[macro_use] extern crate`, although this is still depended on for stuff like `rustc_private`?
let_and_return: avoid "does not live long enough" errors
EDIT: Add #3324 to the list of fixes
<details>
<summary>Description of old impl</summary>
<br>
Avoid suggesting turning the RHS expression of the last statement into the block tail expression if a temporary borrows from a local that would be destroyed before.
This is my first incursion into MIR so there's probably room for improvement!
</details>
Avoid linting if the return type of some method or function called in the last statement has a lifetime parameter.
changelog: Fix false positive in [`let_and_return`]
Fixes#3792Fixes#3324
New lint: `unnested_or_patterns`
changelog: Adds a lint `unnested_or_patterns`, suggesting `Some(0 | 2)` as opposed to `Some(0) | Some(2)`. The lint only fires on compilers capable of using `#![feature(or_patterns)]`.
- The lint is primarily encoded as a pure algorithm which to unnest or-patterns in an `ast::Pat` (`fn unnest_or_patterns`) through a `MutVisitor`. After that is done, and assuming that any change was detected, then `pprust::pat_to_string` is used to simply convert the transformed pattern into a suggestion.
- The PR introduces a module `utils::ast_utils` with a bunch of functions for spanless & nodeless equality comparisons of ASTs.
cc https://github.com/rust-lang/rust/issues/54883
Make `PolyTraitRef::self_ty` return `Binder<Ty>`
This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.
Add doc for checking if type defines specific method
This PR adds documentation on how:
- check if a type defines a specific method
- check an expr is calling a specific method
closes: #3843
changelog: none
Cleanup: Use rustc's `same_type` for our `same_tys`
This delegates our `same_tys` to [ty::TyS::same_type][same_type] to
remove some duplication.
Our `same_tys` was introduced 4 years ago in #730. Before, it was
building an inference context to be able to call
`can_eq` to compare the types. The `rustc-dev-guide` has some more details
about `can_eq` in [Type Inference -> Trying equality][try_eq].
Now, using the rustc function, we are essentially comparing the `DefId`s
of the given types, which also makes more sense, IMO.
I also confirmed that the FIXME is resolved via a bit of `dbg!`, however
no UI tests seem to have been affected.
[same_type]: 659951c4a0/src/librustc_middle/ty/util.rs (L777)
[try_eq]: https://rustc-dev-guide.rust-lang.org/type-inference.html#trying-equality
---
changelog: none
Fix cargo tests when running inside the rustlang/rust repo
It seems we hit https://github.com/rust-lang/cargo/issues/5418, so I've applied the suggested solution. Also added some more info when cargo-metadata fails to execute.
(there was no open issue for this)
changelog: none
Replace all remaining occurrences of submodule with subtree
r? @phansch
I should have included this in #5686, but forgot about it, so here we go again.
changelog: none