Set error span correctly

`KdlParseError` has `span` field unconditionally.
This commit is contained in:
YOSHIOKA Takuma 2025-02-21 21:16:24 +09:00
parent dc2839f850
commit fee985fbbc
No known key found for this signature in database
GPG Key ID: EF2059A2B64518D7
1 changed files with 1 additions and 5 deletions

View File

@ -759,12 +759,8 @@ fn node_children(input: &mut Input<'_>) -> PResult<KdlDocument> {
.map(|_| KdlDocument::new())
.or_else(|mut e: ErrMode<KdlParseError>| {
e = match e {
#[cfg_attr(not(feature = "span"), allow(unused_mut))]
ErrMode::Cut(mut pe) => {
#[cfg(feature = "span")]
{
pe.span = Some((_before_open_loc.._after_open_loc).into());
}
pe.span = Some((_before_open_loc.._after_open_loc).into());
ErrMode::Cut(pe)
}
e => return Err(e),