@@ -145,11 +145,11 @@ pub fn convert<P: AsRef<Path>>(
145145
146146 // Read input as resources
147147 let mut resources = match input_format {
148- FormatType :: AndroidStrings ( _) => vec ! [ AndroidStringsFormat :: read_from( & input) ?. into( ) ] ,
149- FormatType :: Strings ( _) => vec ! [ StringsFormat :: read_from( & input) ?. into( ) ] ,
150- FormatType :: Xcstrings => Vec :: < Resource > :: try_from ( XcstringsFormat :: read_from ( & input) ?) ?,
151- FormatType :: CSV => Vec :: < Resource > :: try_from ( CSVFormat :: read_from ( & input) ?) ?,
152- FormatType :: TSV => Vec :: < Resource > :: try_from ( TSVFormat :: read_from ( & input) ?) ?,
148+ FormatType :: AndroidStrings ( _) => vec ! [ AndroidStringsFormat :: read_from( input) ?. into( ) ] ,
149+ FormatType :: Strings ( _) => vec ! [ StringsFormat :: read_from( input) ?. into( ) ] ,
150+ FormatType :: Xcstrings => Vec :: < Resource > :: try_from ( XcstringsFormat :: read_from ( input) ?) ?,
151+ FormatType :: CSV => Vec :: < Resource > :: try_from ( CSVFormat :: read_from ( input) ?) ?,
152+ FormatType :: TSV => Vec :: < Resource > :: try_from ( TSVFormat :: read_from ( input) ?) ?,
153153 } ;
154154
155155 // Ensure language is set for single-language inputs if provided on input_format
@@ -173,7 +173,7 @@ pub fn convert<P: AsRef<Path>>(
173173 FormatType :: AndroidStrings ( lang) => {
174174 let resource = pick_resource ( lang) ;
175175 if let Some ( res) = resource {
176- AndroidStringsFormat :: from ( res) . write_to ( & output)
176+ AndroidStringsFormat :: from ( res) . write_to ( output)
177177 } else {
178178 Err ( Error :: InvalidResource (
179179 "No matching resource for output language." . to_string ( ) ,
@@ -183,16 +183,16 @@ pub fn convert<P: AsRef<Path>>(
183183 FormatType :: Strings ( lang) => {
184184 let resource = pick_resource ( lang) ;
185185 if let Some ( res) = resource {
186- StringsFormat :: try_from ( res) ?. write_to ( & output)
186+ StringsFormat :: try_from ( res) ?. write_to ( output)
187187 } else {
188188 Err ( Error :: InvalidResource (
189189 "No matching resource for output language." . to_string ( ) ,
190190 ) )
191191 }
192192 }
193- FormatType :: Xcstrings => XcstringsFormat :: try_from ( resources) ?. write_to ( & output) ,
194- FormatType :: CSV => CSVFormat :: try_from ( resources) ?. write_to ( & output) ,
195- FormatType :: TSV => TSVFormat :: try_from ( resources) ?. write_to ( & output) ,
193+ FormatType :: Xcstrings => XcstringsFormat :: try_from ( resources) ?. write_to ( output) ,
194+ FormatType :: CSV => CSVFormat :: try_from ( resources) ?. write_to ( output) ,
195+ FormatType :: TSV => TSVFormat :: try_from ( resources) ?. write_to ( output) ,
196196 }
197197}
198198
@@ -222,8 +222,8 @@ pub fn convert_with_normalization<P: AsRef<Path>>(
222222 output_format : FormatType ,
223223 normalize : bool ,
224224) -> Result < ( ) , Error > {
225- let mut input = input. as_ref ( ) . to_path_buf ( ) ;
226- let mut output = output. as_ref ( ) . to_path_buf ( ) ;
225+ let input = input. as_ref ( ) ;
226+ let output = output. as_ref ( ) ;
227227
228228 // Carry language between single-language formats
229229 let output_format = if let Some ( lang) = input_format. language ( ) {
@@ -240,11 +240,11 @@ pub fn convert_with_normalization<P: AsRef<Path>>(
240240
241241 // Read input as resources
242242 let mut resources = match input_format {
243- FormatType :: AndroidStrings ( _) => vec ! [ AndroidStringsFormat :: read_from( & input) ?. into( ) ] ,
244- FormatType :: Strings ( _) => vec ! [ StringsFormat :: read_from( & input) ?. into( ) ] ,
245- FormatType :: Xcstrings => Vec :: < Resource > :: try_from ( XcstringsFormat :: read_from ( & input) ?) ?,
246- FormatType :: CSV => Vec :: < Resource > :: try_from ( CSVFormat :: read_from ( & input) ?) ?,
247- FormatType :: TSV => Vec :: < Resource > :: try_from ( TSVFormat :: read_from ( & input) ?) ?,
243+ FormatType :: AndroidStrings ( _) => vec ! [ AndroidStringsFormat :: read_from( input) ?. into( ) ] ,
244+ FormatType :: Strings ( _) => vec ! [ StringsFormat :: read_from( input) ?. into( ) ] ,
245+ FormatType :: Xcstrings => Vec :: < Resource > :: try_from ( XcstringsFormat :: read_from ( input) ?) ?,
246+ FormatType :: CSV => Vec :: < Resource > :: try_from ( CSVFormat :: read_from ( input) ?) ?,
247+ FormatType :: TSV => Vec :: < Resource > :: try_from ( TSVFormat :: read_from ( input) ?) ?,
248248 } ;
249249
250250 // Ensure language is set for single-language inputs if provided on input_format
@@ -261,7 +261,7 @@ pub fn convert_with_normalization<P: AsRef<Path>>(
261261 for entry in & mut res. entries {
262262 match & mut entry. value {
263263 crate :: types:: Translation :: Singular ( v) => {
264- * v = normalize_placeholders ( v) . into ( ) ;
264+ * v = normalize_placeholders ( v) ;
265265 }
266266 crate :: types:: Translation :: Plural ( p) => {
267267 for ( _c, v) in p. forms . iter_mut ( ) {
@@ -285,7 +285,7 @@ pub fn convert_with_normalization<P: AsRef<Path>>(
285285 FormatType :: AndroidStrings ( lang) => {
286286 let resource = pick_resource ( lang) ;
287287 if let Some ( res) = resource {
288- AndroidStringsFormat :: from ( res) . write_to ( & output)
288+ AndroidStringsFormat :: from ( res) . write_to ( output)
289289 } else {
290290 Err ( Error :: InvalidResource (
291291 "No matching resource for output language." . to_string ( ) ,
@@ -295,16 +295,16 @@ pub fn convert_with_normalization<P: AsRef<Path>>(
295295 FormatType :: Strings ( lang) => {
296296 let resource = pick_resource ( lang) ;
297297 if let Some ( res) = resource {
298- StringsFormat :: try_from ( res) ?. write_to ( & output)
298+ StringsFormat :: try_from ( res) ?. write_to ( output)
299299 } else {
300300 Err ( Error :: InvalidResource (
301301 "No matching resource for output language." . to_string ( ) ,
302302 ) )
303303 }
304304 }
305- FormatType :: Xcstrings => XcstringsFormat :: try_from ( resources) ?. write_to ( & output) ,
306- FormatType :: CSV => CSVFormat :: try_from ( resources) ?. write_to ( & output) ,
307- FormatType :: TSV => TSVFormat :: try_from ( resources) ?. write_to ( & output) ,
305+ FormatType :: Xcstrings => XcstringsFormat :: try_from ( resources) ?. write_to ( output) ,
306+ FormatType :: CSV => CSVFormat :: try_from ( resources) ?. write_to ( output) ,
307+ FormatType :: TSV => TSVFormat :: try_from ( resources) ?. write_to ( output) ,
308308 }
309309}
310310
0 commit comments