Skip to content
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

Fix printing of trailing comma after reordered generic params #36

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Mar 15, 2023

Example:

fn main() {
    let input = "fn f() {}";
    let mut syntax_tree = syn::parse_file(input).unwrap();
    if let syn::Item::Fn(item) = &mut syntax_tree.items[0] {
        item.sig.generics.params.push(syn::parse_quote!(T));
        item.sig.generics.params.push(syn::parse_quote!('a));
    }
    print!("{}", prettyplease::unparse(&syntax_tree));
}

Before:

fn f<'aT, >() {}

After:

fn f<'a, T>() {}

@dtolnay dtolnay merged commit f12245c into master Mar 15, 2023
@dtolnay dtolnay deleted the genericorder branch March 15, 2023 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant