Commit Graph

731 Commits

Author SHA1 Message Date
DropDemBits
8c0661b2de
Use GenericArgList for make::impl{_trait}
`make::impl_` no longer merges generic params and args in order to be in line
with `make::impl_`, which doesn't do it either.
2024-02-08 19:09:32 -05:00
bors
e07183461f Auto merge of #16487 - ShoyuVanilla:deref-generate-getter, r=Veykril
Remove unnecessary `.as_ref()` in generate getter assist

Resolves #12389
2024-02-08 15:15:52 +00:00
bors
66cec4d11a Auto merge of #16470 - Veykril:clippy-disallow, r=lnicola
internal: Lint debug prints and disallowed types with clippy
2024-02-05 17:20:43 +00:00
Shoyu Vanilla
26715a8fde
cargo fmt 2024-02-05 10:48:34 +09:00
Shoyu Vanilla
983cce8c31
Typo fix 2024-02-05 10:37:58 +09:00
Shoyu Vanilla
f0428e57ea
Simplify redundant coercion 2024-02-05 10:35:12 +09:00
Shoyu Vanilla
97ecfe4fab Remove unnecessary .as_ref() in generate getter assist 2024-02-05 00:44:57 +09:00
bors
8f6a72871e Auto merge of #16469 - Young-Flash:ci_typos, r=lnicola
internal: add typos check CI (part 2)

follow up https://github.com/rust-lang/rust-analyzer/pull/16448
2024-02-02 12:02:48 +00:00
Young-Flash
ba2910a3a7 minor: correct some typos 2024-02-02 18:22:54 +08:00
Lukas Wirth
9e8a0fae0c Lint debug prints and disallowed types with clippy 2024-02-01 17:57:27 +01:00
Johann Hemmann
771c6c9271 format_collect 2024-01-31 19:06:36 +01:00
bors
355c9444e1 Auto merge of #16448 - Young-Flash:typos, r=lnicola
minor: correct typos

I use [crate-ci/typos](https://github.com/crate-ci/typos) to check typos in codebase, if it's ok with you, I'd like to add a typo check CI using [typos](https://github.com/crate-ci/typos) (with Apache-2.0, MIT licenses).

BTW, we can add a [_typos.toml](https://github.com/crate-ci/typos/blob/master/docs/reference.md) as white list for some intentional typos
2024-01-31 13:29:55 +00:00
David Barsky
e1ea7c8844 internal: switch to tracing from log
This commit also adds `tracing` to NotificationDispatcher/RequestDispatcher,
bumps `rust-analyzer-salsa` to 0.17.0-pre.6, `always-assert` to 0.2, and
removes the homegrown `hprof` implementation in favor of a vendored
tracing-span-tree.
2024-01-30 12:27:31 -05:00
Young-Flash
db9fd370ee minor: correct typos 2024-01-30 21:43:43 +08:00
davidsemakula
84e13145ff add more tests for normalize import assist 2024-01-28 11:55:01 +03:00
davidsemakula
fc00602723 merge imports assist avoids adding unnecessary braces when merging nested use tree selections 2024-01-28 11:55:01 +03:00
davidsemakula
b241593f36 merge imports assist always applies to covering use item except for nested use tree selections 2024-01-28 11:55:01 +03:00
davidsemakula
a8a18f3ccf add normalize import assist 2024-01-28 11:55:01 +03:00
davidsemakula
8fab92feb2 normalize use trees when merging imports 2024-01-28 11:55:01 +03:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
r0cky
1a9ef233b7 Remove unused codes 2024-01-21 12:56:23 +08:00
bors
d4926c10b2 Auto merge of #16405 - dfireBird:guarded-return-for-loop, r=lnicola
fix: Include `for` construct in convert to guarded return conditions
2024-01-20 16:13:31 +00:00
dfireBird
721e79035d
include for in convert to guarded return assist 2024-01-20 19:26:50 +05:30
bors
0c764216d5 Auto merge of #16396 - Young-Flash:fix_marco, r=Veykril
fix panic with reference in macro

it panic at `builder.make_mut(segment)`, where segment is from macro expand. And the usage reference in orginal macro call isn't a `PathSegment` so we can't update it in `apply_references`, I can't find a way to deal with it properly so here just filter out the reference in macro. LMK if there are better way to fix this

try to close https://github.com/rust-lang/rust-analyzer/issues/16328
2024-01-20 08:12:44 +00:00
Young-Flash
f9b5e0d219 minor: use reference.range to get original range 2024-01-20 14:43:42 +08:00
Johann Hemmann
b1a0c9ac40 single_match 2024-01-19 18:31:15 +01:00
Johann Hemmann
71d4dba960 redundant_pattern_matching 2024-01-19 17:31:01 +01:00
Johann Hemmann
3cf1358eb8 question_mark 2024-01-19 17:31:01 +01:00
Johann Hemmann
6738edc259 ptr_arg 2024-01-19 17:31:01 +01:00
Johann Hemmann
e6f9f4c0e4 nonminimal_bool 2024-01-19 17:31:01 +01:00
Johann Hemmann
add40c8660 match_like_matches_macro 2024-01-19 17:31:01 +01:00
Johann Hemmann
b5eca5f2fc collapsible_if 2024-01-19 17:31:00 +01:00
bors
85c9a83262 Auto merge of #16398 - Urhengulas:satisfy-clippy, r=Veykril
`cargo clippy --fix`

This PR is the result of running `cargo clippy --fix && cargo fmt` in the root of the repository. I did not manually review all the changes, but just skimmed through a few of them. The tests still pass, so it seems fine.
2024-01-19 09:43:35 +00:00
davidsemakula
67c1c2bd14 update merge item assist implementation for "one" import granularity 2024-01-18 17:26:53 +03:00
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01:00
Young-Flash
0bf986d718 add test case with marco reference 2024-01-18 17:43:44 +08:00
Young-Flash
bd26403130 fix panic with reference in macro 2024-01-18 17:43:15 +08:00
davidsemakula
7db4117156 respect "one" import granularity config in merge imports assist 2024-01-18 01:44:57 +03:00
davidsemakula
4f176b3f7f update import granularity config and docs 2024-01-18 01:44:57 +03:00
bors
f4fec4ff65 Auto merge of #16378 - roife:fix/issue-15470, r=Veykril
fix: better handling of SelfParam in assist 'inline_call'

fix #15470.

The current `inline_call` directly translates `&self` into `let ref this = ...;` and `&mut self` into `let ref mut this = ...;`. However, it does not handle some complex scenarios.

This PR addresses the following transformations (assuming the receiving object is `obj`):

- `self`: `let this = obj`
- `mut self`: `let mut this = obj`
- `&self`: `let this = &obj`
- `&mut self`
  + If `obj` is `let mut obj = ...`, use a mutable reference: `let this = &mut obj`
  + If `obj` is `let obj = &mut ...;`, perform a reborrow: `let this = &mut *obj`
2024-01-17 08:43:13 +00:00
roife
920e99aacb test: add tests for variant kinds of SelfParam in inline_call 2024-01-17 14:19:57 +08:00
roife
d48498f360 fix: better handling of SelfParam in inline_call 2024-01-17 13:49:07 +08:00
roife
7c94c29648 fix: make let_stmts inserted in inline_call correctly indented 2024-01-16 21:42:29 +08:00
Lukas Wirth
384488c157 feat: Hover for literals showing additional value information 2024-01-16 14:28:47 +01:00
bors
0a8c7841e0 Auto merge of #16352 - davidsemakula:rustfmt-import-sort-algo, r=Veykril
internal: Follow rustfmt's algorithm for ordering imports when ordering and merging use trees

Updates use tree ordering and merging utilities to follow rustfmt's algorithm for ordering imports.
The [rustfmt implementation](6356fca675/src/imports.rs) was used as reference.
2024-01-16 11:23:03 +00:00
Moritz Hedtke
f937673ce2 fix: rename generator to coroutine
Follow the rename in nightly (see https://blog.rust-lang.org/inside-rust/2023/10/23/coroutines.html)
2024-01-15 12:24:47 +01:00
davidsemakula
22ae5f49ba order merged use trees 2024-01-12 17:05:23 +03:00
bors
d5366b5c19 Auto merge of #16265 - Patryk27:suggest-pub-crate-imports, r=Veykril
fix: Acknowledge `pub(crate)` imports in import suggestions

rust-analyzer has logic that discounts suggesting `use`s for private imports, but that logic is unnecessarily strict - for instance given this code:

```rust
mod foo {
    pub struct Foo;
}

pub(crate) use self::foo::*;

mod bar {
    fn main() {
        Foo$0;
    }
}
```

... RA will suggest to add `use crate::foo::Foo;`, which not only makes the code overly verbose (especially in larger code bases), but also is disjoint with what rustc itself suggests.

This commit adjusts the logic, so that `pub(crate)` imports are taken into account when generating the suggestions; considering rustc's behavior, I think this change doesn't warrant any extra configuration flag.

Note that this is my first commit to RA, so I guess the approach taken here might be suboptimal - certainly feels somewhat hacky, maybe there's some better way of finding out the optimal import path 😅
2024-01-11 09:54:22 +00:00
Patryk Wychowaniec
76aaf17794
Suggest pub(crate) imports
rust-analyzer has logic that discounts suggesting `use`s for private
imports, but that logic is unnecessarily strict - for instance given
this code:

```rust
mod foo {
    pub struct Foo;
}

pub(crate) use self::foo::*;

mod bar {
    fn main() {
        Foo$0;
    }
}
```

... RA will suggest to add `use crate::foo::Foo;`, which not only makes
the code overly verbose (especially in larger code bases), but also is
disjoint with what rustc itself suggests.

This commit adjusts the logic, so that `pub(crate)` imports are taken
into account when generating the suggestions; considering rustc's
behavior, I think this change doesn't warrant any extra configuration
flag.

Note that this is my first commit to RA, so I guess the approach taken
here might be suboptimal - certainly feels somewhat hacky, maybe there's
some better way of finding out the optimal import path 😅
2024-01-10 18:21:16 +01:00
bors
1c9bb31970 Auto merge of #16209 - l1nxy:add-merge-nested-if, r=Veykril
feat: assist to merge nested if

resolve: #16095
2024-01-10 09:18:05 +00:00