Commit Graph

13880 Commits

Author SHA1 Message Date
Laurențiu Nicola
32b6f103a6 Bump chalk 2021-12-19 18:58:39 +02:00
ucrhh
b289f13c75 fix unwrap_block by removing double trimming 2021-12-18 23:19:53 +01:00
bors[bot]
81d0096000
Merge #11035
11035: Include clippy lint groups in autocomplete r=Veykril a=k-nasa

## Why

close: https://github.com/rust-analyzer/rust-analyzer/issues/11027

## Proof

I confirmed that complement candidates are coming out.

https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov


Co-authored-by: k-nasa <htilcs1115@gmail.com>
2021-12-18 17:59:29 +00:00
rainy-me
67cc6c1e16 feat: treat fn keyword inside function pointer type as primitive 2021-12-19 01:51:51 +09:00
Aleksey Kladov
92dad471bc
Update crates/parser/src/lexed_str.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-12-18 17:34:55 +03:00
Aleksey Kladov
a022ad68c9 internal: move all the lexing to the parser crate 2021-12-18 17:20:38 +03:00
k-nasa
71ac246bd4 refactor: chain iter 2021-12-18 23:19:29 +09:00
Aleksey Kladov
78926027e3 converting lexed str to tokens 2021-12-18 15:36:21 +03:00
Aleksey Kladov
8b9d145dea soa all the things 2021-12-18 15:31:50 +03:00
Aleksey Kladov
799941e05e move tests 2021-12-18 14:55:20 +03:00
Aleksey Kladov
7e99864dbf move lexing to the parser crate 2021-12-18 14:55:20 +03:00
Aleksey Kladov
958f20ff84 minor: dead code 2021-12-18 14:55:20 +03:00
bors[bot]
7f28b49759
Merge #11043
11043: fix: fix incorrect mismatched argument count diagnostic with `std::arch` functions r=jonas-schievink a=jonas-schievink

Adds basic support for `#[rustc_legacy_const_generics]`.

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

Full support would involve actually checking call arguments against the right expected types.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-12-17 17:46:42 +00:00
Jonas Schievink
fcc76e93a0 Initial support for #[rustc_legacy_const_generics] 2021-12-17 18:45:56 +01:00
bors[bot]
6674756c07
Merge #11041
11041: minor: Fix some clippy lints r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-17 15:52:53 +00:00
Laurențiu Nicola
6c799dac1e Fix some clippy lints 2021-12-17 17:46:20 +02:00
bors[bot]
04b0b19cdb
Merge #10527
10527: internal: Remove a few snippet completions, replace them with user snippets definitions in VSCode r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/9636
cc https://github.com/rust-analyzer/rust-analyzer/issues/7033#issuecomment-939959905

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-17 15:44:48 +00:00
Lukas Wirth
2a88b76041 Update tests 2021-12-17 16:39:21 +01:00
Laurențiu Nicola
8ad7c0439c Remove needless clones 2021-12-17 17:35:10 +02:00
Laurențiu Nicola
fb9529626d Spelling nits 2021-12-17 17:26:35 +02:00
Lukas Wirth
9fe0f0d1d9 Add a few default snippets for VSCode 2021-12-17 16:24:29 +01:00
Lukas Wirth
d3e538638a fix: Don't duplicate attribute completions 2021-12-17 15:22:53 +01:00
k-nasa
0e9095e42c manual run sourcegen_lint_completions 2021-12-17 08:46:17 +09:00
k-nasa
7643e08962 Add clippy lint group to attribute auto compleme 2021-12-17 08:34:08 +09:00
k-nasa
4e6e65dd71 List struct to clonable 2021-12-17 08:33:46 +09:00
Wang Ruochen
ee079561b1
Add comma for "move if to guard" 2021-12-15 15:26:24 -08:00
bors[bot]
4ec6bd6206
Merge #11017
11017: Support "move if to guard" with an else branch r=Veykril a=weirane

Support the assist `move_arm_cond_to_match_guard` when there is an else branch.

I have two questions:
1. How to indent the first line of a match arm? `matcharm.indent()` doesn't seem to work. so I hard coded four spaces here:
95a0de85d5/crates/ide_assists/src/handlers/move_guard.rs (L162-L163)

2. I find a little issue in the original implementation, this code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the `false`. Should I also fix that? Or this can go in a separate PR.

Closes #10997.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2021-12-15 23:04:51 +00:00
Wang Ruochen
e8d0742997
Add coverage marks 2021-12-15 14:44:47 -08:00
Wang Ruochen
95a0de85d5
Support "move if to guard" with an else branch 2021-12-14 10:27:44 -08:00
bors[bot]
9efa355a62
Merge #11011
11011: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-14 11:56:30 +00:00
Lukas Wirth
901c7c7277 match_ast! takes a pattern to allow underscore usage 2021-12-14 12:44:31 +01:00
Lukas Wirth
9915103c9e Simplify 2021-12-14 12:38:20 +01:00
Lukas Wirth
04a7fbbddb Move out doc-links tests into a separate module 2021-12-14 12:10:43 +01:00
zhoufan
c3ad945d9b fixes broken tests 2021-12-14 15:57:58 +08:00
zhoufan
7b952cb1aa infer associated method in local scope 2021-12-14 15:34:57 +08:00
bors[bot]
791722b70a
Merge #10998
10998: Add number representation assists r=Veykril a=errx

Reimplemented assists from this PR https://github.com/rust-analyzer/rust-analyzer/pull/3683 with current APIs.
![image](https://user-images.githubusercontent.com/462486/145726792-47700215-26f2-4fdc-9520-63d1487901e5.png)
![image](https://user-images.githubusercontent.com/462486/145726802-f528a2f7-9159-41d3-b459-fc3fae033e60.png)


I've decided not to add options about size of the groups so behaviour is similar to clippy's. 
Minimal number length is also taken from clippy.


Co-authored-by: Oleg Matrokhin <matrokhin@gmail.com>
2021-12-13 18:49:06 +00:00
Oleg Matrokhin
60605a24d4 Reuse results from split_into_parts() 2021-12-13 21:16:04 +03:00
Oleg Matrokhin
8b03b41b7a Add number representation assists 2021-12-13 19:35:38 +03:00
bors[bot]
69500e8c6b
Merge #11002
11002: fix: Add support for v6 macro metadata format r=lnicola a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/issues/10894#issuecomment-991993824

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-13 16:17:14 +00:00
Laurențiu Nicola
e6af1ca718 Add support for v6 macro metadata format 2021-12-13 18:15:22 +02:00
bors[bot]
e1f3982a5f
Merge #11001
11001: minor: fixup generate assist priorities r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10996
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-13 15:51:54 +00:00
bors[bot]
3f550d2e38
Merge #11000
11000: fix: insert whitespaces into assoc items for assist when macro generated r=Veykril a=Veykril

This is obviously only a temporary hack which still produces ugly looking items, but as long as the syntax is valid one can at least have rustfmt fix the formatting again. 
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6588
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-13 15:43:12 +00:00
Lukas Wirth
1cef532c4d minor: fixup generate assist priorities 2021-12-13 16:42:21 +01:00
Lukas Wirth
749eeef3e7 fix: insert whitespaces into assoc items for assist when macro generated 2021-12-13 16:35:32 +01:00
Lukas Wirth
328419534d Move ws insert rendering for macro expansion into ide_db 2021-12-13 15:55:13 +01:00
Aleksey Kladov
3b5b988526 prettyfy 2021-12-12 19:36:14 +03:00
Aleksey Kladov
980dd56cdc consistency 2021-12-12 19:32:04 +03:00
Aleksey Kladov
6e4bb57014 simplify 2021-12-12 19:31:32 +03:00
Aleksey Kladov
57e6ef0bfb tighten up invariants 2021-12-12 19:22:37 +03:00
Aleksey Kladov
18d4737fb9 add cross-crate inlines 2021-12-12 19:17:04 +03:00