Skip to content

Commit e37c78c

Browse files
committed
factor concat function
move concat clean test fix: fix rebase linter: add allow dead code alllow dead code
1 parent 006c9e1 commit e37c78c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ fn create_frame_string(value: Vec<String>) -> String {
184184
.join(",")
185185
}
186186

187+
/// This part of the code is not already used
188+
#[allow(dead_code)]
189+
fn concat_line(main_string: String, frame_string: String) -> String {
190+
let buf: bool = false;
191+
if buf {
192+
let from: String = String::from("#####");
193+
main_string.replace(&from, &frame_string)
194+
} else {
195+
format!("{}@{}", main_string, frame_string)
196+
}
197+
}
187198
/// ## Basic listing of the library
188199
/// ### Description
189200
///
@@ -328,3 +339,10 @@ fn test_create_frame_string() {
328339
let expected: String = "1-3,5".to_string();
329340
assert_eq!(expected, create_frame_string(source));
330341
}
342+
#[test]
343+
fn test_concat_line() {
344+
let main_string: String = String::from("toto");
345+
let frame_string: String = String::from("bar");
346+
let expected: String = String::from("toto@bar");
347+
assert_eq!(expected, concat_line(main_string, frame_string));
348+
}

src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ struct Args {
1818
/// Represent output as a tree
1919
#[arg(short, long)]
2020
tree: bool,
21+
/// Display Buf format
22+
#[arg(short, long)]
23+
buf: bool,
2124

2225
/// Path to parse
2326
#[arg(value_name = "PATH", default_value_t = String::from("./"))]

0 commit comments

Comments
 (0)