Commit Graph

859 Commits

Author SHA1 Message Date
Jeroen Vannevel
7daca6fe97
cleaning up Some 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
08300284e7
removed unwrap 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
7bc89f2542
formatting 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
bd77d8c3d1
removed prints 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
18fb5412b2
all tests work 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
aaec467cfd
merge_match_arms_nested_with_conflicting_identifier 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
169ec2fdc1
Added a few more test cases 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
b27b882e72
fixed test case 2022-01-14 01:32:11 +00:00
Jeroen Vannevel
2329b42407
test for different number of fields 2022-01-14 01:32:10 +00:00
Jeroen Vannevel
5675e0cd40
test cases with more branches 2022-01-14 01:32:10 +00:00
Jeroen Vannevel
130f11f270
simplified chain 2022-01-14 01:32:10 +00:00
Jeroen Vannevel
5dfc8da77e
don't need the as_ref() 2022-01-14 01:32:10 +00:00
Jeroen Vannevel
c52605024c
extracted function 2022-01-14 01:32:10 +00:00
Jeroen Vannevel
d8a3e51a5f
added tests for multiple fields 2022-01-14 01:32:10 +00:00
Jeroen Vannevel
9252c76255
using classify() 2022-01-14 01:32:10 +00:00
Jeroen Vannevel
6a1b4912bf
removed some unused stuff 2022-01-14 01:32:09 +00:00
Jeroen Vannevel
c9fc91822f
minicore 2022-01-14 01:32:09 +00:00
Jeroen Vannevel
215f896665
compiles, but doesn't work yet 2022-01-14 01:32:09 +00:00
Laurențiu Nicola
0721a55a48 Remove duplicate test attribute 2022-01-13 21:08:04 +02:00
Laurențiu Nicola
84c59a1f9f Reformat code 2022-01-13 21:07:17 +02:00
bors[bot]
c17db9fa53
Merge #11107
11107: Fix generic type substitution in impl trait with assoc type r=pnevyk a=pnevyk

Fixes #11045 

The path transform now detects if a type parameter that is being substituted has an associated type. In that case it is necessary (or safe in general case) to fully qualify the substitution with a trait which the associated type belongs to.

This PR also fixes the previous wrong behavior of the substitution that could create an invalid tree `PATH_TYPE -> PATH_TYPE -> ...`.

Co-authored-by: Petr Nevyhoštěný <petr.nevyhosteny@gmail.com>
2022-01-08 09:05:09 +00:00
Petr Nevyhoštěný
a710b87b1b Fix generic type substitution in impl trait with assoc const 2022-01-07 16:41:39 +01:00
bors[bot]
efb9b89163
Merge #11220
11220: Turbo fish assist: don't include lifetime parameters r=Veykril a=Vannevelj

Fixes #11219

The issue talks about three different types of params: type, const & lifetime. I wasn't entirely sure which ones are intended to be included here so I've gone for the type & const params (i.e. exclude lifetime).

I've added a test case for both a lifetime param and a const param. I'm still making my way through the rust book (chapter 7, yay) so I'm not too sure yet what these are but my testing shows that this approach generates code that compiles.

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-01-07 14:02:01 +00:00
Jeroen Vannevel
0a240e31c5
succinct code 2022-01-07 13:53:42 +00:00
bors[bot]
c09504bd58
Merge #11194
11194: fix(gen-doc-assist): remove lifetimes in description of `new` r=Veykril a=numero-744

From wrong behavior:

```rust
/// Creates a new [`MyGenericStruct<'a, T>`].
```

to correct behavior:

```rust
/// Creates a new [`MyGenericStruct<T>`].
```

But I feel like there is a better way to implement it. Do you know if there is an existing function that could do the work of `lifetimes_removed()` below?

Co-authored-by: Côme ALLART <come.allart@etu.emse.fr>
2022-01-07 13:24:58 +00:00
Jeroen Vannevel
4bcdb05325
include tabstops 2022-01-07 13:17:21 +00:00
Côme ALLART
1b5c60f549 refactor: apply suggestions
See PR #11194
2022-01-07 14:07:35 +01:00
Jeroen Vannevel
778e71b15f
fmt 2022-01-07 12:40:41 +00:00
Jeroen Vannevel
76e0429048
concise filtering 2022-01-07 12:34:03 +00:00
Jeroen Vannevel
734193bc23 support const params 2022-01-07 01:09:32 +00:00
Jeroen Vannevel
b6201051b2 Count the type parameters only 2022-01-07 01:02:16 +00:00
Laurențiu Nicola
e14d9208f5 Move pretty-printing test out of assist 2022-01-06 16:38:25 +02:00
Côme ALLART
c2d3f90886 fix: remove brackets if no generic types 2022-01-06 01:51:04 +01:00
bors[bot]
2e33bf23c9
Merge #11204
11204: fix: `replace_qualified_name_with_use` does not use full item path for replacements r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-05 22:47:30 +00:00
Lukas Wirth
2d33cdf188 fix: replace_qualified_name_with_use does not use full item path for replacements 2022-01-05 23:46:58 +01:00
bors[bot]
ada51f2ac4
Merge #11195 #11202
11195: Correctly pass through reference modifiers when extracting a variable r=Veykril a=Vannevelj

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

This will parse the field expression and look at whether it is marked `&` or `&mut` and include a modifier if appropriate. The original issue only mentions `&mut params` but I've found that this issue also occurs for `&mut locals` as well as `&params` and `&locals` so I've also added tests for them.

I'd definitely be interested in hearing where I can make my code more idiomatic for Rust.

11202: fix: Fix `apply_demorgan` assist hanging for certain binary expressions r=Veykril a=Veykril

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

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-05 21:30:50 +00:00
Lukas Wirth
b92ed115c1 fix: Fix apply_demorgan assist hanging for certain binary expressions 2022-01-05 22:30:19 +01:00
Jeroen Vannevel
035a373a6a
removed double matching 2022-01-05 21:16:24 +00:00
Jeroen Vannevel
771c87f890
no PathExpr arm 2022-01-05 21:12:09 +00:00
Jeroen Vannevel
8c0b848694
.clone() over .to_owned() 2022-01-05 21:10:03 +00:00
Jeroen Vannevel
2724b35490
less wordy ref_kind assignment 2022-01-05 21:08:46 +00:00
bors[bot]
149981fbfc
Merge #11200
11200: Always put a space after dyn in macro pretty-printing r=Veykril a=jplatte

Fixes #11100.

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-01-05 20:04:49 +00:00
Jonas Platte
f5b789b1dc
Add failing test case for issue 11100 2022-01-05 18:04:36 +01:00
Jeroen Vannevel
053ae2452c
removed trailing whitespace 2022-01-05 02:16:22 +00:00
Jeroen Vannevel
abab0154b6
comment 2022-01-05 01:48:57 +00:00
Jeroen Vannevel
fa0afb9576
additional test for a reference local (on top of mutable reference local) 2022-01-05 01:36:04 +00:00
Jeroen Vannevel
4c1a1b2570
failing test for a reference local 2022-01-05 01:27:15 +00:00
Jeroen Vannevel
cd5ad4e500
Don't include a ref if none was declared 2022-01-05 01:18:55 +00:00
Jeroen Vannevel
817f47828c
support ref params as well 2022-01-05 01:15:54 +00:00
Jeroen Vannevel
056e18fcbd
correctly handle mutable references 2022-01-05 01:03:27 +00:00