Add MethodCallExpr::get_or_create_generic_arg_list

Mirrors `PathSegment's` version, except that it always generates a
turbofish
This commit is contained in:
DropDemBits 2023-07-10 23:56:59 -04:00
parent 3b7c7f97e4
commit 02c7b8b9ba
No known key found for this signature in database
GPG key ID: 7FE02A6C1EDFA075
2 changed files with 26 additions and 1 deletions

View file

@ -941,6 +941,13 @@ pub fn lifetime_arg(lifetime: ast::Lifetime) -> ast::LifetimeArg {
ast_from_text(&format!("const S: T<{lifetime}> = ();"))
}
pub fn turbofish_generic_arg_list(
args: impl IntoIterator<Item = ast::GenericArg>,
) -> ast::GenericArgList {
let args = args.into_iter().join(", ");
ast_from_text(&format!("const S: T::<{args}> = ();"))
}
pub(crate) fn generic_arg_list(
args: impl IntoIterator<Item = ast::GenericArg>,
) -> ast::GenericArgList {