Skip to content

Commit d786a55

Browse files
committed
Update string handling logic
1 parent 72ecc1e commit d786a55

File tree

8 files changed

+248
-175
lines changed

8 files changed

+248
-175
lines changed

binding-generator/src/class.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ impl Element for Class<'_> {
339339
}
340340

341341
fn rust_leafname(&self) -> Cow<str> {
342-
if self.type_ref().is_string() {
342+
if self.type_ref().as_string().is_some() {
343343
"String".into()
344344
} else {
345345
self.cpp_localname()

binding-generator/src/func.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use crate::{
2525
settings::{self, SliceHint},
2626
StrExt,
2727
StringExt,
28+
type_ref::{Dir, StrType},
2829
TypeRef,
2930
};
3031

@@ -248,7 +249,7 @@ impl<'tu> Func<'tu> {
248249
else if let Some(fld) = self.as_field_accessor() {
249250
self.type_hint != FunctionTypeHint::FieldSetter && {
250251
let type_ref = fld.type_ref();
251-
type_ref.is_const() || type_ref.is_copy() || type_ref.is_cv_string() || type_ref.is_std_string()
252+
type_ref.is_const() || type_ref.is_copy() || matches!(type_ref.as_string(), Some(Dir::In(StrType::CvString)) | Some(Dir::In(StrType::StdString)))
252253
}
253254
} else {
254255
self.entity.is_const_method()

0 commit comments

Comments
 (0)