aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/codegen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src/codegen.rs')
-rw-r--r--xtask/src/codegen.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index 770b55a9a..53f524f42 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -52,7 +52,7 @@ fn update(path: &Path, contents: &str, mode: Mode) -> Result<()> {
52 _ => (), 52 _ => (),
53 } 53 }
54 if mode == Mode::Verify { 54 if mode == Mode::Verify {
55 Err(format!("`{}` is not up-to-date", path.display()))?; 55 anyhow::bail!("`{}` is not up-to-date", path.display());
56 } 56 }
57 eprintln!("updating {}", path.display()); 57 eprintln!("updating {}", path.display());
58 fs::write(path, contents)?; 58 fs::write(path, contents)?;
@@ -101,10 +101,8 @@ fn do_extract_comment_blocks(text: &str, allow_blocks_with_empty_lins: bool) ->
101 let is_comment = line.starts_with(prefix); 101 let is_comment = line.starts_with(prefix);
102 if is_comment { 102 if is_comment {
103 block.push(line[prefix.len()..].to_string()); 103 block.push(line[prefix.len()..].to_string());
104 } else { 104 } else if !block.is_empty() {
105 if !block.is_empty() { 105 res.push(mem::replace(&mut block, Vec::new()));
106 res.push(mem::replace(&mut block, Vec::new()))
107 }
108 } 106 }
109 } 107 }
110 if !block.is_empty() { 108 if !block.is_empty() {