Commit Graph

285 Commits

Author SHA1 Message Date
davidsemakula
2987fac76f diagnostic to remove trailing return 2024-02-08 19:32:53 +03:00
bors
0e5766b0d8 Auto merge of #16477 - davidsemakula:trait-incorrect-case-diagnostic, r=Veykril
feat: Add incorrect case diagnostics for traits and their associated items

Updates incorrect case diagnostic to:
- Check traits and their associated items
- Ignore trait implementations except for patterns in associated function bodies

Also cleans up `hir-ty::diagnostics::decl_check` a bit (mostly to make it a bit more DRY and easier to maintain)

Also fixes: #8675 and fixes: #8225
2024-02-08 14:40:16 +00:00
bors
e9d3565cd1 Auto merge of #16502 - davidsemakula:unnecessary-else-diagnostic, r=Veykril
feat: Add "unnecessary else" diagnostic and fix

Fixes #9457
2024-02-08 14:25:00 +00:00
Lukas Wirth
545382db25 Fix warnings 2024-02-08 14:54:52 +01:00
Lukas Wirth
91dab4d720 Better error message for when proc-macros have not yet been built 2024-02-08 14:53:12 +01:00
Lukas Wirth
4bf6b160a9 Fix incorrect range uses in missing_fields quick fixes 2024-02-08 14:53:11 +01:00
davidsemakula
d7a03022f7 handle divergence in child if expr for unnecessary else diagnostic fix 2024-02-06 19:00:10 +03:00
davidsemakula
62cc4f9c46 add unnecessary else diagnostic 2024-02-06 19:00:10 +03:00
davidsemakula
b45ee82811 incorrect case diagnostics for param names of trait impl assoc functions 2024-02-05 01:31:28 +03:00
davidsemakula
33b3b6dbf9 refactor: disable "unused" lint using parameter name 2024-02-05 01:07:44 +03:00
davidsemakula
46d79e21b5 add allow and deny attribute tests for incorrect case diagnostics for traits 2024-02-02 17:07:08 +03:00
davidsemakula
080d223dd4 incorrect case diagnostics for type aliases 2024-02-02 17:07:08 +03:00
davidsemakula
0ffc088439 no incorrect case diagnostics for trait impl assoc functions and consts except for pats in fn bodies 2024-02-02 17:07:08 +03:00
davidsemakula
6d2d6323ac incorrect case diagnostics for trait assoc functions and consts 2024-02-02 17:07:08 +03:00
davidsemakula
5fe3b75677 incorrect case diagnostics for trait name 2024-02-02 17:07:08 +03:00
Lukas Wirth
9e8a0fae0c Lint debug prints and disallowed types with clippy 2024-02-01 17:57:27 +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
Lukas Wirth
604479c373 internal: Use improved adjusted_display_range for all diagnostics 2024-01-31 09:16:30 +01: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
bors
7219414e81 Auto merge of #16427 - Young-Flash:fix_no_such_field_diagnostics, r=Veykril
fix: filter out cfg disabled filed when lowering `RecordPat`

we should filter out field with disabled cfg when lowering ast `RecordPat` to hir.

close https://github.com/rust-lang/rust-analyzer/issues/16169
2024-01-27 10:52:36 +00:00
bors
27c3ed9de8 Auto merge of #16434 - Veykril:things, r=Veykril
internal: Restructure and cleanup hir-expand a bit
2024-01-27 10:16:35 +00:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
Ar4ys
8f05e7ce55 Replaced adjusted_display_range with it's new version in mismatched_arg_count 2024-01-25 20:15:46 +01:00
Young-Flash
1374bc8c93 test: ensure no_such_field diagnostic don't work for field with disabled cfg 2024-01-25 19:30:04 +08: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
Johann Hemmann
fad4fa163c cargo clippy --fix 2024-01-18 13:59:49 +01: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
Zach
1aff8157bc Set experimental field at diagnostic new instead of lib 2024-01-10 05:58:25 -06:00
Zach
beeaaf184e Mark unresolved associated item diagnostic as experimental 2024-01-09 17:09:50 -06:00
Matthias Krüger
3fb2cd2002 autofix remaining perf findings 2024-01-07 01:20:20 +01:00
Matthias Krüger
196650dfaf don't to_string() format args 2024-01-07 01:11:57 +01:00
Matthias Krüger
476e10e961 remove redundant clones 2024-01-07 00:17:48 +01:00
bors
2980d54160 Auto merge of #16223 - Young-Flash:quickfix_redundant_assoc_item, r=Veykril
feat: add quickfix for redundant_assoc_item diagnostic

Happy New Year 😊

follow up https://github.com/rust-lang/rust-analyzer/pull/15990, now it's time to close https://github.com/rust-lang/rust-analyzer/issues/15958, closes https://github.com/rust-lang/rust-analyzer/issues/16269

![demo](https://github.com/rust-lang/rust-analyzer/assets/71162630/74022c52-1566-49a0-9be8-03b82f3e730f)

EDIT: add a demo.git would be more illustrated when making release change log.
2024-01-05 13:15:01 +00:00
Johann Hemmann
03b1ecd90d Replace only occurence of check_expect with check_diagnostics 2024-01-04 18:20:38 +01:00
Young-Flash
c5c1360f7b fix: make diagnostic range accommodate for macros 2024-01-03 22:05:30 +08:00
bors
426d2842c1 Auto merge of #16222 - rosefromthedead:unresolved-assoc-item, r=Veykril
add unresolved-assoc-item assist

I tried to copy from private-assoc-item for this
2024-01-02 15:06:13 +00:00
bors
86e559bf3f Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
Use Cargo's [workspace.lints.*] to config clippy

This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html).

By this change, we make the configure more readable and simplify `xargo lint` more.
2024-01-02 14:53:22 +00:00
Young-Flash
91bd59682a fix: make editing range accommodate for macros 2024-01-02 21:30:13 +08:00
Young-Flash
481fab1591 chore: add test case for assoc func fix in unresolved_method diagnostic 2024-01-02 20:53:41 +08:00
Young-Flash
69410bb488 feat: add assoc func quickfix for unresolved_method diagnostic 2024-01-02 20:53:41 +08:00
Young-Flash
4eb3d2e279 test: add test case for redundant_assoc_item quickfix 2024-01-01 11:19:12 +08:00
Young-Flash
613774e331 feat: add quickfix for redundant_assoc_item diagnostic 2024-01-01 11:17:06 +08:00
Rose Hudson
5878651e7e add unresolved-assoc-item diagnostic 2023-12-31 17:36:40 +00:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
Young-Flash
cc73c00d81 add test case for negative impl 2023-12-24 20:07:33 +08:00
Lukas Wirth
f49a2fed3f internal: Move out WithFixture into dev-dep only crate 2023-12-18 15:24:08 +01:00
Lukas Wirth
35620306a6 internal: Move proc-macro knowledge out of base-db 2023-12-18 12:37:18 +01:00
hkalbasi
7b9595a5ab Run rust-analyzer on rustc tests in metrics 2023-12-15 02:10:25 +03:30
hkalbasi
801c0ea478 Replace doc_comments_and_attrs with collect_attrs, 2nd round 2023-12-11 22:56:50 +03:30