Skip to content

Add ide-assist, generate single field struct From #19783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

A4-Tacks
Copy link
Contributor

@A4-Tacks A4-Tacks commented May 12, 2025

Close #19696

Assist: generate_single_field_struct_from

Implement From for a single field structure, ignore trivial types.

# //- minicore: from, phantom_data
use core::marker::PhantomData;
struct $0Foo<T> {
    id: i32,
    _phantom_data: PhantomData<T>,
}

->

use core::marker::PhantomData;
struct Foo<T> {
    id: i32,
    _phantom_data: PhantomData<T>,
}

impl<T> From<i32> for Foo<T> {
    fn from(id: i32) -> Self {
        Self { id, _phantom_data: PhantomData }
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 12, 2025
@A4-Tacks A4-Tacks force-pushed the generate-single-field-from branch 3 times, most recently from 32ce5ad to 84e645d Compare May 12, 2025 22:11
@A4-Tacks
Copy link
Contributor Author

r? @Veykril

@A4-Tacks A4-Tacks changed the title feat: ide-assist, generate single field struct From Add ide-assist, generate single field struct From Jun 2, 2025
@A4-Tacks A4-Tacks force-pushed the generate-single-field-from branch from 84e645d to 3de5329 Compare June 5, 2025 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate From impl for single field structs
3 participants