mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-18 10:35:25 +00:00
Refactor
This commit is contained in:
parent
d45ac01ebe
commit
2b91ffb3ae
1 changed files with 7 additions and 5 deletions
|
@ -81,16 +81,18 @@ pub fn parse_strings(
|
||||||
deduped.push(take_current(&mut current));
|
deduped.push(take_current(&mut current));
|
||||||
}
|
}
|
||||||
|
|
||||||
let node = if has_fstring {
|
Ok(if has_fstring {
|
||||||
ExprKind::JoinedStr { values: deduped }
|
Expr::new(
|
||||||
|
initial_start,
|
||||||
|
last_end,
|
||||||
|
ExprKind::JoinedStr { values: deduped },
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
deduped
|
deduped
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.exactly_one()
|
.exactly_one()
|
||||||
.expect("String must be concatenated to a single element.")
|
.expect("String must be concatenated to a single element.")
|
||||||
.node
|
})
|
||||||
};
|
|
||||||
Ok(Expr::new(initial_start, last_end, node))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue