diff options
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | src/main.rs | 5 |
2 files changed, 4 insertions, 6 deletions
| @@ -441,7 +441,7 @@ In case we reach the maximum allowed depth we truncate code block substitution a | |||
| 441 | if current_depth < max_depth { | 441 | if current_depth < max_depth { |
| 442 | let block = blocks | 442 | let block = blocks |
| 443 | .get(&Key::Macro(caps[2].to_string())) | 443 | .get(&Key::Macro(caps[2].to_string())) |
| 444 | .expect("Block not present") | 444 | .unwrap_or_else(|| panic!("Block \"{}\" not present", caps[2].to_string())) |
| 445 | .clone(); | 445 | .clone(); |
| 446 | indent(block, caps[1].len()) | 446 | indent(block, caps[1].len()) |
| 447 | } else { | 447 | } else { |
| @@ -521,8 +521,7 @@ let file = base | |||
| 521 | .clone() | 521 | .clone() |
| 522 | .unwrap_or(PathBuf::from(BASE)) | 522 | .unwrap_or(PathBuf::from(BASE)) |
| 523 | .join(path); | 523 | .join(path); |
| 524 | write_to_file(file, &code) | 524 | write_to_file(file, &code).unwrap(); |
| 525 | .expect("Unable to write to file"); | ||
| 526 | ``` | 525 | ``` |
| 527 | 526 | ||
| 528 | ## Additional details | 527 | ## Additional details |
diff --git a/src/main.rs b/src/main.rs index 8168ad8..1d6bdd4 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -70,7 +70,7 @@ fn build( | |||
| 70 | if current_depth < max_depth { | 70 | if current_depth < max_depth { |
| 71 | let block = blocks | 71 | let block = blocks |
| 72 | .get(&Key::Macro(caps[2].to_string())) | 72 | .get(&Key::Macro(caps[2].to_string())) |
| 73 | .expect("Block not present") | 73 | .unwrap_or_else(|| panic!("Block \"{}\" not present", caps[2].to_string())) |
| 74 | .clone(); | 74 | .clone(); |
| 75 | indent(block, caps[1].len()) | 75 | indent(block, caps[1].len()) |
| 76 | } else { | 76 | } else { |
| @@ -88,8 +88,7 @@ fn build( | |||
| 88 | .clone() | 88 | .clone() |
| 89 | .unwrap_or(PathBuf::from(BASE)) | 89 | .unwrap_or(PathBuf::from(BASE)) |
| 90 | .join(path); | 90 | .join(path); |
| 91 | write_to_file(file, &code) | 91 | write_to_file(file, &code).unwrap(); |
| 92 | .expect("Unable to write to file"); | ||
| 93 | }) | 92 | }) |
| 94 | } | 93 | } |
| 95 | 94 | ||
