Commit Graph

358 Commits

Author SHA1 Message Date
Aleksey Kladov
afacdd612d internal: update expect 2021-10-09 17:17:16 +03:00
bors[bot]
f30b62b751
Merge #10479
10479: fix: fix "index out of bounds" panic in name resolution r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/10084
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9163

This is really just a salsa update to a version that removes the problematic code (see https://github.com/rust-analyzer/rust-analyzer/issues/10084#issuecomment-934445711)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-06 20:54:27 +00:00
Jonas Schievink
cda9668289 Update salsa 2021-10-06 22:42:54 +02:00
crauzer
05e58afde2 Add replace_try_expr_with_match assist 2021-10-06 20:11:00 +02:00
bors[bot]
86c534f244
Merge #10440
10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg

I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537](https://github.com/rust-lang/rust-clippy/issues/5537) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159)), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn.

I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely.

Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-05 08:58:40 +00:00
Aramis Razzaghipour
f29796da61
Replace if let Some(_) = foo with if foo.is_some() 2021-10-05 09:00:18 +11:00
bors[bot]
e28aa1928b
Merge #10439
10439: fix: fix insert_use incorrectly merging glob imports r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6800
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-03 12:19:02 +00:00
Lukas Wirth
5b0c91d118 fix: fix insert_use incorrectly merging glob imports 2021-10-03 14:06:44 +02:00
Lukas Wirth
e684235329 Move module private logic down 2021-10-03 13:52:40 +02:00
bors[bot]
ebe6c38a44
Merge #10438
10438: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-03 11:06:06 +00:00
Lukas Wirth
0943c4be8b minor: Simplify 2021-10-03 13:05:42 +02:00
Lukas Wirth
86e5406539 Fix rename trying to edit the same range multiple times 2021-10-02 18:50:21 +02:00
Aleksey Kladov
46eb03d99a internal: use naming that matches intended use-case 2021-10-02 12:18:18 +03:00
Lucas
6606b49710
Reduce allocation in builtin_crates
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-01 01:56:30 +10:00
lhvy
2b3baa8503
Give defaultLibrary semantic token modifier to items from standard library 2021-10-01 01:19:24 +10:00
Lukas Wirth
774a8cf08b Fix inline_call breaking RecordExprField shorthands 2021-09-28 19:22:32 +02: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
bors[bot]
c51a3c78cf
Merge #10358
10358: internal: Remove inherent methods from ast nodes that do non-syntactic complex tasks  r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-26 14:49:25 +00:00
Lukas Wirth
151afdfe5c Remove inherent methods from ast node that carry semantic meaning 2021-09-26 16:49:03 +02:00
Lukas Wirth
215a077ee4 Remove imports when inlining all calls in a file 2021-09-26 16:01:54 +02:00
Lukas Wirth
1a50f904ef Reject recursive calls in inline_call 2021-09-26 14:55:03 +02:00
Lukas Wirth
42eb4efb5b Cleanup 2021-09-23 16:28:03 +02:00
hamidreza kalbasi
589c1dfa04 move function to defs.rs 2021-09-22 18:35:54 +03:30
Aleksey Kladov
73b0f9dc04 internal: remove dead code 2021-09-15 21:22:06 +03:00
Lukas Wirth
6f9de71402 fix: Use original definition ranges for ide_db::search instead of the expanded ranges 2021-09-14 02:49:06 +02:00
toyboot4e
89e46b40c3 Minor: replace old name CrateDefMap 2021-09-05 19:22:34 +09:00
Lukas Wirth
e2ede38d47 Use correct search scopes for macros 2021-09-02 17:30:55 +02:00
Jonas Schievink
bdba35cc93 fix: multi-token mapping aware find references 2021-09-01 19:19:16 +02:00
Lukas Wirth
68bf359363 fix: make goto_implementation multi-token mapping aware 2021-09-01 14:51:37 +02:00
Dezhi Wu
ba0947dded switch log crate to tracing 2021-08-30 15:11:42 +08:00
Aleksey Kladov
78365c64c8 internal: slightly improve compile times
As per style guide, avoid monomorphisations
2021-08-29 12:53:56 +03:00
Lukas Wirth
99f1e66997 Only report unique text ranges in highlight_related 2021-08-29 01:11:29 +02:00
Lukas Wirth
72bfbb0691 Return all usages inside macros in usage searches 2021-08-29 00:49:57 +02:00
Lukas Wirth
512135920d Highlight all related tokens in macro inputs 2021-08-29 00:49:57 +02:00
Jonas Schievink
002ef7d50a Use ManuallyDrop in RootDatabase 2021-08-28 23:05:40 +02:00
Lukas Wirth
c67ecbebc4 Rename fails on renaming definitions created by macros 2021-08-20 00:12:47 +02:00
Lukas Wirth
daf3094958 Emit more concise text edits in ide_db::rename 2021-08-17 15:24:01 +02:00
Lukas Wirth
995c8f50a2 some code docs for the ide_db/rename module 2021-08-16 23:06:51 +02:00
Lukas Wirth
5e533e5900 Handle all rename special cases for all record pattern fields 2021-08-16 22:48:38 +02:00
Lukas Wirth
894a09b749 Simplify 2021-08-14 18:02:51 +02:00
Aleksey Kladov
90357a9090 internal: merge hir::BinaryOp and ast::BinOp 2021-08-14 18:10:01 +03:00
Lukas Wirth
7e6eb67f0d Substitute generic types in inline_call 2021-08-10 14:39:56 +02:00
Lukas Wirth
b7d7dd6163 Implement bool_then_to_if assist 2021-08-10 13:17:45 +02:00
Michał Muskała
33c7c23b03 Remove unused structs in ide_db 2021-08-05 12:04:37 +01:00
Jade
e3a67ccec6 tree-wide: fix rustdoc warnings, add some links 2021-08-03 21:34:20 -07: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
Lukas Wirth
1edbaa29f9 Wrap inner tail expressions in MissingOkOrSomeInTailExpr 2021-07-31 20:00:09 +02:00