mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
refactor(frontmatter): Pull out common span
This commit is contained in:
parent
42027af706
commit
640e12cdfc
@ -10,17 +10,18 @@ pub(super) fn expand_manifest(content: &str) -> Result<String, FrontmatterError>
|
||||
match source.info() {
|
||||
Some("cargo") | None => {}
|
||||
Some(other) => {
|
||||
let info_span = source.info_span().unwrap();
|
||||
if let Some(remainder) = other.strip_prefix("cargo,") {
|
||||
return Err(FrontmatterError::new(
|
||||
format!("unsupported frontmatter infostring attributes: `{remainder}`"),
|
||||
source.info_span().unwrap(),
|
||||
info_span,
|
||||
));
|
||||
} else {
|
||||
return Err(FrontmatterError::new(
|
||||
format!(
|
||||
"unsupported frontmatter infostring `{other}`; specify `cargo` for embedding a manifest"
|
||||
),
|
||||
source.info_span().unwrap(),
|
||||
info_span,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user