Skip to content

Commit f5afefe

Browse files
kristof-matteiahayzen-kdab
authored andcommitted
fix: mark all std::boxed::Box returns with #[allow(clippy::unnecessary_box_returns)], and updated tests
1 parent f55c006 commit f5afefe

File tree

7 files changed

+14
-0
lines changed

7 files changed

+14
-0
lines changed

crates/cxx-qt-gen/src/generator/rust/constructor.rs

+4
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ pub fn generate(
406406
#[doc(hidden)]
407407
#[allow(unused_variables)]
408408
#[allow(clippy::extra_unused_lifetimes)]
409+
#[allow(clippy::unnecessary_box_returns)]
409410
// If we use the lifetime here for casting to the specific Constructor type, then
410411
// clippy for some reason thinks that the lifetime is unused even though it is used
411412
// by the `as` expression.
@@ -492,6 +493,7 @@ mod tests {
492493
&blocks.cxx_qt_mod_contents[0],
493494
quote! {
494495
#[doc(hidden)]
496+
#[allow(clippy::unnecessary_box_returns)]
495497
pub fn create_rs_MyObjectRust() -> std::boxed::Box<MyObjectRust>
496498
{
497499
std::boxed::Box::new(core::default::Default::default())
@@ -600,6 +602,7 @@ mod tests {
600602
#[doc(hidden)]
601603
#[allow(unused_variables)]
602604
#[allow(clippy::extra_unused_lifetimes)]
605+
#[allow(clippy::unnecessary_box_returns)]
603606
pub fn new_rs_MyObject_0(new_arguments: qobject::CxxQtConstructorNewArgumentsMyObject0) -> std::boxed::Box<MyObjectRust> {
604607
std::boxed::Box::new(
605608
<qobject::MyObject as cxx_qt::Constructor<()> >::new(())
@@ -733,6 +736,7 @@ mod tests {
733736
#[doc(hidden)]
734737
#[allow(unused_variables)]
735738
#[allow(clippy::extra_unused_lifetimes)]
739+
#[allow(clippy::unnecessary_box_returns)]
736740
pub fn new_rs_MyObject_1(new_arguments: qobject::CxxQtConstructorNewArgumentsMyObject1) -> std::boxed::Box<MyObjectRust> {
737741
std::boxed::Box::new(
738742
<qobject::MyObject as cxx_qt::Constructor<(*const QObject,)> >::new(

crates/cxx-qt-gen/test_outputs/inheritance.rs

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ impl cxx_qt::Upcast<inheritance::QAbstractItemModel> for inheritance::MyObject {
8484
#[allow(dead_code)]
8585
use inheritance::QAbstractItemModel as _;
8686
#[doc(hidden)]
87+
#[allow(clippy::unnecessary_box_returns)]
8788
pub fn create_rs_MyObjectRust() -> std::boxed::Box<MyObjectRust> {
8889
std::boxed::Box::new(core::default::Default::default())
8990
}

crates/cxx-qt-gen/test_outputs/invokables.rs

+2
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ pub fn route_arguments_MyObject_0<'a>(
324324
#[doc(hidden)]
325325
#[allow(unused_variables)]
326326
#[allow(clippy::extra_unused_lifetimes)]
327+
#[allow(clippy::unnecessary_box_returns)]
327328
pub fn new_rs_MyObject_0<'a>(
328329
new_arguments: ffi::CxxQtConstructorNewArgumentsMyObject0<'a>,
329330
) -> std::boxed::Box<MyObjectRust> {
@@ -356,6 +357,7 @@ pub fn route_arguments_MyObject_1() -> ffi::CxxQtConstructorArgumentsMyObject1 {
356357
#[doc(hidden)]
357358
#[allow(unused_variables)]
358359
#[allow(clippy::extra_unused_lifetimes)]
360+
#[allow(clippy::unnecessary_box_returns)]
359361
pub fn new_rs_MyObject_1(
360362
new_arguments: ffi::CxxQtConstructorNewArgumentsMyObject1,
361363
) -> std::boxed::Box<MyObjectRust> {

crates/cxx-qt-gen/test_outputs/passthrough_and_naming.rs

+3
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ cxx_qt::static_assertions::assert_eq_size!(
591591
[usize; 2]
592592
);
593593
#[doc(hidden)]
594+
#[allow(clippy::unnecessary_box_returns)]
594595
pub fn create_rs_MyObjectRust() -> std::boxed::Box<MyObjectRust> {
595596
std::boxed::Box::new(core::default::Default::default())
596597
}
@@ -756,6 +757,7 @@ cxx_qt::static_assertions::assert_eq_size!(
756757
[usize; 2]
757758
);
758759
#[doc(hidden)]
760+
#[allow(clippy::unnecessary_box_returns)]
759761
pub fn create_rs_SecondObjectRust() -> std::boxed::Box<SecondObjectRust> {
760762
std::boxed::Box::new(core::default::Default::default())
761763
}
@@ -775,6 +777,7 @@ impl ::cxx_qt::CxxQtType for ffi::SecondObject {
775777
}
776778
}
777779
#[doc(hidden)]
780+
#[allow(clippy::unnecessary_box_returns)]
778781
pub fn create_rs_ThirdObjectRust() -> std::boxed::Box<ThirdObjectRust> {
779782
std::boxed::Box::new(core::default::Default::default())
780783
}

crates/cxx-qt-gen/test_outputs/properties.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ cxx_qt::static_assertions::assert_eq_size!(
10381038
[usize; 2]
10391039
);
10401040
#[doc(hidden)]
1041+
#[allow(clippy::unnecessary_box_returns)]
10411042
pub fn create_rs_MyObjectRust() -> std::boxed::Box<MyObjectRust> {
10421043
std::boxed::Box::new(core::default::Default::default())
10431044
}

crates/cxx-qt-gen/test_outputs/qenum.rs

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ mod ffi {
145145
}
146146
}
147147
#[doc(hidden)]
148+
#[allow(clippy::unnecessary_box_returns)]
148149
pub fn create_rs_MyObjectRust() -> std::boxed::Box<MyObjectRust> {
149150
std::boxed::Box::new(core::default::Default::default())
150151
}
@@ -164,6 +165,7 @@ impl ::cxx_qt::CxxQtType for ffi::MyObject {
164165
}
165166
}
166167
#[doc(hidden)]
168+
#[allow(clippy::unnecessary_box_returns)]
167169
pub fn create_rs_InternalObject() -> std::boxed::Box<InternalObject> {
168170
std::boxed::Box::new(core::default::Default::default())
169171
}

crates/cxx-qt-gen/test_outputs/signals.rs

+1
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ cxx_qt::static_assertions::assert_eq_size!(
429429
[usize; 2]
430430
);
431431
#[doc(hidden)]
432+
#[allow(clippy::unnecessary_box_returns)]
432433
pub fn create_rs_MyObjectRust() -> std::boxed::Box<MyObjectRust> {
433434
std::boxed::Box::new(core::default::Default::default())
434435
}

0 commit comments

Comments
 (0)