diff options
author | curly <curlybryce@protonmail.com> | 2023-01-05 09:03:57 -0700 |
---|---|---|
committer | curly <curlybryce@protonmail.com> | 2023-01-05 09:03:57 -0700 |
commit | 8475fb499f114a3c8062c1067b9dd00514f8dcd4 (patch) | |
tree | 9aaa5041233dc393515e7a040d7df82d766e49ba | |
parent | ee6aca2243458c44ddebd1fc141fa97b6922d9b3 (diff) | |
download | s3g-8475fb499f114a3c8062c1067b9dd00514f8dcd4.tar.gz s3g-8475fb499f114a3c8062c1067b9dd00514f8dcd4.tar.bz2 s3g-8475fb499f114a3c8062c1067b9dd00514f8dcd4.zip |
do not remove whitespace (was useless anyway)
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/lib.rs | 40 |
3 files changed, 21 insertions, 23 deletions
@@ -4,7 +4,7 @@ version = 3 [[package]] name = "s3g" -version = "1.0.0" +version = "1.0.1" dependencies = [ "toml", ] @@ -1,6 +1,6 @@ [package] name = "s3g" -version = "1.0.0" +version = "1.0.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -238,30 +238,28 @@ impl S3G { "" => String::from(""), n => { let mut string = String::new(); - for x in n.split_ascii_whitespace() { - // Commands - for c in &self.config.commands { - let delim = String::new() + &self.config.command_delim.get(1..2).unwrap() + &c.0; - if x.contains(&delim) { - let x = x.replace(&delim, &c.1); - string.push_str(&x); - } + // Commands + for c in &self.config.commands { + let delim = String::new() + &self.config.command_delim.get(1..2).unwrap() + &c.0; + if n.contains(&delim) { + let n = n.replace(&delim, &c.1); + string.push_str(&n); } + } - // Files - if x.contains(&self.config.file_delim.get(1..2).unwrap()) { - let x: Vec<&str> = x.split(&self.config.file_delim.get(1..2).unwrap()).collect(); - for s in x { - let s = match s { - "" => String::from(""), - // Scan the file from the path - n => self.file_scan(&path::PathBuf::from(n)).unwrap_or(String::from("")), - }; + // Files + if n.contains(&self.config.file_delim.get(1..2).unwrap()) { + let n: Vec<&str> = n.split(&self.config.file_delim.get(1..2).unwrap()).collect(); + for s in n { + let s = match s { + "" => String::from(""), + // Scan the file from the path + n => self.file_scan(&path::PathBuf::from(n)).unwrap_or(String::from("")), + }; - string.push_str(&s); - } - + string.push_str(&s); } + } string }, @@ -301,4 +299,4 @@ impl S3G { Err(_) => Err(()), } } -}
\ No newline at end of file +} |