Skip to content

Commit 9b2d2d9

Browse files
committed
Resolve semicolon_if_nothing_returned lints in generated code
warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:62:17 | 62 | __c_take_trivial_ref(d as *const D as *const ::cxx::core::ffi::c_void) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__c_take_trivial_ref(d as *const D as *const ::cxx::core::ffi::c_void);` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned = note: `-W clippy::semicolon-if-nothing-returned` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::semicolon_if_nothing_returned)]` warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:71:17 | 71 | __c_take_trivial_mut_ref(d as *mut D as *mut ::cxx::core::ffi::c_void) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__c_take_trivial_mut_ref(d as *mut D as *mut ::cxx::core::ffi::c_void);` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:80:17 | 80 | / __c_take_trivial_pin_ref( 81 | | ::cxx::core::pin::Pin::into_inner_unchecked(d) as *const D 82 | | as *const ::cxx::core::ffi::c_void, 83 | | ) | |_________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned help: add a `;` here | 83 | __c_take_trivial_pin_ref( 84 | ::cxx::core::pin::Pin::into_inner_unchecked(d) as *const D 85 | as *const ::cxx::core::ffi::c_void, 86 ~ ); | warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:92:17 | 92 | / __c_take_trivial_pin_mut_ref( 93 | | ::cxx::core::pin::Pin::into_inner_unchecked(d) as *mut D 94 | | as *mut ::cxx::core::ffi::c_void, 95 | | ) | |_________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned help: add a `;` here | 95 | __c_take_trivial_pin_mut_ref( 96 | ::cxx::core::pin::Pin::into_inner_unchecked(d) as *mut D 97 | as *mut ::cxx::core::ffi::c_void, 98 ~ ); | warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:125:17 | 125 | __c_take_trivial(d.as_mut_ptr()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__c_take_trivial(d.as_mut_ptr());` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:141:17 | 141 | __c_take_trivial_ns_ref(g as *const G as *const ::cxx::core::ffi::c_void) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__c_take_trivial_ns_ref(g as *const G as *const ::cxx::core::ffi::c_void);` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:151:17 | 151 | __c_take_trivial_ns(g.as_mut_ptr()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__c_take_trivial_ns(g.as_mut_ptr());` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:167:17 | 167 | __c_take_opaque_ref(e as *const E as *const ::cxx::core::ffi::c_void) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__c_take_opaque_ref(e as *const E as *const ::cxx::core::ffi::c_void);` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:203:17 | 203 | __c_take_opaque_ns_ref(e as *const F as *const ::cxx::core::ffi::c_void) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__c_take_opaque_ns_ref(e as *const F as *const ::cxx::core::ffi::c_void);` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned warning: consider adding a `;` to the last statement for consistent formatting --> tests/ffi/module.rs:296:17 | 296 | __ns_c_take_trivial(d.as_mut_ptr()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `__ns_c_take_trivial(d.as_mut_ptr());` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
1 parent a777cb3 commit 9b2d2d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

macro/src/expand.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,10 @@ fn expand_cxx_function_shim(efn: &ExternFn, types: &Types) -> TokenStream {
721721
if efn.throws {
722722
expr = quote_spanned!(span=> ::cxx::core::result::Result::Ok(#expr));
723723
}
724-
} else {
724+
} else if efn.throws {
725725
expr = call;
726+
} else {
727+
expr = quote! { #call; };
726728
}
727729
let dispatch = quote_spanned!(span=> unsafe { #setup #expr });
728730
let visibility = efn.visibility;

0 commit comments

Comments
 (0)