]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agomove some tests
Aleksey Kladov [Sun, 10 Oct 2021 08:44:46 +0000 (11:44 +0300)]
move some tests

2 years agomove tests
Aleksey Kladov [Sun, 10 Oct 2021 08:39:08 +0000 (11:39 +0300)]
move tests

2 years agomove test
Aleksey Kladov [Sun, 10 Oct 2021 08:29:26 +0000 (11:29 +0300)]
move test

2 years agomove test
Aleksey Kladov [Sun, 10 Oct 2021 08:26:18 +0000 (11:26 +0300)]
move test

2 years agotest formatting
Aleksey Kladov [Sun, 10 Oct 2021 08:22:12 +0000 (11:22 +0300)]
test formatting

2 years agotest formatting
Aleksey Kladov [Sun, 10 Oct 2021 08:16:25 +0000 (11:16 +0300)]
test formatting

2 years agomove tests
Aleksey Kladov [Sun, 10 Oct 2021 08:15:42 +0000 (11:15 +0300)]
move tests

2 years agointernal: move tests
Aleksey Kladov [Sun, 10 Oct 2021 08:11:50 +0000 (11:11 +0300)]
internal: move tests

2 years agodead code
Aleksey Kladov [Sun, 10 Oct 2021 08:09:16 +0000 (11:09 +0300)]
dead code

2 years agointernal: move some mbe tests
Aleksey Kladov [Sat, 9 Oct 2021 20:33:43 +0000 (23:33 +0300)]
internal: move some mbe tests

2 years agomove tests
Aleksey Kladov [Sat, 9 Oct 2021 19:23:38 +0000 (22:23 +0300)]
move tests

2 years agofix tests
Aleksey Kladov [Sat, 9 Oct 2021 19:19:42 +0000 (22:19 +0300)]
fix tests

2 years agoMerge #10506
bors[bot] [Sun, 10 Oct 2021 07:56:47 +0000 (07:56 +0000)]
Merge #10506

10506: Add comment r=lnicola a=k-nasa

## Why

This code looks logic-bug ...

https://github.com/rust-analyzer/rust-analyzer/blob/ce86534e1cb22685e83c3f91ea89025edbfcbc98/crates/syntax/src/syntax_node.rs#L50

However, this code has been intentionally disabled.
It's a good idea to write a comment

ref: https://github.com/rust-analyzer/rust-analyzer/pull/10357

## What

- I added comment

Co-authored-by: k-nasa <htilcs1115@gmail.com>
2 years agoAdd comment
k-nasa [Sun, 10 Oct 2021 07:53:37 +0000 (16:53 +0900)]
Add comment

2 years agoMerge #10504
bors[bot] [Sun, 10 Oct 2021 07:17:52 +0000 (07:17 +0000)]
Merge #10504

10504: Remove needless clone r=lnicola a=k-nasa

## Why

Delete clones for efficiency

## What

- I erased unnecessary clones

Co-authored-by: k-nasa <htilcs1115@gmail.com>
2 years agoremove comment
k-nasa [Sun, 10 Oct 2021 04:16:34 +0000 (13:16 +0900)]
remove comment

2 years agoRevert "update comment"
k-nasa [Sun, 10 Oct 2021 01:51:45 +0000 (10:51 +0900)]
Revert "update comment"

This reverts commit 820393f72d68c6bf1df125057296402ba83ca982.

2 years agoRemove neesless clone
k-nasa [Sun, 10 Oct 2021 01:50:51 +0000 (10:50 +0900)]
Remove neesless clone

2 years agoupdate comment
k-nasa [Sun, 10 Oct 2021 01:16:32 +0000 (10:16 +0900)]
update comment

2 years agoAdd code comment
k-nasa [Sun, 10 Oct 2021 01:10:52 +0000 (10:10 +0900)]
Add code comment

2 years agoMerge #10499
bors[bot] [Sat, 9 Oct 2021 19:46:47 +0000 (19:46 +0000)]
Merge #10499

10499: feat: be more precise in mismatch arg counts highlighting r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofeat: be more precise in mismatch arg counts highlighting
Aleksey Kladov [Sat, 9 Oct 2021 19:45:54 +0000 (22:45 +0300)]
feat: be more precise in mismatch arg counts highlighting

2 years agoMerge #10497
bors[bot] [Sat, 9 Oct 2021 16:11:30 +0000 (16:11 +0000)]
Merge #10497

10497: internal: move tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agomove test
Aleksey Kladov [Sat, 9 Oct 2021 15:55:50 +0000 (18:55 +0300)]
move test

2 years agointernal: move tests
Aleksey Kladov [Sat, 9 Oct 2021 15:54:15 +0000 (18:54 +0300)]
internal: move tests

2 years agointernal: move test
Aleksey Kladov [Sat, 9 Oct 2021 15:51:26 +0000 (18:51 +0300)]
internal: move test

2 years agointernal: move test
Aleksey Kladov [Sat, 9 Oct 2021 15:49:14 +0000 (18:49 +0300)]
internal: move test

2 years agointernal: drop duplicated test
Aleksey Kladov [Sat, 9 Oct 2021 15:47:04 +0000 (18:47 +0300)]
internal: drop duplicated test

2 years agointernal: move test
Aleksey Kladov [Sat, 9 Oct 2021 15:46:16 +0000 (18:46 +0300)]
internal: move test

2 years agointernal: move tests
Aleksey Kladov [Sat, 9 Oct 2021 15:43:15 +0000 (18:43 +0300)]
internal: move tests

2 years agoMerge #10496
bors[bot] [Sat, 9 Oct 2021 15:19:39 +0000 (15:19 +0000)]
Merge #10496

10496: internal: move some macro tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: move some tests
Aleksey Kladov [Sat, 9 Oct 2021 15:18:56 +0000 (18:18 +0300)]
internal: move some tests

2 years agointernal: move some macro tests
Aleksey Kladov [Sat, 9 Oct 2021 15:15:05 +0000 (18:15 +0300)]
internal: move some macro tests

2 years agointernal: make sure macro test expand to valid syntax
Aleksey Kladov [Sat, 9 Oct 2021 15:06:24 +0000 (18:06 +0300)]
internal: make sure macro test expand to valid syntax

2 years agointernal: allow macro tests to inspect parse tree
Aleksey Kladov [Sat, 9 Oct 2021 14:58:17 +0000 (17:58 +0300)]
internal: allow macro tests to inspect parse tree

2 years agomove tests
Aleksey Kladov [Sat, 9 Oct 2021 14:43:07 +0000 (17:43 +0300)]
move tests

2 years agoindent macro output when pprinting
Aleksey Kladov [Sat, 9 Oct 2021 14:36:41 +0000 (17:36 +0300)]
indent macro output when pprinting

2 years agoalign tests to code style
Aleksey Kladov [Sat, 9 Oct 2021 14:31:04 +0000 (17:31 +0300)]
align tests to code style

2 years agomove some tests
Aleksey Kladov [Sat, 9 Oct 2021 14:27:38 +0000 (17:27 +0300)]
move some tests

2 years agointernal: don't un-indent macro tests manually
Aleksey Kladov [Sat, 9 Oct 2021 14:17:37 +0000 (17:17 +0300)]
internal: don't un-indent macro tests manually

2 years agointernal: update expect
Aleksey Kladov [Sat, 9 Oct 2021 14:17:16 +0000 (17:17 +0300)]
internal: update expect

2 years agoMerge #10495
bors[bot] [Sat, 9 Oct 2021 13:32:11 +0000 (13:32 +0000)]
Merge #10495

10495: internal: move some mbe tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: move test
Aleksey Kladov [Sat, 9 Oct 2021 13:31:26 +0000 (16:31 +0300)]
internal: move test

2 years agorename
Aleksey Kladov [Sat, 9 Oct 2021 13:28:11 +0000 (16:28 +0300)]
rename

2 years agomove test
Aleksey Kladov [Sat, 9 Oct 2021 13:27:19 +0000 (16:27 +0300)]
move test

2 years agomove test
Aleksey Kladov [Sat, 9 Oct 2021 13:25:37 +0000 (16:25 +0300)]
move test

2 years agomove test
Aleksey Kladov [Sat, 9 Oct 2021 13:22:42 +0000 (16:22 +0300)]
move test

2 years agointernal: move test
Aleksey Kladov [Sat, 9 Oct 2021 13:19:19 +0000 (16:19 +0300)]
internal: move test

2 years agoMerge #10494
bors[bot] [Sat, 9 Oct 2021 12:30:27 +0000 (12:30 +0000)]
Merge #10494

10494: Macro expansion tests r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: docs
Aleksey Kladov [Sat, 9 Oct 2021 12:29:31 +0000 (15:29 +0300)]
internal: docs

2 years agofeat: report errors in macro definition
Aleksey Kladov [Sat, 9 Oct 2021 12:23:55 +0000 (15:23 +0300)]
feat: report errors in macro definition

Reporting macro *definition* error at the macro *call site* is a rather
questionable approach, but at least we don't erase the errors
altogether!

2 years agoget organizized
Aleksey Kladov [Sat, 9 Oct 2021 11:53:15 +0000 (14:53 +0300)]
get organizized

2 years agofuture proof structure
Aleksey Kladov [Sat, 9 Oct 2021 11:48:38 +0000 (14:48 +0300)]
future proof structure

2 years agomove test
Aleksey Kladov [Sat, 9 Oct 2021 11:45:52 +0000 (14:45 +0300)]
move test

2 years agomove tests
Aleksey Kladov [Sat, 9 Oct 2021 11:38:57 +0000 (14:38 +0300)]
move tests

2 years agointernal: move tests
Aleksey Kladov [Sat, 9 Oct 2021 11:22:49 +0000 (14:22 +0300)]
internal: move tests

2 years agointernal: move test
Aleksey Kladov [Sat, 9 Oct 2021 11:18:53 +0000 (14:18 +0300)]
internal: move test

2 years agointernal: move test
Aleksey Kladov [Sat, 9 Oct 2021 10:51:02 +0000 (13:51 +0300)]
internal: move test

2 years agointernal: start new macro test suite
Aleksey Kladov [Sat, 9 Oct 2021 10:42:32 +0000 (13:42 +0300)]
internal: start new macro test suite

I don't like our macro tests -- they are brittle and don't inspire
confidence. I think the reason for that is that we try to unit-test
them, but that is at odds with reality, where macro expansion
fundamentally depends on name resolution.

2 years agoMerge #10474
bors[bot] [Thu, 7 Oct 2021 15:09:42 +0000 (15:09 +0000)]
Merge #10474

10474: feat: Support `let...else` r=jonas-schievink a=jonas-schievink

bors r+

closes https://github.com/rust-analyzer/rust-analyzer/issues/10469

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoSupport `let...else`
Jonas Schievink [Thu, 7 Oct 2021 15:05:50 +0000 (17:05 +0200)]
Support `let...else`

2 years agoMerge #10477 #10482
bors[bot] [Thu, 7 Oct 2021 13:05:18 +0000 (13:05 +0000)]
Merge #10477 #10482

10477: parser: fix parsing of macro call inside generic args r=Veykril a=cynecx

10482: fix: fix `inline_call` trying to use an uncached syntax node in Semantics r=Veykril a=Veykril

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

Co-authored-by: cynecx <me@cynecx.net>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoExpose HasSource::source through Semantics with caching behaviour
Lukas Wirth [Thu, 7 Oct 2021 12:46:49 +0000 (14:46 +0200)]
Expose HasSource::source through Semantics with caching behaviour

2 years agoMerge #10480
bors[bot] [Thu, 7 Oct 2021 12:56:28 +0000 (12:56 +0000)]
Merge #10480

10480: fix: Change `stdx::to_snake_case` to match rustc implementation r=Veykril a=Crauzer

Fixes #10473

Co-authored-by: crauzer <filip.quitko@gmail.com>
2 years agoMerge #10467
bors[bot] [Wed, 6 Oct 2021 21:47:22 +0000 (21:47 +0000)]
Merge #10467

10467: Optimize CodeLens for references/impls r=Veykril a=ericsampson

Don't do unnecessary work.
Followup to #10447 . cc `@Veykril`

Co-authored-by: Eric Sampson <esampson@eaze.com>
2 years agoRefactor to eliminate a vector allocation.
Eric Sampson [Wed, 6 Oct 2021 21:43:37 +0000 (16:43 -0500)]
Refactor to eliminate a vector allocation.

2 years agofix test
crauzer [Wed, 6 Oct 2021 21:37:43 +0000 (23:37 +0200)]
fix test

2 years agoFix stdx::to_snake_case
crauzer [Wed, 6 Oct 2021 21:24:47 +0000 (23:24 +0200)]
Fix stdx::to_snake_case

2 years agoMerge #10479
bors[bot] [Wed, 6 Oct 2021 20:54:27 +0000 (20:54 +0000)]
Merge #10479

10479: fix: fix "index out of bounds" panic in name resolution r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/10084
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9163

This is really just a salsa update to a version that removes the problematic code (see https://github.com/rust-analyzer/rust-analyzer/issues/10084#issuecomment-934445711)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoMerge #10476
bors[bot] [Wed, 6 Oct 2021 20:45:14 +0000 (20:45 +0000)]
Merge #10476

10476: feat: Add `replace_try_expr_with_match` assist r=Veykril a=Crauzer

Adds the replace_try_expr_with_match assist
#10424

Co-authored-by: crauzer <filip.quitko@gmail.com>
2 years agoUpdate salsa
Jonas Schievink [Wed, 6 Oct 2021 20:42:54 +0000 (22:42 +0200)]
Update salsa

2 years agoparser: fix parsing of macro call inside generic args
cynecx [Wed, 6 Oct 2021 20:10:50 +0000 (22:10 +0200)]
parser: fix parsing of macro call inside generic args

2 years agoMerge #10478
bors[bot] [Wed, 6 Oct 2021 20:36:15 +0000 (20:36 +0000)]
Merge #10478

10478: minor: Update Cargo.lock r=Veykril a=Veykril

This causes CI to fail for some reason I think
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUpdate Cargo.lock
Lukas Wirth [Wed, 6 Oct 2021 20:34:55 +0000 (22:34 +0200)]
Update Cargo.lock

2 years agofix tests
crauzer [Wed, 6 Oct 2021 18:45:18 +0000 (20:45 +0200)]
fix tests

2 years agoadd sourcegen
crauzer [Wed, 6 Oct 2021 18:23:22 +0000 (20:23 +0200)]
add sourcegen

2 years agoAdd replace_try_expr_with_match assist
crauzer [Wed, 6 Oct 2021 18:11:00 +0000 (20:11 +0200)]
Add replace_try_expr_with_match assist

2 years agoMerge #10420
bors[bot] [Wed, 6 Oct 2021 15:05:40 +0000 (15:05 +0000)]
Merge #10420

10420: Parse outer attributes on StructPatternEtCetera r=jonas-schievink a=XFFXFF

Try to fix https://github.com/rust-analyzer/rust-analyzer/issues/8610
Related pr in ungrammer: https://github.com/rust-analyzer/ungrammar/pull/41

Co-authored-by: zhoufan <1247714429@qq.com>
2 years agoMerge #10459
bors[bot] [Wed, 6 Oct 2021 09:38:58 +0000 (09:38 +0000)]
Merge #10459

10459: feat: Add generate constant assist r=Veykril a=longfangsong

Close #10330.
![demo(1)](https://user-images.githubusercontent.com/13777628/135885262-c80de86f-5555-4f84-9508-822243f8a876.gif)

Co-authored-by: longfangsong <longfangsong@icloud.com>
Co-authored-by: 龙方淞 <longfangsong@icloud.com>
2 years agoDon't do work and then throw it away.
Eric Sampson [Wed, 6 Oct 2021 06:16:31 +0000 (01:16 -0500)]
Don't do work and then throw it away.

2 years agocleanup
longfangsong [Wed, 6 Oct 2021 02:14:12 +0000 (10:14 +0800)]
cleanup

2 years agoUpdate crates/ide_assists/src/handlers/generate_constant.rs
龙方淞 [Wed, 6 Oct 2021 02:06:51 +0000 (10:06 +0800)]
Update crates/ide_assists/src/handlers/generate_constant.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUpdate crates/ide_assists/src/handlers/generate_constant.rs
龙方淞 [Wed, 6 Oct 2021 02:06:46 +0000 (10:06 +0800)]
Update crates/ide_assists/src/handlers/generate_constant.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #10447
bors[bot] [Tue, 5 Oct 2021 22:03:23 +0000 (22:03 +0000)]
Merge #10447

10447: Add enum variant references CodeLens. r=Veykril a=ericsampson

Co-authored-by: Eric Sampson <esampson@eaze.com>
2 years agoRefactor according to PR comments to remove allocations.
Eric Sampson [Tue, 5 Oct 2021 20:42:45 +0000 (15:42 -0500)]
Refactor according to PR comments to remove allocations.

2 years agoMerge #10458
bors[bot] [Tue, 5 Oct 2021 16:41:11 +0000 (16:41 +0000)]
Merge #10458

10458: feat: Implement custom user snippets r=Veykril a=Veykril

![Y24dX7fOWX](https://user-images.githubusercontent.com/3757771/136059454-ceccfc2c-2c90-46da-8ad1-bac9c2e83ec1.gif)

Allows us to address the following issues:
    - `.arc / .rc / .pin, similar to .box?` https://github.com/rust-analyzer/rust-analyzer/issues/7033
    - `Add unsafe snippet` https://github.com/rust-analyzer/rust-analyzer/issues/10392, would allow users to have this without the diagnostic)
    - `.ok() postfix snippet is annoying` https://github.com/rust-analyzer/rust-analyzer/issues/9636, allows us to get rid of the `ok` postfix and similar ones
    - `Postfix vec completion` https://github.com/rust-analyzer/rust-analyzer/issues/7773

cc https://github.com/rust-analyzer/rust-analyzer/issues/772

Zulipd discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Custom.20Postfix.20snippets

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRender the expansion of snippets as their docs
Lukas Wirth [Tue, 5 Oct 2021 16:00:27 +0000 (18:00 +0200)]
Render the expansion of snippets as their docs

2 years agoBring the implementation closer to VSCode snippet definitions
Lukas Wirth [Tue, 5 Oct 2021 15:18:40 +0000 (17:18 +0200)]
Bring the implementation closer to VSCode snippet definitions

2 years agoMerge #10440
bors[bot] [Tue, 5 Oct 2021 08:58:40 +0000 (08:58 +0000)]
Merge #10440

10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg

I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537](https://github.com/rust-lang/rust-clippy/issues/5537) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159)), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn.

I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely.

Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2 years agoReplace `if let` with `match` where appropriate
Aramis Razzaghipour [Sun, 3 Oct 2021 12:53:01 +0000 (23:53 +1100)]
Replace `if let` with `match` where appropriate

2 years agoReplace `if let Some(_) = foo` with `if foo.is_some()`
Aramis Razzaghipour [Sun, 3 Oct 2021 12:51:30 +0000 (23:51 +1100)]
Replace `if let Some(_) = foo` with `if foo.is_some()`

2 years agoinitialize vector to required size.
Eric Sampson [Mon, 4 Oct 2021 21:14:01 +0000 (16:14 -0500)]
initialize vector to required size.

2 years agoResolve macros in snippet require items
Lukas Wirth [Mon, 4 Oct 2021 20:45:47 +0000 (22:45 +0200)]
Resolve macros in snippet require items

2 years agoRegen docs
Lukas Wirth [Mon, 4 Oct 2021 20:13:12 +0000 (22:13 +0200)]
Regen docs

2 years agoFix multiple imports acting on files on separately
Lukas Wirth [Mon, 4 Oct 2021 20:05:30 +0000 (22:05 +0200)]
Fix multiple imports acting on files on separately

2 years agoRegen generated_config.adoc
Lukas Wirth [Mon, 4 Oct 2021 19:47:02 +0000 (21:47 +0200)]
Regen generated_config.adoc

2 years agoMake multiple import edits work for completions
Lukas Wirth [Mon, 4 Oct 2021 19:44:33 +0000 (21:44 +0200)]
Make multiple import edits work for completions

2 years agoAdd custom non-postfix snippets
Lukas Wirth [Mon, 4 Oct 2021 17:22:41 +0000 (19:22 +0200)]
Add custom non-postfix snippets

2 years agoMerge #10460
bors[bot] [Mon, 4 Oct 2021 16:24:54 +0000 (16:24 +0000)]
Merge #10460

10460: fix: Only add `proc_macro` to prelude in proc-macro crates r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoOnly add `proc_macro` to prelude in proc-macro crates
Jonas Schievink [Mon, 4 Oct 2021 16:22:39 +0000 (18:22 +0200)]
Only add `proc_macro` to prelude in proc-macro crates