mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +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() {
|
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,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user