diff options
author | David Tolnay <dtolnay@gmail.com> | 2024-05-03 23:13:50 -0400 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2024-05-03 23:14:38 -0400 |
commit | b0f010fae60f1c358ecd6b6258d3cb49c2bc5f04 (patch) | |
tree | 1bacd334b5f9df25352fb88a2e2277af573d6965 | |
parent | d5dd97693c9e7877c6aedd0b5d7e2b3368376cf5 (diff) | |
download | cxx-b0f010fae60f1c358ecd6b6258d3cb49c2bc5f04.tar.gz |
Resolve collapsible_match clippy lint
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
-rw-r--r-- | gen/src/write.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gen/src/write.rs b/gen/src/write.rs index 89037e16..6ef98250 100644 --- a/gen/src/write.rs +++ b/gen/src/write.rs @@ -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, ";"); |