Skip to content

"Convert as X to X::from" assist #21229

@SludgePhD

Description

@SludgePhD

It would be useful if rust-analyzer had an assist that allows quickly changing an as x cast to an x::from-style cast (when the appropriate From impl exists). This would save a bunch of typing when refactoring casts to be more precise (since as _ will wrap).

Additionally, it could also offer a conversion to .try_into().unwrap() when there is only a TryFrom/TryInto impl but no From/Into impl, since that's a common change too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions