Commit Graph

52 Commits

Author SHA1 Message Date
hkalbasi
7ba93cb8cf Always reborrow reference receiver in methods 2023-04-07 00:32:28 +03:30
Lukas Wirth
798990bf33 fix: Add missing autoborrow adjustment for index expressions 2023-03-29 16:11:48 +02:00
hkalbasi
eb4939e217 Support overloaded deref MIR lowering 2023-03-17 14:02:55 +03:30
Lukas Wirth
2c364f6e5a Fix tests 2023-03-14 19:55:20 +01:00
Lukas Wirth
228b44cb18 fix: Only skip adjustment hints for block, if and match expressions for reborrows 2023-03-13 16:10:49 +01:00
Lukas Wirth
0ce06088f8 Fix inlay-hint tests 2023-03-06 22:39:42 +01:00
Lukas Wirth
ec273c3d12 Split pattern inference into more functions 2023-03-03 10:42:46 +01:00
hkalbasi
cd67589f63 beginning of MIR 2023-02-27 23:45:54 +03:30
Lukas Wirth
5859190066 Adjust binding mode inlay hints to render better with @ patterns 2023-02-15 14:47:02 +01:00
Lukas Wirth
5fdf640fb3 fix: Fix bind pat inlay hints rendering for constant patterns 2023-02-11 16:29:54 +01:00
Lukas Wirth
557aa1e378 Render discriminant inlay hints for mixed variants if at least one discriminant is specified 2023-02-10 09:57:03 +01:00
bors
b7836e44d3 Auto merge of #14099 - Veykril:inlay-hint-loc, r=Veykril
Properly use location links for type hints of impl Future and its assoc type
2023-02-08 08:43:10 +00:00
Lukas Wirth
2b4a5374ee Properly use location links for type hints of impl Future and its assoc type 2023-02-07 22:42:03 +01:00
Lukas Wirth
c6305c5659 fix: Don't panic on broken syntax trees in adjustment inlay hints 2023-02-06 12:38:57 +01:00
bors
7acc434f46 Auto merge of #14071 - Veykril:inlay-hints, r=Veykril
fix: Don't render fieldless discriminant inlay hints for datacarrying enums
2023-02-01 10:39:15 +00:00
Lukas Wirth
14f19c73e9 fix: Don't render fieldless discriminant inlay hints for datacarrying enums 2023-02-01 11:38:39 +01:00
Lukas Wirth
4ff6f3845f Update ide test outputs 2023-01-27 11:40:44 +01:00
Lukas Wirth
3a95864df5 Unconditionally enable location links in inlay hints again 2023-01-16 16:04:38 +01:00
Maybe Waffle
81d7e302ed Add basic tooltips to adjustment hints 2023-01-16 12:44:39 +00:00
Lukas Wirth
27ba598dfe Make inlay hint location links work for more types 2023-01-14 13:30:56 +01:00
Lukas Wirth
f2444b2a40 Remove unnecessary Hint suffix on InlayKind variants 2023-01-14 13:08:45 +01:00
Lukas Wirth
60075a6625 Remove hover inlay tooltips, replace them with location links 2023-01-14 12:19:29 +01:00
Lukas Wirth
aafb0f1f8d Use smallvec for inlay-hint parts 2023-01-13 15:03:37 +01:00
Maybe Waffle
b6169c2a2e Add a fixme to remove hacks 2023-01-09 13:37:37 +00:00
Maybe Waffle
a9676cfbe3 Add a "bug" test for adjustment hints to check for status quo 2023-01-09 13:35:21 +00:00
Maybe Waffle
12b7f9f7bf Add an option to minimize parentheses for adjustment hints 2023-01-09 13:35:17 +00:00
Maybe Waffle
b89c4f0a05 Implement postfix adjustment hints
I'd say "First stab at implementing..." but I've been working on this
for a month already lol
2023-01-09 13:27:59 +00:00
bors
f77b68a3cb Auto merge of #13860 - danieleades:clippy, r=lnicola
fix a bunch of clippy lints

fixes a bunch of clippy lints for fun and profit

i'm aware of this repo's position on clippy. The changes are split into separate commits so they can be reviewed separately
2023-01-08 17:29:57 +00:00
Lukas Wirth
b996a54cd8 Skip lifetime elision on fn pointers and fn trait types 2023-01-03 11:58:31 +01:00
Lukas Wirth
506895fa2f Fix spelling mistake 2023-01-02 23:16:26 +01:00
Daniel Eades
cc80c5bd07 remove unnecessary lazy evaluations 2023-01-02 15:02:54 +00:00
Daniel Eades
ed128872eb remove needless borrows 2023-01-02 14:52:32 +00:00
bors
17cc78f169 Auto merge of #13832 - Veykril:discriminant-hints, r=Veykril
Enum variant discriminants hints

![image](https://user-images.githubusercontent.com/3757771/209320042-eced617a-9a47-4808-ac23-916f469dc90c.png)
2023-01-02 13:20:33 +00:00
Yuri Astrakhan
e16c76e3c3 Inline all format arguments where possible
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change
of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Lukas Wirth
df8fc78ece Enum variant discriminants hints 2022-12-23 11:37:42 +01:00
Yuri Astrakhan
e341e996f7 Clippy-fix explicit auto-deref
Seems like these can be safely fixed. With one, I was particularly
surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```
2022-12-23 02:52:14 -05:00
Yuri Astrakhan
1d59c7b667 Remove non-needed clones
I am not certain if this will improve performance,
but it seems having a .clone() without any need should be removed.

This was done with clippy, and manually reviewed:

```
cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone
```
2022-12-23 02:20:03 -05:00
bors
a06525517b Auto merge of #13820 - Veykril:or-pat-bm-fix, r=Veykril
Fix binding mode hints always adding parentheses to or-patterns
2022-12-22 23:02:19 +00:00
Maybe Waffle
ef4c8167e8 Pass FamousDefs around in inlay hints 2022-12-22 11:00:25 +00:00
bors
eb3963b22e Auto merge of #13817 - WaffleLapkin:hide_adjustment_hints_outside_of_unsafe, r=Veykril
feat: Add an option to hide adjustment hints outside of `unsafe` blocks and functions

As the title suggests: this PR adds an option (namely `rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe`) that allows to hide adjustment hints outside of `unsafe` blocks and functions:

![2022-12-21_23-11](https://user-images.githubusercontent.com/38225716/208986376-d607de62-8290-4e16-b7fe-15b762dc5f60.png)

Requested by `@BoxyUwU` <3
2022-12-22 09:37:00 +00:00
Lukas Wirth
b9341e2fe6 Fix binding mode hints always adding parentheses to or-patterns 2022-12-22 10:35:35 +01:00
Waffle Maybe
1038db5f1d Apply suggestions from code review
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-12-21 23:00:12 +00:00
bors
271f7b44d3 Auto merge of #13699 - HKalbasi:inlaylink, r=Veykril
Implement location link for type inlay hints

fix #11701

This actually doesn't work due a problem in vscode: https://github.com/microsoft/vscode/issues/167564
2022-12-21 21:43:38 +00:00
Maybe Waffle
608dc492ea Move is_inside_unsafe to Semantics impl 2022-12-21 20:36:05 +00:00
Maybe Waffle
3bfe7040e8 Add an option to hide adjustment hints outside of unsafe blocks 2022-12-21 19:20:42 +00:00
hkalbasi
e1aa73ef40 Disable inlay hint location links on vscode < 1.76 2022-12-21 18:54:49 +03:30
hkalbasi
801a2231bf Implement location link for type inlay hints 2022-12-21 02:18:02 +03:30
Maybe Waffle
874ff2bc9d Skip adjustment hints if the adjustment doesn't adjust 2022-12-20 20:04:10 +00:00
Maybe Waffle
91a89efcf2 Save source & target types in hir's expr_adjustments 2022-12-20 19:33:27 +00:00
Maybe Waffle
046a5679e3 Add docs to make tidy tests happy :') 2022-12-20 13:30:53 +00:00