@@ -16,14 +16,14 @@ pub struct FluentPackedSceneTranslationParser {
16
16
/// Main difference is that it does not (yet) call parsers recursively.
17
17
impl FluentTranslationParser for FluentPackedSceneTranslationParser {
18
18
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 ( )
20
20
}
21
21
22
22
fn extract_messages ( & self , path : & GString ) -> MessageGeneration {
23
23
let class_db = ClassDb :: singleton ( ) ;
24
24
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" )
27
27
. cache_mode ( CacheMode :: REUSE )
28
28
. done ( ) ;
29
29
if loaded_res. is_none ( ) {
@@ -92,7 +92,7 @@ impl FluentTranslationParser for FluentPackedSceneTranslationParser {
92
92
tabcontainer_paths. pop ( ) ;
93
93
}
94
94
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" )
96
96
&& GString :: from ( parent_path) == tabcontainer_paths[ ( ( tabcontainer_paths. len ( ) as i64 ) - 1 ) as usize ] {
97
97
parsed_strings. push ( GString :: from ( state. get_node_name ( i) ) ) ;
98
98
}
@@ -162,15 +162,15 @@ impl FluentTranslationParser for FluentPackedSceneTranslationParser {
162
162
impl FluentPackedSceneTranslationParser {
163
163
pub fn init ( ) -> Self {
164
164
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 ( ) )
166
166
. into ( ) ;
167
167
let exception_list = [
168
168
( "LineEdit" , [ "^text$" ] ) ,
169
169
( "TextEdit" , [ "^text$" ] ) ,
170
170
( "CodeEdit" , [ "^text$" ] ) ,
171
171
] . map ( |( typename, strs) |
172
172
( 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 ( ) )
174
174
) )
175
175
)
176
176
. into ( ) ;
@@ -185,20 +185,20 @@ impl FluentPackedSceneTranslationParser {
185
185
let class_db = ClassDb :: singleton ( ) ;
186
186
187
187
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) &&
189
189
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 ( ) )
191
191
) {
192
192
return false ;
193
193
}
194
194
}
195
195
196
196
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 ( ) )
198
198
)
199
199
}
200
200
201
- fn matches ( string : GString , pattern : Gd < RegEx > ) -> bool {
201
+ fn matches ( string : & GString , pattern : Gd < RegEx > ) -> bool {
202
202
pattern. search ( string) . is_some ( )
203
203
}
204
204
}
0 commit comments