refactor(frontmatter): Pull out common span

This commit is contained in:
Ed Page 2025-09-16 11:29:53 -05:00
parent 42027af706
commit 640e12cdfc

View File

@ -10,17 +10,18 @@ pub(super) fn expand_manifest(content: &str) -> Result<String, FrontmatterError>
match source.info() { match source.info() {
Some("cargo") | None => {} Some("cargo") | None => {}
Some(other) => { Some(other) => {
let info_span = source.info_span().unwrap();
if let Some(remainder) = other.strip_prefix("cargo,") { if let Some(remainder) = other.strip_prefix("cargo,") {
return Err(FrontmatterError::new( return Err(FrontmatterError::new(
format!("unsupported frontmatter infostring attributes: `{remainder}`"), format!("unsupported frontmatter infostring attributes: `{remainder}`"),
source.info_span().unwrap(), info_span,
)); ));
} else { } else {
return Err(FrontmatterError::new( return Err(FrontmatterError::new(
format!( format!(
"unsupported frontmatter infostring `{other}`; specify `cargo` for embedding a manifest" "unsupported frontmatter infostring `{other}`; specify `cargo` for embedding a manifest"
), ),
source.info_span().unwrap(), info_span,
)); ));
} }
} }