Aramis Razzaghipour
9583dd5725
Replace if let
with match
where appropriate
2021-10-05 09:00:21 +11:00
bors[bot]
26a10767cb
Merge #10401
...
10401: minor: Test runnables check for test prefix and suffix in attributes only r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10393
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 16:03:03 +00:00
Lukas Wirth
b742dd313e
Test runnables check for test prefix and suffix in attributes only
2021-09-30 18:02:44 +02:00
longfangsong
0049b5b0bc
initial commit
2021-09-28 10:20:29 +08:00
Lukas Wirth
b6ed91a6de
Rename *Owner
traits to Has*
2021-09-27 12:54:24 +02:00
Aleksey Kladov
2bf81922f7
internal: more reasonable grammar for blocks
...
Consider these expples
{ 92 }
async { 92 }
'a: { 92 }
#[a] { 92 }
Previously the tree for them were
BLOCK_EXPR
{ ... }
EFFECT_EXPR
async
BLOCK_EXPR
{ ... }
EFFECT_EXPR
'a:
BLOCK_EXPR
{ ... }
BLOCK_EXPR
#[a]
{ ... }
As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357 ) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers
BLOCK_EXPR
STMT_LIST
{ ... }
BLOCK_EXPR
async
STMT_LIST
{ ... }
BLOCK_EXPR
'a:
STMT_LIST
{ ... }
BLOCK_EXPR
#[a]
STMT_LIST
{ ... }
2021-09-26 19:16:09 +03:00
Laurențiu Nicola
c9f448a834
Fix some clippy lints
2021-08-16 22:04:26 +03:00
Aleksey Kladov
3c49a9f079
minor: move functionality to a better place
2021-08-14 20:43:28 +03:00
Aleksey Kladov
e300f58d2c
internal: remove one more usage of old editing API.
2021-08-14 20:17:16 +03:00
Lukas Wirth
37ad9cb2a5
Don't use non cache syntaxnodes in generate_function for lookups
2021-08-14 17:51:11 +02:00
Aleksey Kladov
dc17b35e62
internal: remove a remnant of old editing infra
2021-08-14 18:24:42 +03:00
Aleksey Kladov
90357a9090
internal: merge hir::BinaryOp and ast::BinOp
2021-08-14 18:10:01 +03:00
Aleksey Kladov
6df00f8495
internal: make naming consistent
2021-08-14 17:01:28 +03:00
Aleksey Kladov
beca92b245
internal: make invert binary op more robust
...
Previously, we only inverted comparison operators (< and the like) if
the type implemented Ord. This doesn't make sense: if `<` works, then
`>=` will work as well!
Extra semantic checks greatly reduce robustness and predictability of
the assist, it's better to keep things simple.
2021-08-14 16:40:00 +03:00
Lukas Wirth
7e6eb67f0d
Substitute generic types in inline_call
2021-08-10 14:39:56 +02:00
Yoshua Wuyts
326890753c
implement feedback from review
2021-08-10 12:21:48 +02:00
Yoshua Wuyts
4d2e25a034
move trait body gen code to utils
2021-08-09 21:47:44 +02:00
bors[bot]
caac771439
Merge #9735
...
9735: Add assist to sort members alphabetically. r=matklad a=vsrs
Supports traits, impls, structs, unions and enums (including inner struct variants). Does not support modules yet.
```rust
en┃um Animal {
Dog(String, f64),
Cat { weight: f64, name: String },
}
```
->
```rust
enum Animal {
Cat { weight: f64, name: String },
Dog(String, f64),
}
```
---
```rust
enum Animal {
Dog(String, f64),
Cat {┃ weight: f64, name: String },
}
```
->
```rust
enum Animal {
Dog(String, f64),
Cat { name: String, weight: f64 },
}
```
---
More samples in docs 0b7835619a/crates/ide_assists/src/handlers/sort_items.rs (L12-L83)
.
Relates #6110
Co-authored-by: vsrs <vit@conrlab.com>
2021-08-09 10:21:14 +00:00
Lukas Wirth
c4a119f433
Simplify
2021-08-07 22:16:15 +02:00
Lukas Wirth
b96f1adf5c
Give TypeInfo fields and methods more appropriate names
2021-08-03 17:28:51 +02:00
Lukas Wirth
8afa2722b2
Revise TypeInfo::ty usage
2021-08-03 17:24:43 +02:00
Lukas Wirth
25ff7171c4
Introduce TypeInfo
2021-08-03 16:41:53 +02:00
vsrs
643f3931f7
Sort trait and impl methods
2021-08-02 19:49:36 +03:00
mahdi-frms
a5edf6de79
generate function assist favors deref cmpt types
2021-07-31 16:34:09 +04:30
Lukas Wirth
d91704cac5
Invert boolean literals in assist negation logic
2021-07-06 20:30:26 +02:00
Lukas Wirth
20be999304
Empower replace_if_let_with_match
2021-07-02 00:21:21 +02:00
rdambrosio
8e08b86304
Feat: inline generics in const and func trait completions
2021-06-17 19:54:28 -04:00
Maan2003
c9b4ac5be4
clippy::redudant_borrow
2021-06-13 09:24:16 +05:30
Aleksey Kladov
e6776c3e1b
use more precise name
2021-05-22 16:23:07 +03:00
Aleksey Kladov
47d7434dde
internal: replace AstTransformer with mutable syntax trees
2021-05-22 15:27:32 +03:00
Aleksey Kladov
883dd1568f
internal: use more mutable APIs
2021-05-14 20:00:35 +03:00
Aleksey Kladov
cea589b3b5
internal: rewrite assoc item manipulaion to use mutable trees
2021-05-14 18:47:08 +03:00
Aleksey Kladov
4f3c0adc5a
internal: introduce ast::make::ext
module with common shortcuts
...
There's a tension between keeping a well-architectured minimal
orthogonal set of constructs, and providing convenience functions.
Relieve this pressure by introducing an dedicated module for
non-orthogonal shortcuts.
This is inspired by the django.shortcuts module which serves a similar
purpose architecturally.
2021-05-09 19:55:43 +03:00
Lukas Wirth
e6e4417bbb
Remove SyntaxRewriter::from_fn
2021-04-23 18:36:43 +02:00
Lukas Wirth
c2a63b97a8
Rename target_ty to self_ty
2021-03-29 17:47:47 +02:00
bors[bot]
ae92014319
Merge #8213
...
8213: Added support for const generics in impl generation r=Veykril a=ivan770
Closes #8211
Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-03-27 10:00:37 +00:00
ivan770
5a2ef8d0ca
Added support for const generics in impl generation
2021-03-27 11:37:39 +02:00
cynecx
5ff3299dd6
syntax: return owned string instead of leaking string
2021-03-26 18:30:59 +01:00
Vladyslav Katasonov
afc68277f6
pull out suggest_name::* to utils; enchance heuristics
2021-03-02 16:25:22 +03:00
Domantas Jadenkus
f098a2b31b
move into_ and as_ generation to a separate file
2021-02-27 12:21:06 +02: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
Chetan Khilosiya
e4756cb4f6
7526: Rename crate assists to ide_assists.
2021-02-23 00:59:16 +05:30