Silence `unused_mut` when only `span` is mutated with `span` feature

This commit is contained in:
YOSHIOKA Takuma 2025-02-21 20:46:12 +09:00
parent c7f60b4c56
commit dc2839f850
No known key found for this signature in database
GPG Key ID: EF2059A2B64518D7
2 changed files with 23 additions and 19 deletions

View File

@ -579,6 +579,8 @@ mod test {
);
let entry: KdlEntry = " \\\n (\"m\\\"eh\")0xDEADbeef\t\\\n".parse()?;
#[cfg_attr(not(feature = "span"), allow(unused_mut))]
{
let mut ty: KdlIdentifier = "\"m\\\"eh\"".parse()?;
#[cfg(feature = "span")]
{
@ -600,6 +602,7 @@ mod test {
span: SourceSpan::from(0..26),
}
);
}
let entry: KdlEntry = " \\\n \"foo\"=(\"m\\\"eh\")0xDEADbeef\t\\\n".parse()?;
assert_eq!(

View File

@ -759,6 +759,7 @@ 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")]
{