Merge commit 'aa9bc86125' into sync-from-ra

This commit is contained in:
Laurențiu Nicola 2023-06-05 12:04:23 +03:00
parent 1570299af4
commit c48062fe2a
598 changed files with 57696 additions and 17615 deletions

View file

@ -58,21 +58,19 @@ impl CommentBlock {
assert!(tag.starts_with(char::is_uppercase));
let tag = format!("{tag}:");
// Would be nice if we had `.retain_mut` here!
CommentBlock::extract_untagged(text)
.into_iter()
.filter_map(|mut block| {
let first = block.contents.remove(0);
first.strip_prefix(&tag).map(|id| {
if block.is_doc {
panic!("Use plain (non-doc) comments with tags like {tag}:\n {first}");
}
let mut blocks = CommentBlock::extract_untagged(text);
blocks.retain_mut(|block| {
let first = block.contents.remove(0);
let Some(id) = first.strip_prefix(&tag) else { return false; };
block.id = id.trim().to_string();
block
})
})
.collect()
if block.is_doc {
panic!("Use plain (non-doc) comments with tags like {tag}:\n {first}");
}
block.id = id.trim().to_string();
true
});
blocks
}
pub fn extract_untagged(text: &str) -> Vec<CommentBlock> {