Implement RTN support in rustfmt

This commit is contained in:
Michael Goulet 2024-06-28 14:18:36 -04:00
parent 51df533d06
commit 88f98c2929
2 changed files with 29 additions and 15 deletions

View File

@ -484,7 +484,10 @@ fn rewrite_generic_args(
span: Span,
) -> Option<String> {
match gen_args {
ast::GenericArgs::AngleBracketed(ref data) if !data.args.is_empty() => {
ast::GenericArgs::AngleBracketed(ref data) => {
if data.args.is_empty() {
Some("".to_owned())
} else {
let args = data
.args
.iter()
@ -500,6 +503,7 @@ fn rewrite_generic_args(
overflow::rewrite_with_angle_brackets(context, "", args.iter(), shape, span)
}
}
ast::GenericArgs::Parenthesized(ref data) => format_function_type(
data.inputs.iter().map(|x| &**x),
&data.output,
@ -508,7 +512,7 @@ fn rewrite_generic_args(
context,
shape,
),
_ => Some("".to_owned()),
ast::GenericArgs::ParenthesizedElided(..) => Some("(..)".to_owned()),
}
}

View File

@ -0,0 +1,10 @@
fn rtn()
where
T: Trait<method(..): Send + 'static>,
T::method(..): Send + 'static,
{
}
fn test() {
let x: T::method(..);
}