Commit graph

10668 commits

Author SHA1 Message Date
Aleksey Kladov
52a220cece Deprecate hir::Path::from_ast 2020-06-15 10:55:48 +02:00
bors[bot]
672d160b01
Merge #4888
4888: Var naming r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-15 08:33:45 +00:00
Aleksey Kladov
5413a2f962 Var naming 2020-06-15 10:33:17 +02:00
bors[bot]
6609e71b16
Merge #4882
4882: _match.rs: improve comment formatting r=matklad a=jonas-schievink

This results in much nicer rustdoc output

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-06-15 08:25:05 +00:00
bors[bot]
99c1df3599
Merge #4880
4880: "fill match arms" assist: Match on bind patterns r=flodiebold a=tobz1000

This prevents duplication of match arms where the pre-existing arm is a bind pattern.

Co-authored-by: Toby Dimmick <tobydimmick@pm.me>
2020-06-15 08:13:22 +00:00
Toby Dimmick
41f5471f3e fill_match_arms bind pattern implementation 2020-06-14 22:44:51 +01:00
Toby Dimmick
34db4edb80 fill_match_arms bind pattern test 2020-06-14 22:43:16 +01:00
Benjamin Coenen
36d9105d0e display Doctest code lens before comment #4785
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-14 21:50:24 +02:00
Jonas Schievink
4ebafb9005 _match.rs: improve comment formatting 2020-06-14 15:56:02 +02:00
bors[bot]
017331a53c
Merge #4875
4875: Introduce paths crate r=matklad a=matklad

It's a good idea to distinguish between absolute and relative paths at
the type level, to avoid accidental dependency on the cwd, which
really shouldn't matter for rust-analyzer service



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-14 12:16:00 +00:00
Aleksey Kladov
a32cff333d Introduce paths crate
It's a good idea to distinguish between absolute and relative paths at
the type level, to avoid accidental dependency on the cwd, which
really shouldn't matter for rust-analyzer service
2020-06-14 14:15:36 +02:00
Veetaha
667d224fcc Reduce the usage of bare subscript operator 2020-06-14 13:12:52 +03:00
Jonas Schievink
5d66bfe163 Shorten *all* qualified paths when adding use 2020-06-13 19:12:05 +02:00
Jonas Schievink
b65c0a5893 Expose find_insert_use_container 2020-06-13 19:05:46 +02:00
Jonas Schievink
e9eb54c617 Fix rewrite_root when there's only 1 replacement 2020-06-13 19:05:46 +02:00
bors[bot]
246c66a7f7
Merge #4867
4867: Cleanup URL handling r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:35:44 +00:00
bors[bot]
d64b583e5a
Merge #4869
4869: Discourage allocation r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:27:51 +00:00
Aleksey Kladov
be0bb857c1 Discourage allocation 2020-06-13 14:27:23 +02:00
Aleksey Kladov
50bbf7233d Cleanup URL handling 2020-06-13 14:15:38 +02:00
bors[bot]
d00ca86da4
Merge #4868
4868: Fix if and while postfix completions r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:12:08 +00:00
Aleksey Kladov
7dafe951d4 Fix if and while postfix completions 2020-06-13 14:06:13 +02:00
bors[bot]
c87c4a0a40
Merge #4700
4700: Add top level keywords completion r=matklad a=mcrakhman

This fixes the following issue: https://github.com/rust-analyzer/rust-analyzer/issues/4566. 

Also added simple logic which filters the keywords which can be used with unsafe on the top level.   

Co-authored-by: Mikhail Rakhmanov <rakhmanov.m@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:02:59 +00:00
Aleksey Kladov
b99b4953c9 More concise completion tests 2020-06-13 13:57:18 +02:00
Aleksey Kladov
ef70076f1d Cleanup 2020-06-13 13:47:30 +02:00
bors[bot]
1c841c8a98
Merge #4862
4862: Revert "Hide squiggly for unused and unnecessary" r=matklad a=GabbeV

This reverts https://github.com/rust-analyzer/rust-analyzer/pull/4721

Co-authored-by: Gabriel Valfridsson <gabriel.valfridsson@gmail.com>
2020-06-13 11:04:42 +00:00
Mikhail Rakhmanov
d583e34954 Remove accidentally added adoc file 2020-06-13 10:48:39 +02:00
Mikhail Rakhmanov
912f38200f Add keywords completions on source file position 2020-06-13 10:43:39 +02:00
Mikhail Rakhmanov
16bbf4ab7f Merge branch 'master' into keyword_completion
# Conflicts:
#	docs/user/generated_features.adoc
2020-06-13 08:42:15 +02:00
Mikhail Rakhmanov
eeb8b9e236 Fix tests and remove unused methods 2020-06-13 01:21:48 +02:00
Mikhail Rakhmanov
6feb52c12a Add more patterns, tests and fix keywords 2020-06-13 00:55:21 +02:00
Mikhail Rakhmanov
3576671043 Rewrite snapshot checks 2020-06-12 20:30:57 +02:00
Gabriel Valfridsson
66291d19f9 Revert "Hide squiggly for unused and unnecessary"
This reverts commit 599c105e6f.
2020-06-12 18:39:50 +02:00
bors[bot]
b56ad148db
Merge #4857
4857: Fix invalid shorthand initialization diagnostic for tuple structs r=jonas-schievink a=OptimalStrategy

Initializing tuple structs explicitly, like in the example below, produces a "Shorthand struct initialization" diagnostic that leads to a compilation error when applied:
```rust
struct S(usize);

fn main() { 
    let s = S { 0: 0 };  // OK, but triggers the diagnostic
    // let s = S { 0 };  // Compilation error
}
```

This PR adds a check that the field name is not a literal.

Co-authored-by: OptimalStrategy <george@usan-podgornov.com>
Co-authored-by: OptimalStrategy <17456182+OptimalStrategy@users.noreply.github.com>
2020-06-12 14:28:40 +00:00
OptimalStrategy
591b5ec2c1 simplify determining whether the field is a tuple field 2020-06-12 10:16:19 -04:00
bors[bot]
f3d73865d6
Merge #4855
4855: Use more idiomatic style for lifetimes in generated code r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-12 12:49:30 +00:00
bors[bot]
1906655070
Merge #4856
4856: Simplify r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-12 12:41:52 +00:00
bors[bot]
08a58901e8
Merge #4858
4858: find_path: return shorter paths for external items r=flodiebold a=jonas-schievink

If a containing module is already in scope, there's no need to use the full path to the item.

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-06-12 11:47:56 +00:00
Mikhail Rakhmanov
42a719ad25 Remove comment and incorrect assert 2020-06-12 13:14:53 +02:00
Mikhail Rakhmanov
d38bf1624d Return snapshots to tests 2020-06-12 13:09:42 +02:00
Jonas Schievink
0231e4ac77 find_path: return shorter paths for external items
If a containing module is already in scope, there's no need to
use the full path to the item.
2020-06-12 13:01:20 +02:00
Mikhail Rakhmanov
f123539ad2 More assert refactoring 2020-06-12 12:15:53 +02:00
Mikhail Rakhmanov
4c92f2d190 Add more pattern tests 2020-06-12 10:12:15 +02:00
Mikhail Rakhmanov
396167eadb New testing approach for keywords 2020-06-12 08:49:12 +02:00
OptimalStrategy
59f195a323 Fix invalid shorthand initialization diagnostic for tuple structs 2020-06-12 01:11:54 -04:00
Veetaha
4fefc7d06c Simplify 2020-06-12 02:56:06 +03:00
Veetaha
c514060600 Apply codegen with idiomatic lifetimes 2020-06-12 01:26:58 +03:00
Veetaha
33e009ec42 Use more idiomatic style for lifetimes in generated code 2020-06-12 01:23:04 +03:00
Mikhail Rakhmanov
a2b4385f16 Add few smoke tests for patterns and refactoring 2020-06-12 00:17:30 +02:00
Mikhail Rakhmanov
f46bc12199 Add more patterns and keywords 2020-06-11 23:25:58 +02:00
bors[bot]
36353bb182
Merge #4833
4833: Separating parsing of `for` in predicates and types r=matklad a=matthewjasper

We now correctly accept `for<'a> (&'a F): Fn(&'a str)` in a where clause and correctly reject `for<'a> &'a u32` as a type.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
2020-06-11 17:33:20 +00:00