Commit Graph

10018 Commits

Author SHA1 Message Date
Edwin Cheng
cff2201c30 NFA parser for mbe matcher 2021-03-01 00:11:14 +08:00
bors[bot]
7f57a01b3d
Merge #7808
7808: Fix assert split exprs on comma r=edwin0cheng a=edwin0cheng

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-02-28 12:53:21 +00:00
Edwin Cheng
30402beeb2 Fix assert split exprs on comma 2021-02-28 20:46:24 +08:00
Vincent Esche
c4e2f32d73 Fixed remaining references to AnalysisChange (now: Change)
(The type was renamed/moved in 8716c4cec3)
2021-02-28 12:57:41 +01:00
Aleksey Kladov
05729fd3c4 For unresolved macros, hightlight only the last segment 2021-02-28 14:29:10 +03:00
Edwin Cheng
bf8bc5c882 Fix non-latin characters doc comment for mbe 2021-02-28 13:49:08 +08:00
bors[bot]
e0437f899c
Merge #7802
7802: Fix builtin macros split exprs on comma r=edwin0cheng a=edwin0cheng

Fixes #7640

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-02-28 05:07:09 +00:00
Edwin Cheng
f5bf1a9650 Fix builtin macros split exprs on comma 2021-02-28 13:06:17 +08:00
Jonas Schievink
6990b89b26 Restrict visibilities to the containing DefMap 2021-02-28 04:47:38 +01:00
bors[bot]
f682627da4
Merge #7797
7797: Format generated lints and features manually r=matklad a=lnicola

As `quote` and `rustfmt` leave them on a single line, which makes running `grep` in the repository quite annoying.

Also removes a dead `gen_features.rs` file (`gen_lint_completions.rs` does the same thing).

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-02-27 14:56:24 +00:00
bors[bot]
a8cf346b97
Merge #7566
7566: Add benchmark tests for mbe r=matklad a=edwin0cheng

This PR add more real world tests dumped from `rust-analyzer analysis-stats .` to benchmark its performance.

cc #7513

r? @matklad 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-02-27 14:39:22 +00:00
Laurențiu Nicola
0fb01367f5 Format generated features manually instead of relying on rustfmt 2021-02-27 16:25:06 +02:00
Domantas Jadenkus
558bcf4e0b generate try_into instead of into 2021-02-27 12:21:57 +02:00
Domantas Jadenkus
d4b6cbe5b6 rename generate_enum_match_method file to match assist name 2021-02-27 12:21:56 +02:00
Domantas Jadenkus
f098a2b31b move into_ and as_ generation to a separate file 2021-02-27 12:21:06 +02:00
Domantas Jadenkus
6f25fef36a cargo fmt 2021-02-27 12:06:00 +02:00
Domantas Jadenkus
e0f08fcc20 add generate_enum_as_method assist 2021-02-27 12:06:00 +02:00
Domantas Jadenkus
642786986f deduplicate some 2021-02-27 12:05:59 +02:00
Domantas Jadenkus
2dcd5d7a7c add generate_enum_into_method assist 2021-02-27 12:05:59 +02:00
Domantas Jadenkus
4ab285a8e5 make generate_enum_is_method work on any variants 2021-02-27 12:05:59 +02:00
Domantas Jadenkus
f67586066d rename existing assist to generate_enum_is_method 2021-02-27 12:05:59 +02:00
Denys Zadorozhnyi
eb3c23588d
Disable "Flip comma" assist inside a macro call 2021-02-26 19:12:53 +02:00
Sanchith Hegde
3eaec3cd33
docs(ide_assists): Change importMergeBehaviour to importMergeBehavior 2021-02-26 12:54:50 +05:30
kjeremy
d42730b76e bump crates 2021-02-25 10:34:48 -05:00
Edwin Cheng
23dbf36c7d Add benchmark test for mbe 2021-02-25 05:47:13 +08:00
bors[bot]
dc14c432f5
Merge #7741
7741: Add convert_for_to_iter_for_each assist r=mattyhall a=mattyhall

Implements one direction of #7681 

I wonder if this tries to guess too much at the right thing here. A common pattern is:

```rust
let col = vec![1, 2, 3];
for v in &mut col {
  *v *= 2;
}
// equivalent to:
col.iter_mut().for_each(|v| *v *= 2);
```

I've tried to detect this case by checking if the expression after the `in` is a (mutable) reference and if not inserting iter()/iter_mut(). This is just a convention used in the stdlib however, so could sometimes be wrong. I'd be happy to make an improvement for this, but not sure what would be best. A few options spring to mind:
1. Only allow this for types that are known to have iter/iter_mut (ie stdlib types)
2. Try to check if iter/iter_mut exists and they return the right iterator type
3. Don't try to do this and just add `.into_iter()` to whatever is after `in`

Co-authored-by: Matt Hall <matthew@quickbeam.me.uk>
2021-02-24 19:24:22 +00:00
Matt Hall
a28e862825 Address further review comments
* Use known names for iter/iter_mut method (simplifies checking if the
  method exists
* Extract code to check assist with fixtures to function
2021-02-24 19:23:12 +00:00
Lukas Wirth
694f7a7e9f Add tests for apply_demorgan 2021-02-24 11:58:37 +01:00
lbrande
9db970ee08 De Morgan's Law assist now correctly inverts <, <=, >, >=. 2021-02-24 11:58:37 +01:00
lbrande
f7a4a87de2 De Morgan's Law assist now correctly parenthesizes binary expressions. 2021-02-24 11:58:37 +01:00
Lukas Wirth
9e8f4d31a4 Pickup ConstReference patterns in FindUsages 2021-02-23 23:31:53 +01:00
Matt Hall
98a626450d Address review comments
* Move code to build replacement into closure
* Look for iter/iter_mut methods on types behind reference
2021-02-23 19:19:48 +00:00
Matt Hall
506293ca43 Add convert_for_to_iter_for_each assist 2021-02-23 18:10:01 +00:00
Jonas Schievink
338823f73a is_visible_from_def_map: handle block expressions 2021-02-23 17:56:16 +01:00
Jonas Schievink
cf456d72db Add test 2021-02-23 14:54:01 +01:00
Chetan Khilosiya
eb6cfa7f15 7526: Renamed create ssr to ide_ssr. 2021-02-23 00:59:16 +05:30
Chetan Khilosiya
e4756cb4f6 7526: Rename crate assists to ide_assists. 2021-02-23 00:59:16 +05:30
Jonas Bushart
bd525c9d20 Add isize to the list of suffixed integers in typed_integer
The missing `isize` in `typed_integers` seems to just be an oversight.

Might fix: #7751
2021-02-22 14:48:56 +01:00
Aleksey Kladov
58be1edfbb Make more common assist easier to ues 2021-02-22 16:07:08 +03:00
Laurențiu Nicola
d03cfe141c Add test from #7273 2021-02-21 19:22:14 +02:00
Laurențiu Nicola
48ae948b22 Bump deps 2021-02-21 19:13:11 +02:00
Scott McMurray
0fe44d099a Stop mixing Result and Option with ? in inline_local_variable
Depending on the discussion in RFC#3058 this might not end up being necessary, but I think it's a reasonable change regardless.
2021-02-20 14:45:30 -08:00
bors[bot]
62bc753f8b
Merge #7732
7732: Don't lower TypeBound::Lifetime as GenericPredicate::Error r=flodiebold a=Veykril

Basically we just discard the typebound for now instead when lowering to `GenericPredicate`. I think this shouldn't have any other side effects?

Fixes #7683(hopefully for real this time)

I also played around with introducing `GenericPredicate::LifetimeOutlives` and `GenericPredicate::TypeOutlives`(see b9d6904845) but that won't fix this issue(at least not for now) due to lifetime predicate mismatches when resolving methods so I figure this is a good way to fix it for now.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-02-20 20:17:14 +00:00
Jeremy Kolb
1f3c637a1d Update tests 2021-02-20 14:59:05 -05:00
Lukas Wirth
0799288f01 Don't write trailing whitespace when formatting empty GenericPredicates 2021-02-20 20:43:04 +01:00
Lukas Wirth
9e5192d917 Don't lower TypeBound::Lifetime as GenericPredicate::Error 2021-02-20 19:08:20 +01:00
Matt Hall
8497b5bd75 Use format_to! to make logic a bit nicer 2021-02-20 17:11:04 +00:00
Matt Hall
b963893349 Fix #7712 retain visibility extracting mod to file 2021-02-20 16:51:16 +00:00
Laurențiu Nicola
4c589aded0 Remove documentation of obsolete extend selection command 2021-02-20 17:18:53 +02:00
bors[bot]
1349f6a791
Merge #7726
7726: feat(completion): add doc(hidden) completion for attributes r=lnicola a=bnjjj



Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-02-20 14:18:34 +00:00