Skip to content

Commit 746fb7a

Browse files
ahayzen-kdabBe-ing
authored andcommitted
cxx-qt-gen: remove unused others from parser
1 parent 2730139 commit 746fb7a

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ impl GeneratedRustQObject {
4545
// Create the base object
4646
let qobject_idents = QObjectName::from(qobject);
4747
let namespace_idents = NamespaceName::from(qobject);
48-
let mut generated = GeneratedRustQObject {
49-
cxx_mod_contents: vec![],
50-
cxx_qt_mod_contents: qobject.others.clone(),
51-
};
48+
let mut generated = GeneratedRustQObject::default();
5249

5350
generated.append(&mut generate_qobject_definitions(
5451
&qobject_idents,

crates/cxx-qt-gen/src/parser/cxxqtdata.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,8 @@ impl ParsedCxxQtData {
269269
// If we are a trait then process it otherwise add to others
270270
if imp.trait_.is_some() {
271271
qobject.parse_trait_impl(imp)?;
272-
} else {
273-
qobject.others.push(Item::Impl(imp));
272+
return Ok(None);
274273
}
275-
276-
return Ok(None);
277274
}
278275
}
279276
}
@@ -490,8 +487,7 @@ mod tests {
490487
}
491488
};
492489
let result = cxx_qt_data.parse_cxx_qt_item(item).unwrap();
493-
assert!(result.is_none());
494-
assert_eq!(cxx_qt_data.qobjects[&qobject_ident()].others.len(), 1);
490+
assert!(result.is_some());
495491
}
496492

497493
#[test]

crates/cxx-qt-gen/src/parser/qobject.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
path::path_compare_str,
1414
},
1515
};
16-
use syn::{Attribute, Error, Ident, Item, ItemImpl, Meta, Result};
16+
use syn::{Attribute, Error, Ident, ItemImpl, Meta, Result};
1717

1818
/// Metadata for registering QML element
1919
#[derive(Clone, Debug, Default, Eq, PartialEq)]
@@ -57,9 +57,6 @@ pub struct ParsedQObject {
5757
pub locking: bool,
5858
/// Whether threading has been enabled for this QObject
5959
pub threading: bool,
60-
/// Items that we don't need to generate anything for CXX or C++
61-
/// eg impls on the Rust object or Default implementations
62-
pub others: Vec<Item>,
6360
}
6461

6562
impl TryFrom<&ForeignTypeIdentAlias> for ParsedQObject {
@@ -100,7 +97,6 @@ impl TryFrom<&ForeignTypeIdentAlias> for ParsedQObject {
10097
qml_metadata,
10198
locking: true,
10299
threading: false,
103-
others: vec![],
104100
})
105101
}
106102
}

0 commit comments

Comments
 (0)