Commit graph

14360 commits

Author SHA1 Message Date
Jacob Pratt
22566ecd1b
Short-circuit boolean operation 2021-01-10 03:05:52 -05:00
Jacob Pratt
bd8a903548
Remove unnecessary allocation
The case-insensitive prefix/suffix check can be performed
character-by-character. This allows the check to be done without having
to allocate a new string. As a side effect, it's also no longer
necessary to convert the entire string to lowercase, as it's done as
needed. As the only case equality we're handling is ASCII, this
operation can be further optimized by using byte equality, rather than
character equality.
2021-01-09 21:36:38 -05:00
bors[bot]
bcb9ae18de
Merge #7223
7223: Refactor highlighting r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-09 20:08:41 +00:00
Aleksey Kladov
eeceff3179 Refactor highlighting 2021-01-09 23:07:32 +03:00
bors[bot]
927657432e
Merge #7217
7217: Simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-09 14:32:27 +00:00
Aleksey Kladov
92dac67d0c Simplify 2021-01-09 17:31:22 +03:00
bors[bot]
939ca83b34
Merge #7216
7216: Highlighting improvements r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-09 13:09:15 +00:00
Aleksey Kladov
4a8d2c098d Better highlight for fixtures 2021-01-09 16:07:41 +03:00
Aleksey Kladov
62b17bac92 Simplify 2021-01-09 15:54:38 +03:00
Aleksey Kladov
d4fb7476ef Better names 2021-01-09 15:38:32 +03:00
Aleksey Kladov
8a0bd50036 Reduce duplication 2021-01-09 15:12:21 +03:00
Aleksey Kladov
3dfa2768ac Shorten names 2021-01-09 14:48:15 +03:00
Aleksey Kladov
c6150a3706 Reorder modules 2021-01-09 14:45:47 +03:00
Aleksey Kladov
64a6ee4535 Shorten frequent names 2021-01-09 14:44:01 +03:00
Aleksey Kladov
6fb52af521 Rename dummy -> none 2021-01-09 14:41:31 +03:00
bors[bot]
625ec9e1ae
Merge #7215
7215: Hide argument name hint regardless of case r=SomeoneToIgnore a=jhpratt



Co-authored-by: Jacob Pratt <jacob@jhpratt.dev>
2021-01-09 09:16:29 +00:00
Jacob Pratt
38dd9aa284
Hide argument name hint regardless of case 2021-01-09 04:05:59 -05:00
bors[bot]
5fe8cb1fba
Merge #7213
7213: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-08 23:20:54 +00:00
Lukas Wirth
5889bb27d6 Simplify 2021-01-09 00:17:34 +01:00
bors[bot]
056cabf25d
Merge #7212
7212: Simplify highlighting r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-08 20:48:30 +00:00
Aleksey Kladov
e30c1c3fbf Simplify highlighting infra
This also fixes the killer whale bug
2021-01-08 23:47:35 +03:00
bors[bot]
903d1f89a5
Merge #7210
7210: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-08 14:38:21 +00:00
kjeremy
0a91f29699 cargo update 2021-01-08 09:37:28 -05:00
bors[bot]
be02ac981d
Merge #7205
7205: Fix bug for $crate in LHS of mbe r=edwin0cheng a=edwin0cheng

We treated `$crate` as meta variable in LHS of mbe, which should be an `ident`. 

Fixes #7204

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-08 06:03:54 +00:00
Edwin Cheng
bced02c5dc Add test 2021-01-08 14:00:23 +08:00
Edwin Cheng
74a24adc8e Fix bug when $crate in LHS in mbe 2021-01-08 14:00:16 +08:00
bors[bot]
1a29934c37
Merge #7145
7145: Proper handling $crate Take 2 [DO NOT MERGE] r=edwin0cheng a=edwin0cheng

Similar to previous PR (#7133) , but improved the following things :

1. Instead of storing the whole `ExpansionInfo`, we store a similar but stripped version `HygieneInfo`.
2. Instread of storing the `SyntaxNode` (because every token we are interested are IDENT), we store the `TextRange` only.
3. Because of 2, we now can put it in Salsa.
4. And most important improvement: Instead of computing the whole frames every single time, we compute it recursively through salsa: (Such that in the best scenario, we only need to compute the first layer of frame)

```rust
        let def_site = db.hygiene_frame(info.def.file_id);
        let call_site = db.hygiene_frame(info.arg.file_id);

        HygieneFrame { expansion: Some(info), local_inner, krate, call_site, def_site }
```

The overall speed compared to previous PR is much faster (65s vs 45s) :
```
[WITH old PR]
Database loaded 644.86ms, 284mi
Crates in this dir: 36
Total modules found: 576
Total declarations: 11153
Total functions: 8715
Item Collection: 15.78s, 91562mi
Total expressions: 240721
Expressions of unknown type: 2635 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 865
Inference: 49.84s, 250747mi
Total: 65.62s, 342310mi
rust-analyzer -q analysis-stats .  66.72s user 0.57s system 99% cpu 1:07.40 total

[WITH this PR]
Database loaded 665.83ms, 284mi
Crates in this dir: 36
Total modules found: 577
Total declarations: 11188
Total functions: 8743
Item Collection: 15.28s, 84919mi
Total expressions: 241229
Expressions of unknown type: 2637 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 868
Inference: 30.15s, 135293mi
Total: 45.43s, 220213mi   
rust-analyzer -q analysis-stats .  46.26s user 0.74s system 99% cpu 47.294 total
```

*HOWEVER*,  it is still a perf regression (35s vs 45s):
```
[WITHOUT this PR]
Database loaded 657.42ms, 284mi
Crates in this dir: 36
Total modules found: 577
Total declarations: 11177
Total functions: 8735
Item Collection: 12.87s, 72407mi
Total expressions: 239380
Expressions of unknown type: 2643 (1%)
Expressions of partially unknown type: 2064 (0%)
Type mismatches: 868
Inference: 22.88s, 97889mi
Total: 35.74s, 170297mi
rust-analyzer -q analysis-stats .  36.71s user 0.63s system 99% cpu 37.498 total
```



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-08 03:57:11 +00:00
bors[bot]
a3e5dcc177
Merge #7201
7201: Simplify some matches in completions modules r=matklad a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-07 23:12:26 +00:00
Lukas Wirth
6dca2cbba5 Simplify mod completion 2021-01-07 23:33:52 +01:00
Lukas Wirth
ca6db58762 Tidy up attribute completion match 2021-01-07 22:48:54 +01:00
bors[bot]
5722d2b7b8
Merge #7097
7097: Add fix to wrap return expression in Some r=matklad a=theotherphil

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7095

Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
2021-01-07 19:53:05 +00:00
Phil Ellison
7066bff9c3 Switch test marker 2021-01-07 19:01:33 +00:00
Phil Ellison
554ee6ea02 cargo fmt 2021-01-07 19:01:33 +00:00
Phil Ellison
b2dbe6e43a Add fix to wrap return expression in Some 2021-01-07 19:01:33 +00:00
bors[bot]
981a0d708e
Merge #7199
7199: typo r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-07 18:16:43 +00:00
bors[bot]
4ddf075673
Merge #7193
7193: Show progress for fetching workspace (cargo-metadata and loadOutDirsFromCheck) r=matklad a=edwin0cheng


![Peek 2021-01-07 21-57](https://user-images.githubusercontent.com/11014119/103902132-0db4c780-5135-11eb-94d3-32429445be87.gif)


Fixes #7188 
Fixes #3300

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-07 18:07:01 +00:00
bors[bot]
c29d353623
Merge #7191
7191: Adjust vfs crate documentation r=matklad a=arnaudgolfouse

This removes an outdated comment, and uses intra-doc links

Co-authored-by: Arnaud <arnaud.golfouse@free.fr>
2021-01-07 17:57:48 +00:00
Aleksey Kladov
8f994dda68 typo 2021-01-07 20:27:22 +03:00
Edwin Cheng
2b2d699b35 Report progress for cargo metadata and output-dir 2021-01-08 01:18:58 +08:00
bors[bot]
2d2613b481
Merge #7198
7198: Styleguide readability r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-07 17:12:54 +00:00
Aleksey Kladov
5aed769afe Styleguide readability 2021-01-07 20:11:55 +03:00
Edwin Cheng
54eb87de03 Refactor out JodChild 2021-01-08 01:08:34 +08:00
bors[bot]
dce5f0c585
Merge #7197
7197: Document `std::ops` style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-07 16:28:43 +00:00
Aleksey Kladov
eb710a63ca Document std::ops style 2021-01-07 19:27:47 +03:00
bors[bot]
344704a054
Merge #7196
7196: Better fixture highlight r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-07 16:11:54 +00:00
Aleksey Kladov
f459375f48 Better fixture highlight 2021-01-07 19:11:27 +03:00
bors[bot]
b821264f86
Merge #7195
7195: Update remaining serverPath references r=lnicola a=lnicola

Fixes https://github.com/rust-analyzer/rust-analyzer/pull/7156#issuecomment-755487667

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-07 15:30:23 +00:00
Laurențiu Nicola
56497ce925 Update remaining serverPath references 2021-01-07 17:06:11 +02:00
bors[bot]
aa9bef0797
Merge #7194
7194: Don't update the server if managed by the user r=matklad a=lnicola

Fixes #7187

CC @figsoda

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-07 14:39:50 +00:00
Laurențiu Nicola
c547ec1cd6 Don't update the server if managed by the user 2021-01-07 16:37:08 +02:00