From 3b06fee86b24af2bbf297126bc332e5ec07875e2 Mon Sep 17 00:00:00 2001 From: Andrew Hayzen Date: Thu, 18 Apr 2024 09:34:49 +0100 Subject: [PATCH] signals: use #[must_use] when returning a QMetaObjectConnectionGuard Before we used to return a QMetaObjectConnection which used to disconnection now we have two types, so ensure #[must_use] is in the right place. --- .../src/generator/rust/property/mod.rs | 9 +++++--- .../cxx-qt-gen/src/generator/rust/signals.rs | 21 ++++++++++++------- .../test_outputs/passthrough_and_naming.rs | 21 ++++++++++++------- crates/cxx-qt-gen/test_outputs/properties.rs | 6 ++++-- crates/cxx-qt-gen/test_outputs/signals.rs | 12 +++++++---- 5 files changed, 46 insertions(+), 23 deletions(-) diff --git a/crates/cxx-qt-gen/src/generator/rust/property/mod.rs b/crates/cxx-qt-gen/src/generator/rust/property/mod.rs index 5ac31d23a..fb2bc656f 100644 --- a/crates/cxx-qt-gen/src/generator/rust/property/mod.rs +++ b/crates/cxx-qt-gen/src/generator/rust/property/mod.rs @@ -287,7 +287,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_trivial_property_changed"] fn MyObject_trivialPropertyChangedConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlertrivialPropertyChanged, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -314,6 +313,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "trivialPropertyChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_trivial_property_changed, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_trivial_property_changed( @@ -334,6 +334,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_trivial_property_changed, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_trivial_property_changed( @@ -413,7 +414,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_opaque_property_changed"] fn MyObject_opaquePropertyChangedConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandleropaquePropertyChanged, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -440,6 +440,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "opaquePropertyChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_opaque_property_changed, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_opaque_property_changed( @@ -460,6 +461,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_opaque_property_changed, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_opaque_property_changed( @@ -539,7 +541,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_unsafe_property_changed"] fn MyObject_unsafePropertyChangedConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlerunsafePropertyChanged, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -566,6 +567,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "unsafePropertyChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_unsafe_property_changed, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_unsafe_property_changed( @@ -586,6 +588,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_unsafe_property_changed, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_unsafe_property_changed( diff --git a/crates/cxx-qt-gen/src/generator/rust/signals.rs b/crates/cxx-qt-gen/src/generator/rust/signals.rs index fa52fa626..42faed392 100644 --- a/crates/cxx-qt-gen/src/generator/rust/signals.rs +++ b/crates/cxx-qt-gen/src/generator/rust/signals.rs @@ -111,7 +111,6 @@ pub fn generate_rust_signal( #[doc(hidden)] #[namespace = #namespace_str] - #[must_use] #[rust_name = #free_connect_ident_rust_str] fn #free_connect_ident_cpp(self_value: #self_type_cxx, signal_handler: #signal_handler_alias, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -136,6 +135,7 @@ pub fn generate_rust_signal( #[doc = "Connect the given function pointer to the signal "] #[doc = #signal_name_cpp_str] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn #connect_ident_rust(self: #self_type_qualified, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(#module_ident::#free_connect_ident_rust( @@ -153,6 +153,7 @@ pub fn generate_rust_signal( #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn #on_ident_rust(self: #self_type_qualified, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(#module_ident::#free_connect_ident_rust( @@ -304,7 +305,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_ready"] fn MyObject_readyConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlerready, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -331,6 +331,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "ready"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_ready, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( @@ -351,6 +352,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_ready, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( @@ -471,7 +473,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_data_changed"] fn MyObject_dataChangedConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlerdataChanged, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -498,6 +499,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "dataChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_data_changed, i32, cxx::UniquePtr) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_data_changed( @@ -518,6 +520,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_data_changed, i32, cxx::UniquePtr) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_data_changed( @@ -632,7 +635,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_unsafe_signal"] fn MyObject_unsafeSignalConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlerunsafeSignal, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -659,6 +661,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "unsafeSignal"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_unsafe_signal, *mut T) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_unsafe_signal( @@ -679,6 +682,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_unsafe_signal, *mut T) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_unsafe_signal( @@ -789,7 +793,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_existing_signal"] fn MyObject_baseNameConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlerbaseName, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -816,6 +819,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "baseName"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_existing_signal, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_existing_signal( @@ -836,6 +840,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_existing_signal, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_existing_signal( @@ -941,7 +946,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_ready"] fn MyObject_readyConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlerready, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -968,6 +972,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "ready"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_ready, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( @@ -988,6 +993,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_ready, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( @@ -1085,7 +1091,6 @@ mod tests { #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_ready"] fn MyObject_readyConnect(self_value: Pin<&mut MyObject>, signal_handler: MyObjectCxxQtSignalHandlerready, conn_type: CxxQtConnectionType) -> CxxQtQMetaObjectConnection; } @@ -1112,6 +1117,7 @@ mod tests { #[doc = "Connect the given function pointer to the signal "] #[doc = "ready"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_ready, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( @@ -1132,6 +1138,7 @@ mod tests { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_ready, ) + 'static>(self: core::pin::Pin<&mut qobject::MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnectionGuard { cxx_qt::QMetaObjectConnectionGuard::from(ffi::MyObject_connect_ready( diff --git a/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs b/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs index d47b92731..133fccfe8 100644 --- a/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs +++ b/crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs @@ -104,7 +104,6 @@ pub mod ffi { >; #[doc(hidden)] #[namespace = "cxx_qt::multi_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_property_name_changed"] fn MyObject_propertyNameChangedConnect( self_value: Pin<&mut MyObject>, @@ -140,7 +139,6 @@ pub mod ffi { cxx_qt::signalhandler::CxxQtSignalHandler; #[doc(hidden)] #[namespace = "cxx_qt::multi_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_ready"] fn MyObject_readyConnect( self_value: Pin<&mut MyObject>, @@ -208,7 +206,6 @@ pub mod ffi { >; #[doc(hidden)] #[namespace = "second_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "SecondObject_connect_property_name_changed"] fn SecondObject_propertyNameChangedConnect( self_value: Pin<&mut SecondObject>, @@ -245,7 +242,6 @@ pub mod ffi { cxx_qt::signalhandler::CxxQtSignalHandler; #[doc(hidden)] #[namespace = "second_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "SecondObject_connect_ready"] fn SecondObject_readyConnect( self_value: Pin<&mut SecondObject>, @@ -295,7 +291,6 @@ pub mod ffi { cxx_qt::signalhandler::CxxQtSignalHandler; #[doc(hidden)] #[namespace = "rust::cxxqtgen1"] - #[must_use] #[rust_name = "QPushButton_connect_clicked"] fn QPushButton_clickedConnect( self_value: Pin<&mut QPushButton>, @@ -326,7 +321,6 @@ pub mod ffi { >; #[doc(hidden)] #[namespace = "mynamespace::rust::cxxqtgen1"] - #[must_use] #[rust_name = "ExternObject_connect_data_ready"] fn ExternObject_dataReadyConnect( self_value: Pin<&mut ExternObject>, @@ -359,7 +353,6 @@ pub mod ffi { >; #[doc(hidden)] #[namespace = "mynamespace::rust::cxxqtgen1"] - #[must_use] #[rust_name = "ExternObject_connect_error_occurred"] fn ExternObject_errorOccurredConnect( self_value: Pin<&mut ExternObject>, @@ -403,6 +396,7 @@ impl ffi::MyObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "propertyNameChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_property_name_changed) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -423,6 +417,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_property_name_changed) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -467,6 +462,7 @@ impl ffi::MyObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "ready"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_ready) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -487,6 +483,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_ready) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -565,6 +562,7 @@ impl ffi::SecondObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "propertyNameChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_property_name_changed< F: FnMut(core::pin::Pin<&mut ffi::SecondObject>) + 'static, >( @@ -587,6 +585,7 @@ impl ffi::SecondObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_property_name_changed) + 'static>( self: core::pin::Pin<&mut ffi::SecondObject>, mut closure: F, @@ -631,6 +630,7 @@ impl ffi::SecondObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "ready"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_ready) + 'static>( self: core::pin::Pin<&mut ffi::SecondObject>, mut closure: F, @@ -651,6 +651,7 @@ impl ffi::SecondObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_ready) + 'static>( self: core::pin::Pin<&mut ffi::SecondObject>, mut closure: F, @@ -709,6 +710,7 @@ impl ffi::QPushButton { #[doc = "Connect the given function pointer to the signal "] #[doc = "clicked"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_clicked, bool) + 'static>( self: core::pin::Pin<&mut ffi::QPushButton>, mut closure: F, @@ -729,6 +731,7 @@ impl ffi::QPushButton { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_clicked, bool) + 'static>( self: core::pin::Pin<&mut ffi::QPushButton>, mut closure: F, @@ -768,6 +771,7 @@ impl ffi::ExternObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "dataReady"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_data_ready) + 'static>( self: core::pin::Pin<&mut ffi::ExternObject>, mut closure: F, @@ -782,6 +786,7 @@ impl ffi::ExternObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_data_ready) + 'static>( self: core::pin::Pin<&mut ffi::ExternObject>, mut closure: F, @@ -817,6 +822,7 @@ impl ffi::ExternObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "errorOccurred"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_error_occurred) + 'static>( self: core::pin::Pin<&mut ffi::ExternObject>, mut closure: F, @@ -839,6 +845,7 @@ impl ffi::ExternObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_error_occurred) + 'static>( self: core::pin::Pin<&mut ffi::ExternObject>, mut closure: F, diff --git a/crates/cxx-qt-gen/test_outputs/properties.rs b/crates/cxx-qt-gen/test_outputs/properties.rs index 3be6bc00e..ae877e939 100644 --- a/crates/cxx-qt-gen/test_outputs/properties.rs +++ b/crates/cxx-qt-gen/test_outputs/properties.rs @@ -62,7 +62,6 @@ mod ffi { >; #[doc(hidden)] #[namespace = "cxx_qt::my_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_primitive_changed"] fn MyObject_primitiveChangedConnect( self_value: Pin<&mut MyObject>, @@ -95,7 +94,6 @@ mod ffi { >; #[doc(hidden)] #[namespace = "cxx_qt::my_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_trivial_changed"] fn MyObject_trivialChangedConnect( self_value: Pin<&mut MyObject>, @@ -173,6 +171,7 @@ impl ffi::MyObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "primitiveChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_primitive_changed) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -195,6 +194,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_primitive_changed) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -241,6 +241,7 @@ impl ffi::MyObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "trivialChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_trivial_changed) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -255,6 +256,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_trivial_changed) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, diff --git a/crates/cxx-qt-gen/test_outputs/signals.rs b/crates/cxx-qt-gen/test_outputs/signals.rs index 113e0712e..f68bbf3ca 100644 --- a/crates/cxx-qt-gen/test_outputs/signals.rs +++ b/crates/cxx-qt-gen/test_outputs/signals.rs @@ -50,7 +50,6 @@ mod ffi { cxx_qt::signalhandler::CxxQtSignalHandler; #[doc(hidden)] #[namespace = "cxx_qt::my_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_ready"] fn MyObject_readyConnect( self_value: Pin<&mut MyObject>, @@ -85,7 +84,6 @@ mod ffi { cxx_qt::signalhandler::CxxQtSignalHandler; #[doc(hidden)] #[namespace = "cxx_qt::my_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_data_changed"] fn MyObject_dataChangedConnect( self_value: Pin<&mut MyObject>, @@ -124,7 +122,6 @@ mod ffi { cxx_qt::signalhandler::CxxQtSignalHandler; #[doc(hidden)] #[namespace = "cxx_qt::my_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "MyObject_connect_base_class_new_data"] fn MyObject_newDataConnect( self_value: Pin<&mut MyObject>, @@ -173,7 +170,6 @@ mod ffi { cxx_qt::signalhandler::CxxQtSignalHandler; #[doc(hidden)] #[namespace = "cxx_qt::my_object::rust::cxxqtgen1"] - #[must_use] #[rust_name = "QTimer_connect_timeout"] fn QTimer_timeoutConnect( self_value: Pin<&mut QTimer>, @@ -196,6 +192,7 @@ impl ffi::MyObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "ready"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_ready) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -216,6 +213,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_ready) + 'static>( self: core::pin::Pin<&mut ffi::MyObject>, mut closure: F, @@ -255,6 +253,7 @@ impl ffi::MyObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "dataChanged"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_data_changed< F: FnMut( core::pin::Pin<&mut ffi::MyObject>, @@ -283,6 +282,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_data_changed< F: FnMut( core::pin::Pin<&mut ffi::MyObject>, @@ -341,6 +341,7 @@ impl ffi::MyObject { #[doc = "Connect the given function pointer to the signal "] #[doc = "newData"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_base_class_new_data< F: FnMut( core::pin::Pin<&mut ffi::MyObject>, @@ -369,6 +370,7 @@ impl ffi::MyObject { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_base_class_new_data< F: FnMut( core::pin::Pin<&mut ffi::MyObject>, @@ -446,6 +448,7 @@ impl ffi::QTimer { #[doc = "Connect the given function pointer to the signal "] #[doc = "timeout"] #[doc = ", so that when the signal is emitted the function pointer is executed."] + #[must_use] pub fn connect_timeout) + 'static>( self: core::pin::Pin<&mut ffi::QTimer>, mut closure: F, @@ -466,6 +469,7 @@ impl ffi::QTimer { #[doc = ", so that when the signal is emitted the function pointer is executed."] #[doc = "\n"] #[doc = "Note that this method uses a AutoConnection connection type."] + #[must_use] pub fn on_timeout) + 'static>( self: core::pin::Pin<&mut ffi::QTimer>, mut closure: F,