Skip to content

Commit 756e24c

Browse files
committed
code quality
1 parent 7aeda11 commit 756e24c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/lib.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn test_create_frame_string() {
209209
#[allow(dead_code)]
210210
/// This function is intend to keep padding in the string lile:
211211
/// aa.[0035-0036].exr
212-
fn concat_line(main_string: String, frame_string: String, padding: String, buf:bool) -> String {
212+
fn concat_line(main_string: String, frame_string: String, padding: String, buf: bool) -> String {
213213
if buf {
214214
let from: String = String::from(padding);
215215
main_string.replace(&from, &frame_string)
@@ -222,14 +222,20 @@ fn test_concat_line() {
222222
let main_string: String = String::from("toto");
223223
let frame_string: String = String::from("bar");
224224
let expected: String = String::from("toto@bar");
225-
assert_eq!(expected, concat_line(main_string, frame_string,"#####".to_string(), false));
225+
assert_eq!(
226+
expected,
227+
concat_line(main_string, frame_string, "#####".to_string(), false)
228+
);
226229
}
227230
#[test]
228231
fn test_buf_concat_line() {
229232
let main_string: String = String::from("toto.#####.exr");
230233
let frame_string: String = String::from("bar");
231234
let expected: String = String::from("toto.bar.exr");
232-
assert_eq!(expected, concat_line(main_string, frame_string,"#####".to_string(), true));
235+
assert_eq!(
236+
expected,
237+
concat_line(main_string, frame_string, "#####".to_string(), true)
238+
);
233239
}
234240

235241
/// ## Basic listing of the library
@@ -241,16 +247,16 @@ fn test_buf_concat_line() {
241247
///
242248
/// It take a `Vec<String>` of entries as an input
243249
/// - Pack the frames
244-
pub fn basic_listing(frames: Vec<String>, buf:bool) -> Vec<String> {
250+
pub fn basic_listing(frames: Vec<String>, buf: bool) -> Vec<String> {
245251
let frames_dict: HashMap<String, Vec<String>> = parse_result(frames);
246252
let mut out_frames: Vec<String> = Vec::new();
247253
for (key, value) in frames_dict {
248254
if value[0] == "None" && value.len() == 1 {
249255
out_frames.push(key);
250256
} else {
251-
let to =value.first().unwrap();
257+
let to = value.first().unwrap();
252258
let from = String::from_utf8(vec![b'#'; to.len()]).unwrap();
253-
out_frames.push(concat_line(key, create_frame_string(value),from,buf ));
259+
out_frames.push(concat_line(key, create_frame_string(value), from, buf));
254260
}
255261
}
256262
out_frames
@@ -275,7 +281,7 @@ fn get_exr_metada(re: &Regex, root_path: &String, path: &String) -> String {
275281
/// - Pack the frames
276282
/// - Print the metada if the sequence is an exr sequence
277283
/// - Return a Vector of path packed
278-
pub fn extended_listing(root_path: String, frames: Vec<String>, buf:bool) -> Vec<String> {
284+
pub fn extended_listing(root_path: String, frames: Vec<String>, buf: bool) -> Vec<String> {
279285
let re: Regex = Regex::new(r".*.exr$").unwrap();
280286
let frames_dict: HashMap<String, Vec<String>> = parse_result(frames);
281287
let mut out_frames: Vec<String> = Vec::new();
@@ -289,7 +295,7 @@ pub fn extended_listing(root_path: String, frames: Vec<String>, buf:bool) -> Vec
289295
let from = String::from_utf8(vec![b'#'; to.len()]).unwrap();
290296
let new_path = &key.replace(&from, to);
291297
medata.push(get_exr_metada(&re, &root_path, &new_path));
292-
out_frames.push(concat_line(key, create_frame_string(value),from,buf ));
298+
out_frames.push(concat_line(key, create_frame_string(value), from, buf));
293299
}
294300
}
295301
out_frames.append(&mut medata);

0 commit comments

Comments
 (0)