11178: Fix replace_match_with_if_let removing unsafe blocks r=bugadani a=bugadani
If the assist encounters an unsafe block in one of the match arms, the assist generated intermediate code like the following:
```rust
if let Foo(_) = foo {
<then branch>
} else unsafe { ... }
```
Which was then parsed back and the unsafe branch got completely removed, removing in invalid code output:
```rust
if let Foo(_) = foo {
<then branch>
} else
```
This PR fixes this issue.
However, I'm sure there is a better, more general solution here, but I lack familiarity with rust-analyzer. `make::expr_if` looks like it expects a `BlockExpr` that, when printed, is wrapped in braces correctly, but I'm sure changing the display impl for an `unsafe` `BlockExpr` would have caused problems. I could have changed `make::expr_if` instead to special case unsafe blocks, but that would have meant some expressions getting wrapped by the caller (as previously), and some others by the function.
Co-authored-by: Dániel Buga <bugadani@gmail.com>
11088: closes#10446 hide type inlay hints r=Veykril a=Heinenen
Passes tests as described in #10446
Works for all happy cases, there may be some cases that I forgot as I am not that familiar with Rust and r-a (yet).
Co-authored-by: Heinenen <th.m.heinen@gmail.com>
11173: Allow adding partially resolved types r=Veykril a=SomeoneToIgnore
Sometimes when writing something like `let foo = Arc::new(Mutex::new(CrazyGenerics::new(HashMap::new())))`, I want/have to specify an explicit type for the expression.
Using turbofish isn't very readable and not always appreciated by guidelines, so `let foo: T` has to be filled.
To ease that, the PR enables the `add_explicit_type` assist on types that contain unknown types and some generics.
Fully unresolved types, arrays with unknown types and other known cases behave the same.
`_` placeholder was chosen to replace an unknown type:
```rust
let foo = HashMap::new();
// after assist usage, turns into
let foo: HashMap<_, _> = HashMap::new();
```
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
11169: internal: Handle macro calls better in highlighting r=Veykril a=Veykril
Introduces a new semantic highlighting tag for the `!` character of macro calls.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10962
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>