Skip to content

Commit 3a674b4

Browse files
authored
Merge pull request #48 from RedMser/fix-4.3-crash
Cargo: update all dependencies to latest version
2 parents 58f6fbb + 5e10578 commit 3a674b4

14 files changed

+122
-117
lines changed

rust/Cargo.lock

Lines changed: 42 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/src/fluent/editor_plugin.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ impl IEditorPlugin for FluentEditorPlugin {
1515
fn enter_tree(&mut self) {
1616
let export_plugin = FluentExportPlugin::new_gd();
1717
self.export_plugin = Some(export_plugin.clone());
18-
self.base_mut().add_export_plugin(export_plugin);
18+
self.base_mut().add_export_plugin(&export_plugin);
1919
}
2020

2121
fn exit_tree(&mut self) {
22-
let export_plugin = self.export_plugin.take();
23-
self.base_mut().remove_export_plugin(export_plugin);
24-
self.export_plugin = None;
22+
if let Some(export_plugin) = self.export_plugin.take() {
23+
self.base_mut().remove_export_plugin(&export_plugin);
24+
self.export_plugin = None;
25+
}
2526
}
2627
}

rust/src/fluent/export_plugin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl IEditorExportPlugin for FluentExportPlugin {
2222
}
2323

2424
fn get_export_options(&self, _platform: Option<Gd<EditorExportPlatform>>) -> Array<Dictionary> {
25-
array![dict! {
25+
array![&dict! {
2626
"option": dict! {
2727
"name": GString::from(EXPORT_OPTION_STRIP_COMMENTS),
2828
"type": VariantType::BOOL,
@@ -36,13 +36,13 @@ impl IEditorExportPlugin for FluentExportPlugin {
3636
return;
3737
}
3838

39-
if self.base().get_option(StringName::from(EXPORT_OPTION_STRIP_COMMENTS)).booleanize() {
39+
if self.base().get_option(EXPORT_OPTION_STRIP_COMMENTS).booleanize() {
4040
// Strip comments from file
41-
let contents = strip_comments(path.clone());
41+
let contents = strip_comments(&path);
4242
let binary = PackedByteArray::from_iter(contents.bytes());
4343

4444
self.base_mut().skip();
45-
self.base_mut().add_file(path, binary, false);
45+
self.base_mut().add_file(&path, &binary, false);
4646
}
4747
}
4848

rust/src/fluent/extractor_packed_scene.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ pub struct FluentPackedSceneTranslationParser {
1616
/// Main difference is that it does not (yet) call parsers recursively.
1717
impl FluentTranslationParser for FluentPackedSceneTranslationParser {
1818
fn get_recognized_extensions(&self) -> Vec<GString> {
19-
ResourceLoader::singleton().get_recognized_extensions_for_type("PackedScene".into()).to_vec()
19+
ResourceLoader::singleton().get_recognized_extensions_for_type("PackedScene").to_vec()
2020
}
2121

2222
fn extract_messages(&self, path: &GString) -> MessageGeneration {
2323
let class_db = ClassDb::singleton();
2424

25-
let loaded_res = ResourceLoader::singleton().load_ex(path.clone())
26-
.type_hint("PackedScene".into())
25+
let loaded_res = ResourceLoader::singleton().load_ex(path)
26+
.type_hint("PackedScene")
2727
.cache_mode(CacheMode::REUSE)
2828
.done();
2929
if loaded_res.is_none() {
@@ -92,7 +92,7 @@ impl FluentTranslationParser for FluentPackedSceneTranslationParser {
9292
tabcontainer_paths.pop();
9393
}
9494

95-
if auto_translating && !tabcontainer_paths.is_empty() && class_db.is_parent_class(node_type.clone(), "Control".into())
95+
if auto_translating && !tabcontainer_paths.is_empty() && class_db.is_parent_class(&node_type, "Control")
9696
&& GString::from(parent_path) == tabcontainer_paths[((tabcontainer_paths.len() as i64) - 1) as usize] {
9797
parsed_strings.push(GString::from(state.get_node_name(i)));
9898
}
@@ -162,15 +162,15 @@ impl FluentTranslationParser for FluentPackedSceneTranslationParser {
162162
impl FluentPackedSceneTranslationParser {
163163
pub fn init() -> Self {
164164
let lookup_properties = ["^text$", "^.+_text$", "^popup/.+/text$", "^title$", "^filters$", /* "^script$", */]
165-
.map(|str| RegEx::create_from_string(str.into()).unwrap())
165+
.map(|str| RegEx::create_from_string(str).unwrap())
166166
.into();
167167
let exception_list = [
168168
("LineEdit", ["^text$"]),
169169
("TextEdit", ["^text$"]),
170170
("CodeEdit", ["^text$"]),
171171
].map(|(typename, strs)|
172172
(StringName::from(typename), HashSet::from(
173-
strs.map(|str| RegEx::create_from_string(str.into()).unwrap())
173+
strs.map(|str| RegEx::create_from_string(str).unwrap())
174174
))
175175
)
176176
.into();
@@ -185,20 +185,20 @@ impl FluentPackedSceneTranslationParser {
185185
let class_db = ClassDb::singleton();
186186

187187
for (exception_node_type, exception_properties) in &self.exception_list {
188-
if class_db.is_parent_class(node_type.clone(), exception_node_type.clone()) &&
188+
if class_db.is_parent_class(node_type, exception_node_type) &&
189189
exception_properties.iter().any(|exception_property|
190-
Self::matches(GString::from(property_name), exception_property.clone())
190+
Self::matches(&GString::from(property_name), exception_property.clone())
191191
) {
192192
return false;
193193
}
194194
}
195195

196196
self.lookup_properties.iter().any(|lookup_property|
197-
Self::matches(GString::from(property_name), lookup_property.clone())
197+
Self::matches(&GString::from(property_name), lookup_property.clone())
198198
)
199199
}
200200

201-
fn matches(string: GString, pattern: Gd<RegEx>) -> bool {
201+
fn matches(string: &GString, pattern: Gd<RegEx>) -> bool {
202202
pattern.search(string).is_some()
203203
}
204204
}

0 commit comments

Comments
 (0)