rust-lang / rust-lang/rust-analyzer

CodeAction: owned to slice type

Open
#14,288 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-assists C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

i.e. convert Vec<T> to &[T] on a function parameter, let binding or struct definition.

fn some_fn(value: Vec|<u8>) {...}
fn some_fn(value: &[u8]) {...}

Not sure if it is possible to access the trait implementations of Borrow or ToOwned or if this could only be implemented for a set of hard-coded types from the std, i.e. Vec, String, OsString, PathBuf ...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by tracing rust-analyzer's CodeAction implementation and determine whether Borrow or ToOwned can drive the conversion, or whether supported standard-library types must be enumerated. Done means the action converts eligible owned types to slice or equivalent borrowed types in the listed contexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.