Skip to content

Commit

Permalink
Resolve collapsible_if lint in generic associated type equality parsing
Browse files Browse the repository at this point in the history
    error: this `if` statement can be collapsed
       --> src/path.rs:255:17
        |
    255 | /                 if match &argument {
    256 | |                     Type::Path(argument)
    257 | |                         if argument.qself.is_none()
    258 | |                             && argument.path.leading_colon.is_none()
    ...   |
    281 | |                     }
    282 | |                 }
        | |_________________^
        |
        = note: `-D clippy::collapsible-if` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
  • Loading branch information
dtolnay committed Mar 29, 2021
1 parent d3b0276 commit 69e5f70
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,19 @@ pub mod parsing {
}
}
_ => false,
} && if input.peek(Token![=]) {
input.parse::<Token![=]>()?;
input.parse::<Type>()?;
true
} else if input.peek(Token![:]) {
input.parse::<Token![:]>()?;
input.call(constraint_bounds)?;
true
} else {
false
} {
if if input.peek(Token![=]) {
input.parse::<Token![=]>()?;
input.parse::<Type>()?;
true
} else if input.peek(Token![:]) {
input.parse::<Token![:]>()?;
input.call(constraint_bounds)?;
true
} else {
false
} {
let verbatim = verbatim::between(begin, input);
return Ok(GenericArgument::Type(Type::Verbatim(verbatim)));
}
let verbatim = verbatim::between(begin, input);
return Ok(GenericArgument::Type(Type::Verbatim(verbatim)));
}
}

Expand Down

0 comments on commit 69e5f70

Please sign in to comment.