]>
git.lizzy.rs Git - rust.git/log
bors[bot] [Wed, 20 Oct 2021 18:05:31 +0000 (18:05 +0000)]
Merge #10600
10600: minor: Make some functions non-generic r=Veykril a=lnicola
This reduces `text` size by 10192 bytes (0.064% :cry:), with no apparent change in performance.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Wed, 20 Oct 2021 17:20:17 +0000 (20:20 +0300)]
Make some functions non-generic
bors[bot] [Wed, 20 Oct 2021 15:03:36 +0000 (15:03 +0000)]
Merge #10598
10598: minor: Remove obsolete test module r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 20 Oct 2021 15:03:09 +0000 (17:03 +0200)]
Remove obsolete test module
bors[bot] [Wed, 20 Oct 2021 14:46:28 +0000 (14:46 +0000)]
Merge #10597
10597: fix: Fix standard library doclinks not going to the correct page r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10082
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 20 Oct 2021 14:21:33 +0000 (16:21 +0200)]
Fix standard library doclinks not going to the correct page
bors[bot] [Wed, 20 Oct 2021 12:05:54 +0000 (12:05 +0000)]
Merge #10594
10594: fix: Generate and complete rustdoc lints r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10572, https://github.com/rust-analyzer/rust-analyzer/issues/8349
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 20 Oct 2021 12:03:41 +0000 (14:03 +0200)]
Fix qualified lint completions ignoring the qualifier value
Lukas Wirth [Wed, 20 Oct 2021 11:48:05 +0000 (13:48 +0200)]
Generate rustdoc lints
bors[bot] [Tue, 19 Oct 2021 14:53:00 +0000 (14:53 +0000)]
Merge #10589
10589: Fix: expand into {} if the glob import is unused r=lnicola a=rainy-me
close #10524
I think the second `expand into {}` behavior is genuinely better. (maybe this should been labeled with good first issue xd)
Co-authored-by: rainy-me <github@yue.coffee>
rainy-me [Tue, 19 Oct 2021 14:46:43 +0000 (23:46 +0900)]
Fix: remove extra newline
rainy-me [Tue, 19 Oct 2021 14:31:30 +0000 (23:31 +0900)]
Fix: expand glob import to empty braces if the glob is unused
bors[bot] [Tue, 19 Oct 2021 12:57:24 +0000 (12:57 +0000)]
Merge #10568
10568: fix(assist): fix #10566 and #10567 r=bnjjj a=bnjjj
close #10566
close #10567
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Benjamin Coenen [Tue, 19 Oct 2021 09:21:55 +0000 (11:21 +0200)]
fix(assist): delete trailing whitespaces
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
bors[bot] [Tue, 19 Oct 2021 12:32:30 +0000 (12:32 +0000)]
Merge #10588
10588: internal: Parse const trait bounds r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10582
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Tue, 19 Oct 2021 12:15:47 +0000 (14:15 +0200)]
internal: Parse const trait bounds
bors[bot] [Tue, 19 Oct 2021 12:16:30 +0000 (12:16 +0000)]
Merge #10587
10587: fix: Fix `add_missing_match_arm` panicking on failed upmapping r=Veykril a=Veykril
Closes https://github.com/rust-analyzer/rust-analyzer/issues/10580#issuecomment-
946170475
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Tue, 19 Oct 2021 12:00:24 +0000 (14:00 +0200)]
fix: Fix add_missing_match_arm panicking
bors[bot] [Tue, 19 Oct 2021 11:51:07 +0000 (11:51 +0000)]
Merge #10586
10586: internal: Derive completions work on hir, not names r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Tue, 19 Oct 2021 11:50:08 +0000 (13:50 +0200)]
Derive completions work on hir, not names
bors[bot] [Tue, 19 Oct 2021 11:43:08 +0000 (11:43 +0000)]
Merge #10585
10585: fix: Resolve derive attributes even when shadowed r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Tue, 19 Oct 2021 11:40:27 +0000 (13:40 +0200)]
Resolve derive attributes even when shadowed
bors[bot] [Mon, 18 Oct 2021 12:56:33 +0000 (12:56 +0000)]
Merge #10578
10578: Fix partialord codegen take 2 r=lnicola a=yoshuawuyts
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10576. This reverts "generate `PartialOrd` to our previous match-based design, and in turn uses that to correctly take references for multi-value comparisons. This is a bit more verbose, but it should be more readable and easier to edit by end-users than multiple nested layers of borrows. I also manually verified every example in the Rust playground to ensure it works. Thanks!
cc/ `@WaffleLapkin`
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Yoshua Wuyts [Mon, 18 Oct 2021 12:45:24 +0000 (14:45 +0200)]
fix Ordering::Equal path
Yoshua Wuyts [Mon, 18 Oct 2021 12:38:53 +0000 (14:38 +0200)]
Revert "Simplify generated PartialOrd code"
This reverts commit
601ed3a10dacc2ba2ee0ca436c23529ae7fde292 .
bors[bot] [Mon, 18 Oct 2021 10:47:04 +0000 (10:47 +0000)]
Merge #10574
10574: fix: Fix PartialOrd codegen r=lnicola a=yoshuawuyts
Closes https://github.com/rust-analyzer/rust-analyzer/issues/10571#issuecomment-
945516462 . Thanks!
r? `@lnicola`
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Yoshua Wuyts [Mon, 18 Oct 2021 10:43:53 +0000 (12:43 +0200)]
Fix PartialOrd codegen
bors[bot] [Mon, 18 Oct 2021 09:59:10 +0000 (09:59 +0000)]
Merge #10551
10551: Pull in new lsp-types for VS compat r=lnicola a=lnicola
CC #8729
Depends on https://github.com/gluon-lang/lsp-types/pull/218
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Fri, 15 Oct 2021 17:28:28 +0000 (20:28 +0300)]
Fix tests
Laurențiu Nicola [Thu, 14 Oct 2021 06:37:57 +0000 (09:37 +0300)]
Pull in new lsp-types for VS compat
bors[bot] [Sun, 17 Oct 2021 21:05:10 +0000 (21:05 +0000)]
Merge #10569
10569: fix: Skip non clippy completions when completing a clippy path r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 17 Oct 2021 21:04:38 +0000 (23:04 +0200)]
Skip non clippy completions when completing a clippy path
Benjamin Coenen [Sun, 17 Oct 2021 18:24:40 +0000 (20:24 +0200)]
fix(assist): fix #10566 and #10567
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
bors[bot] [Sun, 17 Oct 2021 13:32:35 +0000 (13:32 +0000)]
Merge #10417
10417: feat(assist): add new assist to unwrap the result return type r=bnjjj a=bnjjj
do the opposite of assist "wrap the return type in Result"
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
Coenen Benjamin [Sun, 17 Oct 2021 13:24:20 +0000 (15:24 +0200)]
Update crates/ide_assists/src/handlers/unwrap_result_return_type.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
bors[bot] [Sun, 17 Oct 2021 11:30:49 +0000 (11:30 +0000)]
Merge #10562
10562: fix: Fix clippy attribute completions always prefixing inserting `clippy::` r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7144
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 17 Oct 2021 10:58:37 +0000 (12:58 +0200)]
Fix clippy attribute completions always prefixing with `clippy::`
Lukas Wirth [Sun, 17 Oct 2021 10:44:41 +0000 (12:44 +0200)]
Make attribute completions more ast based
Lukas Wirth [Sun, 17 Oct 2021 09:15:56 +0000 (11:15 +0200)]
Reorder CompletionContext functions
bors[bot] [Sun, 17 Oct 2021 09:00:06 +0000 (09:00 +0000)]
Merge #10561
10561: internal: Don't turn local names into strings in CompletionContext r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 17 Oct 2021 08:59:06 +0000 (10:59 +0200)]
Don't turn local names into strings in CompletionContext
bors[bot] [Sat, 16 Oct 2021 21:57:36 +0000 (21:57 +0000)]
Merge #10558
10558: internal: Refactor lifetime completion context fields r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 16 Oct 2021 21:56:43 +0000 (23:56 +0200)]
internal: Refactor lifetime completion context fields
bors[bot] [Sat, 16 Oct 2021 21:33:55 +0000 (21:33 +0000)]
Merge #10557
10557: fix: Fix qualified path completion not completing macros r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 16 Oct 2021 21:33:09 +0000 (23:33 +0200)]
fix: Fix qualified path completion not completing macros
bors[bot] [Sat, 16 Oct 2021 14:21:35 +0000 (14:21 +0000)]
Merge #10556
10556: minor: more clippy fixes r=Veykril a=Milo123459
just a few more clippy fixes
Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
Milo [Sat, 16 Oct 2021 14:02:56 +0000 (15:02 +0100)]
fix
Milo [Sat, 16 Oct 2021 13:15:17 +0000 (14:15 +0100)]
add a comment
Milo [Sat, 16 Oct 2021 13:13:43 +0000 (14:13 +0100)]
revert
Milo [Sat, 16 Oct 2021 11:32:55 +0000 (12:32 +0100)]
more clippy fixes
bors[bot] [Sat, 16 Oct 2021 10:28:46 +0000 (10:28 +0000)]
Merge #10542
10542: Use workspace cargo to fetch rust source's metadata r=lnicola a=Alexendoo
Previously the detected cargo is the global one, as it uses the
directory of the rust source which doesn't pick up the local override
This fixes the case in clippy where the local rust toolchain is a recent
nightly that has a 2021 edition Cargo.toml. The global (stable) cargo
returns an error attempting to parse it
Fixes #10445
Co-authored-by: Alex Macleod <alex@macleod.io>
bors[bot] [Sat, 16 Oct 2021 10:17:15 +0000 (10:17 +0000)]
Merge #10555
10555: minor: Hide private methods in `generate_delegate_methods` r=lnicola a=lnicola
Fixes #10553
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Sat, 16 Oct 2021 10:09:53 +0000 (13:09 +0300)]
Hide private methods in `generate_delegate_methods`
bors[bot] [Fri, 15 Oct 2021 17:29:03 +0000 (17:29 +0000)]
Merge #10552
10552: fix: Fix missing_fields diagnostic fix replacing wrong text ranges r=Veykril a=Veykril
Fixes #5393 by replacing the problematic behaviour there with a new "problem"
It replaces the correct range now, but it potentially discards the whitespace in the macro input. This is the best we can do currently until we get a formatter.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Fri, 15 Oct 2021 17:27:19 +0000 (19:27 +0200)]
Fix missing_fields diagnostic fix replacing wrong text ranges
bors[bot] [Fri, 15 Oct 2021 16:05:15 +0000 (16:05 +0000)]
Merge #10543
10543: Narrow add_missing_match_arms assist range r=Veykril a=antonfirsov
Contributes to #10220 with logic borrowed from #10267.
Note: if anyone has recommendations for further analyzers to check, I'm happy to (hard to do it on my own, I'm completely new to the language).
Co-authored-by: Anton Firszov <antonfir@gmail.com>
Anton Firszov [Fri, 15 Oct 2021 15:53:01 +0000 (17:53 +0200)]
cov_mark for add_missing_match_arms special cases
Anton Firszov [Fri, 15 Oct 2021 12:45:11 +0000 (14:45 +0200)]
undo unnecessary test changes
Anton Firszov [Fri, 15 Oct 2021 12:36:37 +0000 (14:36 +0200)]
cosmetics
Anton Firszov [Fri, 15 Oct 2021 12:30:38 +0000 (14:30 +0200)]
update generated.rs
Anton Firszov [Fri, 15 Oct 2021 12:14:21 +0000 (14:14 +0200)]
fix sample + cosmetics + one more test
Anton Firszov [Fri, 15 Oct 2021 11:19:46 +0000 (13:19 +0200)]
simple implementation
bors[bot] [Fri, 15 Oct 2021 11:16:10 +0000 (11:16 +0000)]
Merge #10549
10549: minor: Update crates r=lnicola a=kjeremy
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Jeremy Kolb [Fri, 15 Oct 2021 11:12:30 +0000 (07:12 -0400)]
Update crates
Anton Firszov [Fri, 15 Oct 2021 10:15:52 +0000 (12:15 +0200)]
cursor_inside_simple_match_arm_list -- tests
bors[bot] [Thu, 14 Oct 2021 22:41:06 +0000 (22:41 +0000)]
Merge #10491
10491: Support nested type on replace if let with match r=k-nasa a=k-nasa
## Why
close: https://github.com/rust-analyzer/rust-analyzer/issues/8690
Now, Replacing if-let with match cant't output exhaustive patterns code.
This was because the `else` conversion used specific types (ex. Option, Result) instead of wildcards.
I thought it was more of a problem to generate non-exhaustive patterns than the benefits of using the concrete one.
How about using wildcards in `else`?
Is this change policy acceptable?
## What
- using wildcards on `make_else_arm`
- Change test cases
Co-authored-by: k-nasa <htilcs1115@gmail.com>
bors[bot] [Thu, 14 Oct 2021 20:10:59 +0000 (20:10 +0000)]
Merge #10545
10545: A few clippy fixes r=Veykril a=Milo123459
A few clippy fixes
Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
bors[bot] [Thu, 14 Oct 2021 19:51:34 +0000 (19:51 +0000)]
Merge #10546
10546: feat: Implement promote_local_to_const assist r=Veykril a=Veykril
Fixes #7692, that is now one can invoke the `extract_variable` assist on something and then follow that up with this assist to turn it into a const.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Thu, 14 Oct 2021 19:49:46 +0000 (21:49 +0200)]
Implement promotoe_local_to_const assist
Milo [Thu, 14 Oct 2021 18:57:21 +0000 (19:57 +0100)]
a few clippy fixes
Anton Firszov [Thu, 14 Oct 2021 18:45:10 +0000 (20:45 +0200)]
use ctx.selection_trimmed() instead of ctx.frange.range
Anton Firszov [Thu, 14 Oct 2021 18:38:06 +0000 (20:38 +0200)]
apply formatting recommendations
Anton Firszov [Thu, 14 Oct 2021 18:35:59 +0000 (20:35 +0200)]
update generated.rs
Anton Firszov [Thu, 14 Oct 2021 18:31:33 +0000 (20:31 +0200)]
make it work from macro
bors[bot] [Thu, 14 Oct 2021 18:16:17 +0000 (18:16 +0000)]
Merge #10539
10539: Add "generate delegate methods" assist r=Veykril a=yoshuawuyts
_Co-authored with `@rylev_.`
This patch adds a new assist: "generate delegate method" which creates a method that calls to a method defined on an inner field. Delegation is common when authoring newtypes, and having IDE support for this is the best way we can make this easier to author in Rust, bar adding language-level support for it. Thanks!
Closes #5944.
## Example
__before__
```rust
struct Age(u8);
impl Age {
fn age(&self) -> u8 {
self.0
}
}
struct Person {
ag$0e: Age,
}
```
__after__
```rust
struct Age(u8);
impl Age {
fn age(&self) -> u8 {
self.0
}
}
struct Person {
age: Age,
}
impl Person {
$0fn age(&self) -> u8 {
self.age.age()
}
}
```
Co-authored-by: Ryan Levick <me@ryanlevick.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Anton Firszov [Thu, 14 Oct 2021 17:31:27 +0000 (19:31 +0200)]
apply necessary test changes
Yoshua Wuyts [Thu, 14 Oct 2021 16:33:29 +0000 (18:33 +0200)]
fix ret type in generic
Yoshua Wuyts [Thu, 14 Oct 2021 16:19:20 +0000 (18:19 +0200)]
implement feedback from review
Anton Firszov [Thu, 14 Oct 2021 16:15:00 +0000 (18:15 +0200)]
Narrow add_missing_match_arms assist range
Alex Macleod [Thu, 14 Oct 2021 14:40:57 +0000 (15:40 +0100)]
Use workspace cargo to fetch rust source's metadata
Previously the detected cargo is the global one, as it uses the
directory of the rust source which doesn't pick up the local override
This fixes the case in clippy where the local rust toolchain is a recent
nightly that has a 2021 edition Cargo.toml. The global (stable) cargo
returns an error attempting to parse it
Fixes #10445
Yoshua Wuyts [Thu, 14 Oct 2021 12:18:12 +0000 (14:18 +0200)]
Add support for tuple structs
bors[bot] [Thu, 14 Oct 2021 11:57:16 +0000 (11:57 +0000)]
Merge #10517
10517: Show cargo check failures to the user r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10515
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Thu, 14 Oct 2021 11:53:25 +0000 (13:53 +0200)]
Kill the child process before waiting in streaming_output
Yoshua Wuyts [Thu, 14 Oct 2021 11:52:31 +0000 (13:52 +0200)]
Update label names
bors[bot] [Thu, 14 Oct 2021 11:50:14 +0000 (11:50 +0000)]
Merge #10538
10538: fix: matching brace should prefer brace on cursor's right r=Veykril a=codgician
I observed a brace matching issue with the following Rust code:
```rust
let x = (1 + (2 + 3)) * 4;
```
In a situation like `<|>(1 + (2 + 3)) * 4`, the cursor will go to `(1 + (2 + 3)<|>) * 4`, and if user tries to match bracket again it will go like `(1 + <|>(2 + 3)) * 4` while logically the expected result should be `<|>(1 + (2 + 3)) * 4`. This behavior exists in both line cursor style and block cursor style.
This PR fixes this by letting `matching_brace` prefer the brace to cursor's right when the cursor lies between multiple consecutive braces. It **does NOT** fix #1942 but could be related. Please review.
Co-authored-by: codgician <15964984+codgician@users.noreply.github.com>
bors[bot] [Thu, 14 Oct 2021 11:42:53 +0000 (11:42 +0000)]
Merge #10503
10503: Only include targets of packages that are workspace members r=Veykril a=bcully
CargoWorkspace's package list includes packages that are path
dependencies, even if those packages aren't actually members of the
cargo workspace. As a result, rust-analyzer's runnable finder, which
returns the target from the first workspace that has a matching package,
may select the wrong working directory, causing runnables to fail, e.g.,
```
error: package `root` cannot be tested because it requires dev-dependencies and is not a member of the workspace
```
To fix this, we filter out packages that aren't members of the workspace
when searching for targets.
Fixes #7764
Co-authored-by: Brendan Cully <brendan@cully.org>
Yoshua Wuyts [Thu, 14 Oct 2021 11:23:46 +0000 (13:23 +0200)]
Enable delegation generation for complex types
bors[bot] [Thu, 14 Oct 2021 10:56:08 +0000 (10:56 +0000)]
Merge #10434
10434: Allow `Locate parent module` command in Cargo.toml r=Veykril a=rainy-me
close #10355
Co-authored-by: rainy-me <github@rainy.me>
Co-authored-by: rainy-me <github@yue.coffee>
bors[bot] [Thu, 14 Oct 2021 10:47:11 +0000 (10:47 +0000)]
Merge #10309
10309: use `ControlFlow` in "extract function" assist r=Veykril a=dzvon
Fixes #10272
Co-authored-by: Dezhi Wu <wu543065657@163.com>
Yoshua Wuyts [Thu, 14 Oct 2021 10:34:31 +0000 (12:34 +0200)]
Get a make version working!
codgician [Thu, 14 Oct 2021 06:15:56 +0000 (14:15 +0800)]
Matching brace prefers brace on cursor's right
bors[bot] [Thu, 14 Oct 2021 05:57:31 +0000 (05:57 +0000)]
Merge #10537
10537: minor: Document rustc source auto-discovery r=lnicola a=lnicola
CC #10521
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Thu, 14 Oct 2021 05:49:22 +0000 (08:49 +0300)]
Document rustc source auto-discovery
rainy-me [Wed, 13 Oct 2021 22:16:42 +0000 (07:16 +0900)]
Provide navigations to parent modules
Yoshua Wuyts [Wed, 13 Oct 2021 21:59:23 +0000 (23:59 +0200)]
Update generate_delegate.rs
Yoshua Wuyts [Wed, 13 Oct 2021 18:13:36 +0000 (20:13 +0200)]
create function
Ryan Levick [Wed, 13 Oct 2021 13:08:40 +0000 (15:08 +0200)]
Add basic support for delegation
k-nasa [Wed, 13 Oct 2021 14:07:49 +0000 (23:07 +0900)]
fix
Dezhi Wu [Wed, 13 Oct 2021 13:24:17 +0000 (21:24 +0800)]
merge use statement
Dezhi Wu [Wed, 13 Oct 2021 13:19:41 +0000 (21:19 +0800)]
resolve `ControlFlow` ourself instead of hard coding.