mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Merge #10563
10563: feat: Make "Generate getter" assist use semantic info r=agluszak a=agluszak This PR makes "Generate getter" assist use semantic info instead of dealing with types encoded as strings. Getters for types which are: - `Copy` no longer return references - `AsRef<str>` (i.e. `String`) return `&str` (instead of `&String`) - `AsRef<[T]>` (i.e. `Vec<T>`) return `&[T]` (instead of `&Vec<T>`) - `AsRef<T>` (i.e. `Box<T>`) return `&T` (instead of `&Box<T>`) - `Option<T>` return `Option<&T>` (instead of `&Option<T>`) - `Result<T, E>` return `Result<&T, &E>` (instead of `&Result<T, E>`) String, Vec, Box and Option were previously handled as special cases. Closes #10295 Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
This commit is contained in:
commit
6877240fdf
9 changed files with 386 additions and 62 deletions
|
@ -2268,8 +2268,8 @@ fn foo() {
|
|||
file_id: FileId(
|
||||
1,
|
||||
),
|
||||
full_range: 254..436,
|
||||
focus_range: 293..299,
|
||||
full_range: 276..458,
|
||||
focus_range: 315..321,
|
||||
name: "Future",
|
||||
kind: Trait,
|
||||
description: "pub trait Future",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue