Skip to content

Commit

Permalink
Insane syntax on feature="full" only
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Sep 18, 2022
1 parent 6e09f2d commit 194c3d4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,14 +833,15 @@ pub mod parsing {
{
input.parse::<Option<Token![::]>>()?;
let args: ParenthesizedGenericArguments = input.parse()?;
let allow_associated_type = match &args.output {
ReturnType::Default => true,
ReturnType::Type(_, ty) => match **ty {
// TODO: probably some of the other kinds allow this too.
Type::Paren(_) => true,
_ => false,
},
};
let allow_associated_type = cfg!(feature = "full")
&& match &args.output {
ReturnType::Default => true,
ReturnType::Type(_, ty) => match **ty {
// TODO: probably some of the other kinds allow this too.
Type::Paren(_) => true,
_ => false,
},
};
let parenthesized = PathArguments::Parenthesized(args);
path.segments.last_mut().unwrap().arguments = parenthesized;
if allow_associated_type {
Expand Down

0 comments on commit 194c3d4

Please sign in to comment.