Skip to content

Commit

Permalink
Resolve collapsible_match clippy lint
Browse files Browse the repository at this point in the history
    warning: this `if let` can be collapsed into the outer `if let`
        --> gen/src/write.rs:1117:13
         |
    1117 | /             if let Type::RustBox(_) | Type::UniquePtr(_) | Type::Str(_) | Type::SliceRef(_) = ret {
    1118 | |                 write!(out, ")");
    1119 | |             }
         | |_____________^
         |
    help: the outer pattern can be modified to include the inner pattern
        --> gen/src/write.rs:1116:21
         |
    1116 |         if let Some(ret) = &sig.ret {
         |                     ^^^ replace this binding
    1117 |             if let Type::RustBox(_) | Type::UniquePtr(_) | Type::Str(_) | Type::SliceRef(_) = ret {
         |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with this pattern
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
         = note: `#[warn(clippy::collapsible_match)]` on by default
  • Loading branch information
dtolnay committed May 4, 2024
1 parent d5dd976 commit b0f010f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gen/src/write.rs
Expand Up @@ -1113,10 +1113,10 @@ fn write_rust_function_shim_impl(
}
write!(out, ")");
if !indirect_return {
if let Some(ret) = &sig.ret {
if let Type::RustBox(_) | Type::UniquePtr(_) | Type::Str(_) | Type::SliceRef(_) = ret {
write!(out, ")");
}
if let Some(Type::RustBox(_) | Type::UniquePtr(_) | Type::Str(_) | Type::SliceRef(_)) =
&sig.ret
{
write!(out, ")");
}
}
writeln!(out, ";");
Expand Down

0 comments on commit b0f010f

Please sign in to comment.