rust/crates
bors 3b1b58c225 Auto merge of #15662 - rmehri01:fix_panic_with_return_in_match, r=Veykril
fix: panic with wrapping/unwrapping result return type assists

With the `wrap_return_type_in_result` assist, the following code results in a panic (note the lack of a semicolon):

```rust
fn foo(num: i32) -> $0i32 {
    return num
}

=>

thread 'handlers::wrap_return_type_in_result::tests::wrap_return_in_tail_position' panicked at crates/syntax/src/ted.rs:137:41:
called `Option::unwrap()` on a `None` value
```

I think this is because it first walks the body expression to change any `return` expressions and then walks all tail expressions, resulting in the `return num` being changed twice since it is both a `return` and in tail position. This can also happen when a `match` is in tail position and `return` is used in a branch for example. Not really sure how big of an issue this is in practice though since this seems to be the only case that is impacted and can be reduced to just `num` instead of `return num`.

This also occurs with the `unwrap_result_return_type` assist but panics with the following instead:

```
thread 'handlers::unwrap_result_return_type::tests::wrap_return_in_tail_position' panicked at /rustc/3223b0b5e8dadda3f76c3fd1a8d6c5addc09599e/library/alloc/src/string.rs:1766:29:
assertion failed: self.is_char_boundary(n)
```
2023-09-26 14:18:33 +00:00
..
base-db minor: hover_simple refactor 2023-09-24 22:47:29 +02:00
cfg Fix cfg completions not working 2023-09-08 10:49:15 +02:00
flycheck refactor: remove boxing 2023-09-20 23:02:52 +09:00
hir Add unused_variables native diagnostic 2023-09-24 21:29:15 +03:30
hir-def Auto merge of #15652 - Veykril:format_to, r=lnicola 2023-09-22 09:06:06 +00:00
hir-expand Emit builtin#format_args in builtin format_args expander 2023-09-06 18:08:20 +02:00
hir-ty Fix unused_variables in tests 2023-09-24 23:45:36 +03:30
ide Auto merge of #15659 - HKalbasi:unused-var, r=HKalbasi 2023-09-25 06:38:14 +00:00
ide-assists Auto merge of #15662 - rmehri01:fix_panic_with_return_in_match, r=Veykril 2023-09-26 14:18:33 +00:00
ide-completion split detail function 2023-09-23 19:43:19 -03:00
ide-db minor: hover_simple refactor 2023-09-24 22:47:29 +02:00
ide-diagnostics Fix unused_variables in tests 2023-09-24 23:45:36 +03:30
ide-ssr
intern refactor: fix clippy lints 2023-09-15 16:43:21 +09:00
limit
load-cargo
mbe
parser Auto merge of #15615 - shogo-nakano-desu:refactor/fix-clippy-lints, r=Veykril 2023-09-22 06:46:29 +00:00
paths
proc-macro-api
proc-macro-srv
proc-macro-srv-cli
proc-macro-test
profile
project-model Auto merge of #15560 - davidbarsky:davidbarsky/use-sysroot-rustc-to-determine-cfgs, r=Veykril 2023-09-08 18:14:25 +00:00
rust-analyzer Auto merge of #15582 - vxpm:master, r=HKalbasi 2023-09-24 07:38:38 +00:00
rustc-dependencies Switch to in-tree rustc dependencies with a cfg flag 2023-09-15 18:10:11 +03:30
sourcegen
stdx Various small fixes 2023-09-22 10:13:51 +02:00
syntax Simplify 2023-09-26 12:25:59 +02:00
test-utils Fix unused_variables in tests 2023-09-24 23:45:36 +03:30
text-edit
toolchain
tt
vfs Ensure resolved hint's file exists 2023-09-02 18:28:36 +03:00
vfs-notify Update notify to 6.1.1 2023-09-04 18:00:12 +02:00