aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index a8b8198..3890ae9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -96,7 +96,15 @@ fn main() -> Result<()> {
96 * NOTE: we are always "borrowing" the snippets of code with `Cow`, i.e., it 96 * NOTE: we are always "borrowing" the snippets of code with `Cow`, i.e., it
97 * will always be a `Cow::Borrowed` value, until we process the string 97 * will always be a `Cow::Borrowed` value, until we process the string
98 * substituting macros. */ 98 * substituting macros. */
99 blocks.insert(key, Cow::from(code)); 99 //blocks.insert(key, Cow::from(code));
100 blocks.entry(key)
101 .and_modify(|s| {
102 let mut concat = s.to_string();
103 concat.push_str("\n");
104 concat.push_str(code);
105 *s = Cow::from(concat);
106 })
107 .or_insert(Cow::from(code));
100 } else { 108 } else {
101 // println!("The following code has no ID:"); 109 // println!("The following code has no ID:");
102 // code.lines().for_each(|l| println!(" {}", l)); 110 // code.lines().for_each(|l| println!(" {}", l));