Commit Graph

18940 Commits

Author SHA1 Message Date
Johann Hemmann
4184c6af0d collapsible_match 2024-01-19 17:31:00 +01:00
Johann Hemmann
657376858f iter_kv_map 2024-01-19 17:31:00 +01:00
Johann Hemmann
b5eca5f2fc collapsible_if 2024-01-19 17:31:00 +01:00
Johann Hemmann
3409645c3f bind_instead_of_map 2024-01-19 17:31:00 +01:00
bors
2a239b9833 Auto merge of #16401 - Urhengulas:lint-table, r=Veykril
Expand lint tables && make clippy happy 🎉

This PR expands the lint tables on `./Cargo.toml` and thereby makes `cargo clippy` exit successfully! 🎉

Fixes #15918

## How?

In the beginning there are some warnings for rustc.

Next, and most importantly, there is the clippy lint table. There are a few sections in there.

First there are the lint groups.

Second there are all lints which are permanently allowed with the reasoning why they are allowed.

Third there is a huge list of temporarily allowed lints. They should be removed in the mid-term, but incur a substantial amount of work, therefore they are allowed for now and can be worked on bit by bit.

Fourth there are all lints which should warn.

Additionally there are a few allow statements in the code for lints which should be permanently allowed in this specific place, but not in the whole code base.

## Follow up work
- [ ] Run clippy in CI
- [ ] Remove tidy test (at least `@Veykril` wrote this in #15017)
- [ ] Work on temporarily allowed lints
2024-01-19 16:09:02 +00:00
bors
04edfa1e5a Auto merge of #16388 - Veykril:fn-abi, r=Veykril
internal: Record FnAbi

This unfortunately breaks our lub coercions, so will need to look into fixing that first, though I am not sure what is going wrong where...

Stubbed some stuff out for the time being.
2024-01-19 14:37:58 +00:00
bors
03d4a6dd9a Auto merge of #16400 - alibektas:15656/update_bail_message_ref_config, r=Veykril
Update bail message referencing config

Even though we changed the name of the config I forgot to update the warning message that referenced it.
2024-01-19 14:19:11 +00:00
Lukas Wirth
46e38318a2 Stub out FnAbi::partial_eq as a workaround for now 2024-01-19 15:15:23 +01:00
Lukas Wirth
3a722bdf2e feat:Record FnAbi 2024-01-19 15:15:23 +01:00
Ali Bektas
0347f81244 Update tests 2024-01-19 15:01:46 +01:00
Ali Bektas
0becb6c819
Update crates/ide-db/src/rename.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2024-01-19 14:33:40 +01:00
Johann Hemmann
3041164301 Temporarily allow all lints which occur
They will be removed one by one
2024-01-19 12:52:12 +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
Ali Bektas
431040fe59 Update bail message referencing config
Even though we changed the name of the config I forgot
to update the warning message that referenced it.
2024-01-18 22:29:36 +01:00
bors
3f4c6dac3d Auto merge of #16372 - davidsemakula:import-granularity-one, r=Veykril
feat: Add "One" import granularity

Adds a new import granularity option "One" that merges all imports into a single use statement as long as they have the same visibility and attributes.

This is similar to [rustfmt's `imports_granularity = "One"`](https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=import#imports_granularity).

Fixes: #11361
2024-01-18 15:40:12 +00:00
davidsemakula
67c1c2bd14 update merge item assist implementation for "one" import granularity 2024-01-18 17:26:53 +03:00
bors
48af3ef66d Auto merge of #16397 - Urhengulas:refactor-parser, r=Veykril
Refactor `macro_call` to be consistent with other functions

https://github.com/rust-lang/rust-analyzer/pull/16314#discussion_r1457324734
2024-01-18 14:11:58 +00:00
bors
6d3141679d Auto merge of #16385 - Urhengulas:fix-tra-doc-links, r=Veykril
Fix intra doc links

Fixes #15848
2024-01-18 14:00:35 +00:00
bors
a5b89fffb6 Auto merge of #16391 - alibektas:15656/renaming_allowed_by_config, r=Veykril
Add a new config to allow renaming of non-local defs

With #15656 we started disallowing renaming of non-local items. Although this makes sense there are some false positives that impacted users' workflows. So this config aims to mitigate this by giving users the liberty to disable this feature.

The reason why this is a draft is that I saw one of the tests fail and I am not sure if the "got" result even syntactically makes sense

Test case is :

```rust
check(
            "Baz",
            r#"
//- /lib.rs crate:lib new_source_root:library
pub struct S;
//- /main.rs crate:main deps:lib new_source_root:local
use lib::S$0;
"#,
            "use lib::Baz;"
);
```

```
Left:
use lib::Baz;

Right:
use lib::Baz;Baz

Diff:
use lib::Baz;Baz
```
2024-01-18 13:49:14 +00:00
Johann Hemmann
255cde788b Fix CI 3 2024-01-18 14:22:20 +01:00
Johann Hemmann
28c7fa8dc6 Fix CI 2 2024-01-18 14:18:07 +01:00
Johann Hemmann
2185396481 Fix CI 2024-01-18 14:11:30 +01:00
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01:00
Johann Hemmann
c81728634b Handle intra-doc links with anchor 2024-01-18 13:36:11 +01:00
Johann Hemmann
bfc2e568dd Add tests for intra-doc links
The first one succeeds because the functionality is already implemented.
The second one fails and represents the functionality to be implemented
in this PR.
2024-01-18 12:59:43 +01:00
Johann Hemmann
f913d4f4b7 Refactor if-else 2024-01-18 12:59:43 +01:00
Johann Hemmann
b599de193f Refactor macro_call to be consistent with other functions 2024-01-18 12:50:36 +01:00
Ali Bektas
21020919e3 v2 2024-01-18 12:09:23 +01:00
bors
1ab8c7fd27 Auto merge of #16349 - Young-Flash:use_error_recovery, r=Veykril
fix: add error recovery for use_tree_list parsing

This PR adds error recovery for USE_TREE_LIST parsing, avoid the wrong USE_TREE_LIST making the rest parsing incorrectly.

before

![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/c6643690-f25c-4ad9-93d9-e661ba5b1dc3)

after

![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/30a58c40-2711-48d2-b2e5-fb208fc8636c)

close https://github.com/rust-lang/rust-analyzer/issues/16227
2024-01-18 09:52:37 +00:00
Lukas Wirth
507448652a Fix rename test fixtures not accounting for multi file edits 2024-01-18 10:47:02 +01:00
Young-Flash
1c61326ca0 add use_tree_completion test 2024-01-18 17:35:01 +08:00
bors
2dfa9b86d0 Auto merge of #16384 - Veykril:smolstr, r=Veykril
minor: Make use of some new `SmolStr` improvements
2024-01-18 09:30:45 +00:00
roife
04ce4ce440 internal: speedup LineEndings calculation using 'memchr' 2024-01-18 17:03:29 +08:00
Ali Bektas
9bd9a17ce5 Add a new config to allow renaming of non-local items
With #15656 we started disallowing renaming of non-local items.
Although this makes sense there are some false positives that
impacted users' workflows. So this config aims to mitigate this
by giving users the liberty to disable this feature.
2024-01-18 00:26:22 +01: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
davidsemakula
57d4b5bb0f add "one" import granularity 2024-01-18 01:44:57 +03:00
davidsemakula
84a3b52a10 properly order raw idents when ordering use trees 2024-01-17 21:46:19 +03:00
Lukas Wirth
83591268ab minor: Make use of some new SmolStr improvements 2024-01-17 13:47:15 +01:00
bors
5b62ebc23f Auto merge of #16383 - Veykril:progress, r=Veykril
fix: Fix progress reporting getting stuck

Fixes https://github.com/rust-lang/rust-analyzer/issues/16382
2024-01-17 12:24:43 +00:00
Lukas Wirth
0bdbf497b6 fix: Fix progress reporting getting stuck 2024-01-17 13:23:00 +01:00
Johann Hemmann
76c67dd229 Fix test 2024-01-17 12:49:58 +01:00
Johann Hemmann
5916da2c29 Handle macro_rules! as MACRO_CALL
It's a call of the third token is neither IDENT or TRY
2024-01-17 12:07:17 +01:00
bors
2b02df27c5 Auto merge of #16380 - Veykril:sysroot-ci, r=Veykril
Run metadata on sysroot for CI metrics
2024-01-17 09:33:14 +00: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
Lukas Wirth
21723cb051 Run metadata on sysroot for CI metrics 2024-01-17 09:43:04 +01: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
Lukas Wirth
0a75a8c061 Notable traits for type info hovers 2024-01-16 20:15:31 +01:00
Lukas Wirth
ffeaee84af Goto type actions for notable trait hovers 2024-01-16 19:59:55 +01:00